Repository navigation
Parallel Test Pipeline
Note: This page describes the Playwright-based parallel test pipeline with SonarCloud coverage merging. For Cypress E2E testing, see Cypress.
The previous frontend CI path ran unit tests and end-to-end tests in one sequential job. That increased wall-clock runtime and delayed feedback.
This guide explains how to run those test groups in parallel while still producing a single merged coverage report for Sonar.
- Run frontend unit and end-to-end tests in parallel jobs.
- Keep unit tests parallelized with a fixed worker cap.
- Keep Playwright project dependencies intact.
- Merge all coverage artifacts before Sonar ingestion.
- Keep analysis.yml unchanged because it is devops-owned.
Playwright dependency expectations:
- idir-chromium depends on idir-setup
- bceid-chromium depends on bceid-setup
flowchart TD
A[detect-changes] --> B[unit]
A --> C[e2e-idir]
A --> D[e2e-bceid]
B --> E[merge-sonar]
C --> E
D --> E
E --> F[SonarCloud]
- frontend/package.json
- .github/workflows/reusable-tests-fe.yml
Edit frontend/package.json.
Set unit workers:
"test:unit": "vitest run --coverage --allowOnly --maxWorkers=2"Add reusable merge script:
mkdir -p .nyc_output
cp coverage/coverage-final.json .nyc_output/unit-coverage.json
nyc merge .nyc_output .nyc_output/coverage.json
nyc report --reporter=lcov --reporter=cobertura --reporter=text-summary \
--report-dir=coveragePoint posttest hook to the merge script:
"posttest:coverage": "npm run coverage:merge"Notes:
- maxWorkers=2 enforces the worker cap in CI.
- coverage:merge lets the final merge job produce lcov for Sonar.
Replace .github/workflows/reusable-tests-fe.yml with a multi-job workflow.
- detect-changes: checks whether frontend/ changed.
- unit: runs Vitest unit tests and uploads unit coverage.
- e2e (matrix): runs Playwright for idir and bceid targets in parallel.
- merge-sonar: downloads artifacts, merges coverage, and runs Sonar.
- coverage-unit from frontend/coverage/coverage-final.json
- coverage-e2e-idir from frontend/.nyc_output/
- coverage-e2e-bceid from frontend/.nyc_output/
The merge job downloads e2e artifacts with pattern coverage-e2e-*.
Playwright coverage output includes testInfo.testId in file names. That includes project identity and prevents idir/bceid collisions.
In merge-sonar:
- Checkout with full history (fetch-depth: 0).
- Download unit coverage and all e2e coverage artifacts.
- Setup Node 24.
- Run npm ci and npm run coverage:merge in frontend.
- Run SonarSource/sonarqube-scan-action with the existing frontend sonar args and token.
This keeps coverage assembly explicit and scans the merged lcov report.
No change is required in analysis.yml.
Reason: analysis.yml still calls reusable-tests-fe.yml as one reusable job named tests-frontend. Internal parallelization happens inside that workflow.
- Unit tests run with maxWorkers=2.
- unit and both matrix variants of e2e run in parallel in Actions.
- merge-sonar starts only after all three test jobs pass.
- coverage/lcov.info is generated during merge-sonar.
- SonarCloud reports combined unit and e2e coverage.
- Backend-only PRs skip frontend tests via trigger detection.
- Confirm upload and download paths match exactly.
- Confirm artifact names are exact.
- Confirm the Sonar scan step runs after npm run coverage:merge.
- Confirm npm run coverage:merge runs in frontend.
- Confirm sonar.javascript.lcov.reportPaths points to coverage/lcov.info.
- Confirm .nyc_output contains e2e coverage JSON before merge.
- Confirm detect-changes uses trigger path ('frontend/').
This wiki documents NR Waste Plus for users and developers. Verify security and deployment guidance against the current application configuration before applying it elsewhere.
- Report an issue or ask a question in the GitHub repository.
- Follow the Contributing Guidelines to propose an update.
- Read the Code of Conduct.
Collection indexes support human browsing and machine retrieval. Keep both current when adding or moving wiki pages.
NR Waste Plus Wiki | GitHub Repository