Repository navigation
Add Cypress end-to-end smoke suite, GitHub Actions workflow and Jenkins stage - #361
Conversation
…Actions workflow and Jenkins stage - e2e/: Cypress 13 project (register, login, transactions, transfer specs), compose override that builds the app from source, seed SQL and helper scripts - .github/workflows/e2e.yml: build stack, seed, run headless, archive screenshots/videos/logs on failure - Jenkinsfile: 'E2E: Cypress smoke suite' stage between image build and push - Dockerfile: runtime base openjdk:17-alpine no longer exists on Docker Hub; use eclipse-temurin:17-jre-alpine - docs/testing/e2e.md: how to run locally and add a test Co-Authored-By: Erik Rozi <erik.rozi@cognition.ai>
|
I'll fix CI failures and address comments from users with write access that start with 'Devin'.
Original prompt from Erik
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Use project bankapp-e2e with its own container names and host port 8081 so stack:up/stack:down never replace or stop a regular docker compose up of the root file. Add stack:logs so CI does not repeat the compose invocation. Co-Authored-By: Erik Rozi <erik.rozi@cognition.ai>
Reset the root file's fixed container_name values in the e2e override so E2E_COMPOSE_PROJECT can run several e2e stacks side by side. Co-Authored-By: Erik Rozi <erik.rozi@cognition.ai>
Co-Authored-By: Erik Rozi <erik.rozi@cognition.ai>
Regression verification — final head acaf192GitHub Actions: run 42161194634 passed 13/13 tests, five specs, with five downloadable Cypress videos. Run/artifact head SHA matches this PR; checkout used GitHub's generated merge commit. All six checks passed. Local: full Cypress 13/13, focused rerun 3/3; independent native Chrome verification against real MySQL passed deposit, withdrawal, and insufficient-funds rejection with deterministic resets. Local Maven download failures required the mirror/cache workaround documented in the description; CI used the unchanged online build. Java unit tests and Jenkins were not run.
|
Summary
Adds a browser-level smoke suite under
e2e/that runs the real app against real MySQL via the existingdocker-compose.yml, wires it into CI, and documents it.Suite (
e2e/cypress/e2e/, Cypress 13, 13 tests)01-register–/registerrenders; new user registers →/login→/dashboardwith$0; duplicate username showsUser already present02-login– seededalicelands on/dashboardwithCurrent Balance: $500.00; wrong password →/login?error; anonymous/dashboardredirects to login03-transactions–/transactionslists exactly alice's 3 seeded rows with the righttext-success/text-dangerclasses04-transfer– Transfer Money form debits the dashboard balance by the amount and writes aTransfer Out to bobrow; insufficient funds / unknown recipient show the.errortext05-deposit-withdrawal– three isolated regressions: deposit $125 ($500 → $625), withdrawal $75 ($500 → $425), and insufficient-funds withdrawal $501 (balance and history unchanged). Successful operations add exactly one correctly typed/valued/coloured transaction while preserving the prior rows. Reseeds before every test/retry and after the spec.Stack
e2e/docker-compose.e2e.ymloverrides the root compose file:build: .instead of pulling${DUSER}/${IMAGE}, awget /loginhealth check (the app has no actuator and the runtime image has nocurl, so the existing health check can never pass), throw-away DB volume.-p bankapp-e2e, project-scoped containersbankapp-e2e-mainapp-1/bankapp-e2e-mysql-1, host port8081viaports: !override), so it coexists with a regulardocker compose upof the root file andstack:downnever touches it. Needs Compose ≥ 2.24.e2e/seed/seed.sqlis loaded after boot (Hibernate creates the tables withddl-auto=update); it wipes and re-insertsalice/boband 5 transactions, so re-running resets state. PasswordPassword123!(bcrypt cost 10).e2e/scripts/{stack-up,seed,stack-logs,stack-down}.shwrapped asnpm run stack:up | stack:seed | stack:logs | stack:down.CI
.github/workflows/e2e.yml– Node 20 + Cypress binary cache →stack:up→stack:seed→cypress run→ on failure uploadscypress-failure-artifacts(screenshots, videos,docker compose logs); on success uploadscypress-videos;stack:downalways.Jenkinsfile– newE2E: Cypress smoke suitestage betweenDocker: Build ImagesandDocker: Push to DockerHub, archiving screenshots/videos/e2e/stack.logon failure. Not executed here (no Jenkins); the agent needs Docker Compose v2 ≥ 2.24 + Node 20.Required app fix
Dockerfile:openjdk:17-alpineno longer exists on Docker Hub (docker manifest inspect→ not found), so the image could not be built at all. Runtime stage now useseclipse-temurin:17-jre-alpine. Added.dockerignoresoe2e/node_modulesandtarget/stay out of the build context.Docs:
docs/testing/e2e.md– layout, seed table, local run, how to add a test, what CI archives.Current regression verification
Continues this PR's existing
devin/1793909604-cypress-e2e-smokebranch. This extension changes only05-deposit-withdrawal.cy.jsand the testing guide; the original 10 tests/assertions, app, Dockerfile, workflow, and Jenkinsfile are unchanged from the baseline. No intentional failures, disabled checks, or SQL-performance branch changes.1c69295150efc4fe13e4e7c3e5e5fb4a72605158, 10/10 passing; logs show checkout of merge commitcf2658b8ba2292e73cd89b6550c1d498192dfde9. Downloaded its four videos; artifact13451251512, 909,234 bytes.acaf1922cf7cc70ca0c387ed853d5f2a4441b539.037d192304a34fbd767b82e638dcc66fb0b0c5e5(final head merged intoa0653f5c358543309bbb66d3d5f72487b4df112d), not a claim that Actions checked out the head directly.cypress-videosartifact 13476947810, 1,321,627 bytes, five downloaded/probed MP4s including05-deposit-withdrawal.cy.js.mp4; expires 2026-11-13 04:16 UTC. ZIP SHA-256 from upload logs/metadata:1db2ccb83c1478cbf615353a51f897e14fe6ba8d06148f6072fe7d626ca0e990.Commands and evidence pipeline
Existing workflow commands (working directory
e2e):stack:upinvokesdocker compose -p bankapp-e2e -f docker-compose.yml -f e2e/docker-compose.e2e.yml up -d --wait --wait-timeout 300 --buildfrom the repo root. It startsmysql:8.0and the built app, waits for health, then probes/login. Docker's builder executesmvn clean install -DskipTests=true.stack:seedpipese2e/seed/seed.sqlinto the MySQL container withdocker compose ... exec -T mysql mysql --user=root --password="$DB_PASSWORD" "$DB_NAME"; the new spec repeats this viacy.exec("npm run stack:seed")before each test/retry and after the spec.cy:runinvokescypress run. CI used Cypress 13.17.0 / Electron 118 headless / Node 20; local Cypress used the same Cypress/browser versions with Node 24.19.0.actions/upload-artifact@v4uploadse2e/cypress/videosascypress-videosfor seven days. On failure,npm run -s stack:logs > logs/stack.log 2>&1 || truecollects logs and the same action archives screenshots, videos, and logs ascypress-failure-artifactsfor 14 days.stack:downalways runs. Failure-only steps were correctly skipped in this successful run; no synthetic failure was created.Local suite commands after the setup workaround below:
cd e2e E2E_SKIP_BUILD=1 npm run stack:up npm run stack:seed npm run cy:run npm run cy:run -- --spec cypress/e2e/05-deposit-withdrawal.cy.jsLocal-only build workaround and exact build commands
The original local
npm run stack:upbuild encountered Maven Central HTTP 429. A repo1.maven.org retry also failed. Google’s Maven Central mirror populated the local dependency cache successfully; an external copy of the Dockerfile then mounted that cache and built offline. Source, build/runtime base image versions, repository Dockerfile, and CI were not changed. The final GitHub Actions run built successfully with the original online command.External
maven-settings.xmlused:Executed from the repository root:
docker run --rm \ -v /home/ubuntu/repos/Springboot-BankApp:/src \ -v /home/ubuntu/.m2:/root/.m2 \ -v /home/ubuntu/.devin-files/bankapp-evidence/maven-settings.xml:/tmp/settings.xml:ro \ -w /src maven:3.8.3-openjdk-17 \ mvn -B -s /tmp/settings.xml -Dmaven.artifact.threads=1 clean install -DskipTests=true docker build --build-context maven-cache=/home/ubuntu/.m2/repository \ -f /home/ubuntu/.devin-files/bankapp-evidence/Dockerfile.cached -t bankapp:e2e .The external
Dockerfile.cachedwas identical to the repository Dockerfile except its build instruction:RUN --mount=type=bind,from=maven-cache,target=/root/.m2/repository,rw mvn -o clean install -DskipTests=trueRemaining limitations
npm cireported five dependency vulnerabilities (three moderate, two high). Dependencies were not changed; this is not a dependency-remediation PR.Initial smoke-suite verification (baseline)
Headed run against the compose stack after re-seeding — 4 specs, 10/10 passing (26 s):
Full-resolution MP4: https://devin-gtm.devinenterprise.com/api/presigned_proxy?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyX2lkIjpudWxsLCJidWNrZXRfbmFtZSI6ImRldmluYXR0YWNobWVudHMiLCJidWNrZXRfa2V5IjoiYXR0YWNobWVudHNfcHJpdmF0ZS9vcmctZWJiMGQ1NzliYmM3NDBjMjkwOGQwZGRhYWNhMDQ5Y2IvMWRiYTVlNTgtNDIwOC00MDlmLTllNzEtNmQwYzY2YTUxY2JjIiwiaWF0IjoxNzkzOTEwNzM1LCJvcmdfaWQiOiJvcmctZWJiMGQ1NzliYmM3NDBjMjkwOGQwZGRhYWNhMDQ5Y2IiLCJmaWxlbmFtZSI6ImJhbmthcHAtaGVhZGVkLXNtb2tlLWVkaXRlZC5tcDQifQ.UKPc5SN3NVLw5zLRQ-TVcO9yGRApQBZFVrXSQv8FLQc · headless videos from the CI run are in the
cypress-videosartifact of the workflow run on this PR.Task as given
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/8531d8da9dfc498ebe9c14a5ac2624d9?variant=devin
Requested by: @erikrozi
Devin Review