OWASP/OpenCRE
E2E: migrate frontend to Cypress (consolidate #729 + #774); keep Python Playwright
开放
#967 创建于 2026年7月8日
good first issuehelp wanted
仓库指标
- 星标
- (167 个星标)
- PR 合并指标
- (PR 指标待抓取)
描述
Goal
Consolidate frontend E2E from Jest/Puppeteer to Cypress; keep Python Playwright for backend/embeddings E2E (separate concern).
Context
Frontend browser E2E is effectively dead on main today:
yarn test:e2eruns Jest (package.json), butapplication/frontend/src/test/basic-e2e.test.tsis fully commented out (legacy Puppeteer).github/workflows/e2e.ymlis entirely commented out — E2E does not run in CIjest-puppeteer/puppeteerremain inpackage.jsonas dead tooling
Playwright in this repo is Python-only (application/prompt_client/ for embeddings/scraping). It is not the frontend E2E runner. make install-python must keep playwright install.
Two open PRs overlap on Cypress migration (see Pending merges):
- #729 — restore Cypress under
application/frontend/src/test/cypress/, re-enablee2e.yml - #774 — fuller migration: root
cypress.config.js,cypress/e2e/smoke.cy.js, stabilizedmake e2e, switchestest:e2etocypress run
Related: #523 (fix e2e tests).
Implementation instructions
0. Playwright guardrail (dependency — do first)
- Ensure
playwright installstays ininstall-python(Makefile) — required forapplication/prompt_client/ - Merge or cherry-pick branch
chore/playwright-install-guardrail(commit69049e36) before or as part of this work — documents the guardrail in Makefile + AGENTS.md - Do not remove Python Playwright when migrating frontend to Cypress
1. Document legacy Jest/Puppeteer coverage
Read application/frontend/src/test/basic-e2e.test.ts (commented) and record what routes/flows it covered. Historical coverage included:
| Flow | Route / behavior |
|---|---|
| Homepage search UI | / — #SearchBar visible, contains "Search" |
| No-results search | / → search asdf → "No results match your search term" |
| Successful free-text search | / → search crypto → results with standards + CREs |
| Standard browse | /node/standard/ASVS — heading, pagination, section link, external reference, CRE link |
| CRE search by ID | / → search 558-807 → CRE title, nested accordion |
| CRE filter (case-insensitive) | /cre/558-807?applyFilters=true&filters=asvs and filters=ASVS |
| Smartlink redirect | /smartlink/standard/CWE/1002 → /node/standard/CWE/sectionid/1002; /smartlink/standard/CWE/404 → external CWE URL |
2. Migrate to Cypress
- Use #774 as the base (Makefile
e2efixes, rootcypress.config.js, smoke suite,package.jsonscripts) - Cherry-pick anything still useful from #729 if not duplicated
-
package.json:test:e2e→cypress run; addcypress:open/cypress:run; addcypressdevDependency - Root
cypress.config.js+cypress/e2e/suite (start with smoke, expand toward legacy coverage) - Remove obsolete
cypress.jsonand commented/deletedbasic-e2e.test.ts -
make e2e: deterministic Flask on127.0.0.1:5000, readiness wait, trap cleanup (from #774) - Prefer stable selectors (
form#search-bar, semantic roles) over brittle CSS chains - Close #729 as superseded once consolidated PR merges
3. Wire Cypress into CI
- Re-enable
.github/workflows/e2e.yml(or equivalent job) so PRs run Cypress smoke E2E - Fix YAML indentation/structure (both #729 and #774 drafts need review — current
e2e.ymlon main is fully commented) - Ensure deploy workflows (
deploy.yml,deploy-staging.yml) can depend on a greenTest-e2ejob again
4. Keep Python Playwright separate
- Do not conflate Cypress (frontend) with Python Playwright (embeddings/scraping)
- Python tests under
application/tests/that use Playwright (e.g.prompt_client_pdf_embeddings_test.py, embedding registration tests) must still pass
5. Cleanup (in scope or follow-up PR)
- Remove or fully replace deprecated Jest E2E config (
jest-puppeteer,puppeteerinpackage.json) without leaving dead tooling - Document local run instructions (see success criteria)
Success criteria
All must pass before closing this issue:
- Route/feature coverage at least equivalent to historical Jest/Puppeteer E2E — minimum smoke (homepage search form, search →
/search/{term}, browse/root_cres); stretch goal: port the flows in the table above (standard browse, CRE search/filter, smartlink) - Clean code: follows existing frontend conventions; no flaky tests; sensible selectors; documented how to run locally (
make e2e,yarn cypress:open) - E2E restored in CI: Cypress job green on PRs (
.github/workflows/e2e.ymlor equivalent) - Python Playwright tests still run and pass —
playwright installinmake install-pythonunchanged; embedding/scraping tests unaffected -
make frontend/yarn buildpasses - README or AGENTS.md notes how to run Cypress locally
- Deprecated Jest E2E tooling removed or fully replaced — no commented-out Puppeteer suite, no
test:e2e→jeston main -
make lintpasses -
make e2epasses locally (Cypress smoke: 3+ tests green) - Only one open Cypress migration PR; #729 closed as superseded
Pending merges
| Item | Status |
|---|---|
chore/playwright-install-guardrail (69049e36) |
Remote branch exists; no open PR; not on main |
| #774 | Open — recommended base for consolidated work |
| #729 | Open — supersede/close after consolidation |
| #732 | Open — Cypress Makefile integration (stale, Test check failing) |
.github/workflows/e2e.yml on main |
Fully commented out — E2E not in CI |
PRs to merge/close
| PR | Action |
|---|---|
| #774 | Base for consolidated migration (after playwright guardrail) |
| #729 | Close as superseded |
chore/playwright-install-guardrail |
Open PR and merge first (or include in consolidated PR) |