Skip to main content
End-to-end tests use Playwright. There are two modes: full browser E2E across 5 device configurations, and fast integration tests that run schema/content validation without launching a browser.

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:
Integration test directories in tests/integration/:
  • blocks-2-1/ — Block registry and component conventions
  • schema-1-3/ — Sanity schema validation
  • storybook-1-4.test.ts — Storybook config, story files, and build verification
  • site-settings-2-3/ — Site settings schema
  • sponsor-3-1/ — Sponsor document schema
  • template-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:
The fixture layer provides two automatic behaviors:
  • 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 against http://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

Dependencies