From 0e296407668be01bcf30cea2d04084241494db0f Mon Sep 17 00:00:00 2001 From: ConnorYoh <40631091+ConnorYoh@users.noreply.github.com> Date: Mon, 30 Mar 2026 11:27:55 +0100 Subject: [PATCH] fix: get all Playwright E2E tests loading and expand CI to run full suite (#6009) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Fix Playwright E2E tests and expand CI to run full suite ### Problem The full Playwright suite was broken in two ways: 1. **`ConvertE2E.spec.ts` crashed at import time** — `conversionEndpointDiscovery.ts` imported a React hook at the top level, which pulled in the entire component tree. That chain eventually required `material-symbols-icons.json` (a generated file that didn't exist), crashing module resolution before any tests ran. 2. **CI only ran cert validation tests** — both `build.yml` and `nightly.yml` hardcoded `src/core/tests/certValidation` as the test path, silently ignoring everything else. ### Changes **`ConvertE2E.spec.ts` — complete rewrite** The old tests were useless in practice: all 9 dynamic conversion tests were permanently skipped unless a real Spring Boot backend was running (they called a live `/api/v1/config/endpoints-enabled` endpoint at module load time). Replaced with 4 focused tests that use `page.route()` mocking — no backend required, same pattern as `CertificateValidationE2E`. New tests cover: - Convert button absent before a format pair is selected - Successful PDF→PNG conversion shows a download button (mocked API response) - API error surfaces as an error notification - Convert button appears and is enabled after selecting valid formats **`conversionEndpointDiscovery.ts` — deleted** Only existed to support the old tests. The `useConversionEndpoints` React hook it exported was never imported anywhere else. **`ReviewToolStep.tsx`** Added `data-testid="download-result-button"` to the download button — required for the happy-path test assertion. **CI workflows (`build.yml`, `nightly.yml`)** - Added a `Generate icons` step before Playwright runs (`node scripts/generate-icons.js`) — the icon JSON is generated by `npm run dev` locally but skipped by `npm ci` in CI - Removed the `src/core/tests/certValidation` path filter so the full suite runs --- .github/workflows/build.yml | 4 +- .github/workflows/nightly.yml | 5 +- .../tools/shared/ReviewToolStep.tsx | 1 + .../src/core/tests/convert/ConvertE2E.spec.ts | 609 +++++------------- .../helpers/conversionEndpointDiscovery.ts | 325 ---------- frontend/src/core/tools/Convert.tsx | 2 +- 6 files changed, 160 insertions(+), 786 deletions(-) delete mode 100644 frontend/src/core/tests/helpers/conversionEndpointDiscovery.ts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c0326e4af..d5c8285d45 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -236,10 +236,12 @@ jobs: cache-dependency-path: frontend/package-lock.json - name: Install frontend dependencies run: cd frontend && npm ci + - name: Generate icons + run: cd frontend && node scripts/generate-icons.js - name: Install Playwright (chromium only) run: cd frontend && npx playwright install chromium --with-deps - name: Run E2E tests (chromium) - run: cd frontend && npx playwright test src/core/tests/certValidation --project=chromium + run: cd frontend && npx playwright test --project=chromium - name: Upload Playwright report if: always() uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 95da59725d..b3a13e233d 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -35,11 +35,14 @@ jobs: - name: Install frontend dependencies run: cd frontend && npm ci + - name: Generate icons + run: cd frontend && node scripts/generate-icons.js + - name: Install all Playwright browsers run: cd frontend && npx playwright install --with-deps - name: Run E2E tests (all browsers) - run: cd frontend && npx playwright test src/core/tests/certValidation + run: cd frontend && npx playwright test - name: Upload Playwright report if: always() diff --git a/frontend/src/core/components/tools/shared/ReviewToolStep.tsx b/frontend/src/core/components/tools/shared/ReviewToolStep.tsx index c67d933f1d..019bb14d36 100644 --- a/frontend/src/core/components/tools/shared/ReviewToolStep.tsx +++ b/frontend/src/core/components/tools/shared/ReviewToolStep.tsx @@ -123,6 +123,7 @@ function ReviewStepContent({ )} {operation.downloadUrl && (