Running E2E tests
Integration tests (no browser)
Integration tests use the same Playwright/Vitest runner but skip browser launch entirely. They validate schema structure, module imports, Storybook configuration, and story file conventions:tests/integration/:
blocks-2-1/— Block registry and component conventionsschema-1-3/— Sanity schema validationstorybook-1-4.test.ts— Storybook config, story files, and build verificationsite-settings-2-3/— Site settings schemasponsor-3-1/— Sponsor document schematemplate-2-0/,variant-2-4/— Template block wiring
Browser matrix
Five browser projects cover the primary desktop and mobile combinations:playwright.config.ts
CI behavior
forbidOnly: true—.only()in test files blocks the pipeline.retries: 2— Each test gets two retries before failing.workers: 1— Serial execution for stability (prevents port conflicts).- Traces captured on first retry, screenshots and videos on failure.
Test file locations
Fixtures
All test files import from the shared fixtures index instead of importing directly from@playwright/test:
- network-error-monitor — Fails the test if any HTTP 4xx/5xx responses are detected during page navigation. Opt out per-test with
{ annotation: [{ type: 'skipNetworkMonitoring' }] }. - log — Structured logging attached to Playwright HTML reports.
Writing a new E2E test
1
Create the spec file
Add a
.spec.ts file in tests/e2e/. Name it after the feature (e.g., contact-form.spec.ts).2
Import from fixtures
3
Write tests with semantic locators
Prefer
getByRole, getByText, and locator with semantic selectors. Use data-testid for elements with no semantic role:4
Include an accessibility assertion
Every new page or block test must call
expectAccessible:Setting BASE_URL
By default, tests run againsthttp://localhost:4321. Override with the BASE_URL environment variable to test a deployed preview URL:
Install browser binaries once after cloning:
npx playwright install --with-deps