Reusable workflow that runs unit tests and Playwright end-to-end tests. Both jobs are optional and run in parallel when both are enabled.
Replace
<current-sha>with the current SHA from the root README.
| Job | When | What it does |
|---|---|---|
unit-tests |
run-unit-tests: true (default) |
Runs npm run <test-command> (jest, vitest, mocha, etc.) |
playwright |
run-playwright: true (opt-in) |
Installs Chromium, runs Playwright, uploads the HTML report on failure |
jobs:
test:
uses: orangitfi/platform-tooling/.github/workflows/node-test.yml@<current-sha>jobs:
test:
uses: orangitfi/platform-tooling/.github/workflows/node-test.yml@<current-sha>
with:
run-playwright: truejobs:
e2e:
uses: orangitfi/platform-tooling/.github/workflows/node-test.yml@<current-sha>
with:
run-unit-tests: false
run-playwright: true
playwright-command: test:e2ejobs:
test:
uses: orangitfi/platform-tooling/.github/workflows/node-test.yml@<current-sha>
with:
working-directory: ./frontend
test-command: test:unit
run-playwright: true
playwright-command: test:e2e:ci| Input | Default | Description |
|---|---|---|
working-directory |
. |
Directory containing package.json |
run-unit-tests |
true |
Enable the unit test job |
test-command |
test |
npm script for unit tests |
run-playwright |
false |
Enable the Playwright job |
playwright-command |
test:e2e |
npm script for Playwright tests |
- Unit tests run fast and catch regressions in business logic immediately
- Playwright catches UI regressions and integration issues that unit tests cannot — broken routing, failed API integration, rendered output divergence
- Running them in parallel keeps the total feedback time close to the slower of the two rather than their sum
- The Playwright HTML report is uploaded as an artifact named
playwright-reportwhen the job fails. Download it from the Actions run to get a full breakdown of which tests failed, including screenshots and traces. npx playwright install --with-deps chromiuminstalls only Chromium to keep install time short. If your tests need Firefox or WebKit, add them to the install command via a customplaywright-commandwrapper or override this workflow.- For visual regression tests (screenshot diffs), use the
node-update-visual-snapshotsworkflow to regenerate baselines on Linux so they match what this CI job compares against. - If Playwright tests are flaky in CI, try adding
--retries=2to the playwright command. A retried pass still marks the job green.