src/.
Run commands
E2E tests always run against a production build. The
test:e2e and test:e2e:ui scripts call npm run build first — the Playwright suite never exercises the Astro dev server.Playwright E2E test scope
The Playwright suite (test files in./tests/) covers the four critical user journeys on the production build:
Playwright configuration
Playwright is configured inplaywright.config.ts. Key settings extracted from the file:
Browser targets — two projects:
npm run preview -- --port 4334 and waits for http://localhost:4334 before running tests. Port 4334 is intentionally different from the Astro dev server (4321) to avoid conflicts during local development.
Vitest unit test scope
Vitest is configured invitest.config.ts using getViteConfig from astro/config — this ensures the Vite build context matches the Astro project exactly:
Unit tests live alongside their source files in
src/. The current suite includes component tests such as Button.test.ts. Add new *.test.ts files anywhere under src/ and Vitest will pick them up automatically.
Important rules for contributors
The project’s CLAUDE.md establishes three related rules that apply to contributors and AI agents alike:- No automatic testing — never trigger
vitestorplaywright testas a side-effect of another task. - Manual verification first — after any significant change, provide the dev server URL and ask the human to confirm visual correctness before running the automated suite.
- E2E = production build only — Playwright always needs a built
dist/. Never point it at the dev server.