Skip to content

fix(e2e): complete Cypress migration and stabilize make e2e for #523#774

Open
PRAteek-singHWY wants to merge 7 commits into
OWASP:mainfrom
PRAteek-singHWY:fix/e2e-tests-523
Open

fix(e2e): complete Cypress migration and stabilize make e2e for #523#774
PRAteek-singHWY wants to merge 7 commits into
OWASP:mainfrom
PRAteek-singHWY:fix/e2e-tests-523

Conversation

@PRAteek-singHWY

Copy link
Copy Markdown
Contributor

Fixes #523

Summary

This PR completes the E2E migration path to Cypress and restores a working smoke test flow.

What changed

  • switched test:e2e from jest to cypress run in package.json
  • added Cypress scripts:
    • cypress:open
    • cypress:run
  • added root Cypress config: cypress.config.js
  • added smoke suite: cypress/e2e/smoke.cy.js
  • removed obsolete legacy files:
    • cypress.json
    • application/frontend/src/test/basic-e2e.test.ts (commented Jest/Puppeteer test)
  • fixed make e2e in Makefile:
    • deterministic Flask startup on 127.0.0.1:5000
    • readiness wait loop before test run
    • process cleanup via trap
    • env -u ELECTRON_RUN_AS_NODE yarn test:e2e for stable Cypress execution
  • removed obsolete playwright install step from install-python (Makefile), consistent with Cypress migration

Validation

  • ran: make e2e
  • result: Cypress smoke suite passed
  • outcome: 3 passing, 0 failing

Scope notes

  • this PR is intentionally scoped to fix e2e tests #523 (restore/fix e2e with Cypress)
  • no unrelated frontend build artifacts are included

@PRAteek-singHWY

Copy link
Copy Markdown
Contributor Author

Hi @northdpole picked this up based on your earlier guidance to finish the Cypress migration for e2e.

PR #774 incorporates the prior review iterations from related e2e threads (#729, #732) and is scoped to resolve #523:

  • test:e2e switched to Cypress
  • make e2e stabilized (Flask startup, readiness wait, cleanup trap)
  • smoke coverage for home/search/browse routes
  • obsolete legacy e2e files/config removed

Validation: make e2e passes locally (3 passing).

@northdpole

Copy link
Copy Markdown
Collaborator

Tracking consolidated Cypress migration in #967. Please keep playwright install in install-python — this PR currently removes it; that breaks Python embeddings (prompt_client). Playwright here is not frontend e2e.

PRAteek-singHWY added a commit to PRAteek-singHWY/OpenCRE that referenced this pull request Jul 8, 2026
Playwright here backs Python embeddings (prompt_client), not frontend
e2e. The Cypress migration replaced frontend e2e but this line was
removed by mistake, breaking `make install-python`. Restore it per
reviewer feedback on OWASP#774.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: 3edaa7c8-e774-42ce-95af-1a8c5c096803

📥 Commits

Reviewing files that changed from the base of the PR and between 07066de and 1e0c4c1.

📒 Files selected for processing (1)
  • Makefile
🚧 Files skipped from review as they are similar to previous changes (1)
  • Makefile

Summary by CodeRabbit

  • New Features

    • Added Cypress-based E2E smoke tests for the homepage search flow, the search results page, and the Root CREs page.
    • Added commands to run or open Cypress E2E tests.
  • Bug Fixes

    • Improved Flask E2E startup and teardown by waiting for HTTP readiness and reliably tracking/terminating the test server.
  • Tests

    • Switched E2E execution from the prior Jest approach to Cypress.
    • Updated Cypress configuration (base URL, test discovery, and support file behavior).

Walkthrough

The e2e workflow now starts Flask with PID-tracked cleanup and readiness polling, and the test harness is switched to Cypress with new config, scripts, dependency, and a smoke spec.

Changes

Cypress e2e migration

Layer / File(s) Summary
Robust Flask startup for e2e tests
Makefile
The e2e target now activates the virtual environment when present, sets Flask environment variables, starts and logs flask run, records the Flask PID for trap-based cleanup, polls readiness with curl, and unsets ELECTRON_RUN_AS_NODE before running tests. A blank-line edit appears near the Python install section.
Cypress configuration and smoke suite
cypress.config.js, package.json, cypress/e2e/smoke.cy.js
Cypress config sets the e2e base URL, spec pattern, video setting, and support file behavior; package.json switches test:e2e to Cypress and adds helper scripts plus the Cypress dependency; the new smoke spec covers homepage search and /root_cres.

Estimated code review effort: 2 (Simple) | ~15 minutes

Possibly related issues

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly reflects the Cypress E2E migration and make e2e stabilization tied to #523.
Description check ✅ Passed The description matches the PR changes and scope, covering Cypress migration, smoke tests, and Makefile fixes.
Linked Issues check ✅ Passed The PR addresses #523 by restoring working E2E execution through Cypress and a stabilized Flask startup flow.
Out of Scope Changes check ✅ Passed The changes appear confined to the E2E migration and related cleanup, with no clearly unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Playwright here backs Python embeddings (prompt_client), not frontend
e2e. The Cypress migration replaced frontend e2e but this line was
removed by mistake, breaking `make install-python`. Restore it per
reviewer feedback on OWASP#774.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@Makefile`:
- Around line 51-54: The Flask readiness loop in the Makefile silently continues
into yarn test:e2e even when the server never becomes reachable. Add a final
post-loop check after the existing curl retry loop, using the same
localhost:5000 readiness probe, and fail immediately with a clear error message
if Flask is still unavailable. Keep the fix localized to the wait logic around
the loop so the test target stops early on startup failures.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: ffbffddf-f7fc-4320-97bb-5c5154c9f6c3

📥 Commits

Reviewing files that changed from the base of the PR and between 909fd43 and 56d4dad.

⛔ Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (6)
  • Makefile
  • application/frontend/src/test/basic-e2e.test.ts
  • cypress.config.js
  • cypress.json
  • cypress/e2e/smoke.cy.js
  • package.json
💤 Files with no reviewable changes (2)
  • application/frontend/src/test/basic-e2e.test.ts
  • cypress.json

Comment thread Makefile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
Makefile (1)

50-61: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Add a fail-fast check after the Flask readiness loop. If Flask never starts, the target still falls through to yarn test:e2e, hiding the startup failure.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` around lines 50 - 61, The Flask startup sequence in the Makefile
target should fail fast if the readiness loop never sees the server respond,
because the current flow can continue into yarn test:e2e even when flask run
never became healthy. Update the target around the readiness loop and FLASK_PID
handling so it verifies Flask came up successfully after the curl retry loop and
exits with an error before running the E2E tests if it did not; keep the fix
localized to this startup block using the existing flask run, FLASK_PID, trap,
and curl loop logic.
🧹 Nitpick comments (1)
Makefile (1)

90-90: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Declare install as a PHONY target.

Without .PHONY: install, if a file or directory named install ever exists in the project root, make install will silently skip execution because make considers the target up-to-date.

♻️ Proposed fix
 install: install-typescript install-python migrate-upgrade

Add near other .PHONY declarations (or at the top of the file):

+.PHONY: install
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Makefile` at line 90, Declare the Makefile’s install target as phony so make
always runs install: add install to the existing .PHONY declaration near the
other targets, alongside install-typescript, install-python, and
migrate-upgrade. This ensures the install rule is not skipped if a file or
directory named install exists in the project root.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@Makefile`:
- Around line 50-61: The Flask startup sequence in the Makefile target should
fail fast if the readiness loop never sees the server respond, because the
current flow can continue into yarn test:e2e even when flask run never became
healthy. Update the target around the readiness loop and FLASK_PID handling so
it verifies Flask came up successfully after the curl retry loop and exits with
an error before running the E2E tests if it did not; keep the fix localized to
this startup block using the existing flask run, FLASK_PID, trap, and curl loop
logic.

---

Nitpick comments:
In `@Makefile`:
- Line 90: Declare the Makefile’s install target as phony so make always runs
install: add install to the existing .PHONY declaration near the other targets,
alongside install-typescript, install-python, and migrate-upgrade. This ensures
the install rule is not skipped if a file or directory named install exists in
the project root.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yml

Review profile: CHILL

Plan: Pro

Run ID: d409f667-3630-4fac-949c-ae21f0551f82

📥 Commits

Reviewing files that changed from the base of the PR and between 56d4dad and c88b73c.

📒 Files selected for processing (1)
  • Makefile

@PRAteek-singHWY

PRAteek-singHWY commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Hi @northdpole,
restored playwright install in install-python (56d4dad). Agreed, it backs the Python prompt_client embeddings rather than the frontend e2e, so it stays. Cypress migration is unchanged.

The readiness loop broke on success but fell through to yarn test:e2e
even when Flask never came up, causing confusing Cypress failures. Add a
post-loop probe that exits with a clear error if the server is still
unreachable. Addresses CodeRabbit review on OWASP#774.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix e2e tests

2 participants