Test framework

How the Playwright test suite is structured, run, and aggregated.

xcity-home ships with a multi-tier Playwright suite. Every PR runs smoke + e2e; the nightly job runs everything including a11y and visual regression, then writes the test dashboard.

Suite layout

tests/
├── smoke/        every route loads with 200 + a key DOM marker
├── e2e/          flows: auth, blog filter, share buttons, dashboard, pricing
├── api/          contract tests for /api/* endpoints (status + shape)
├── a11y/         axe scan on the top 10 pages
├── visual/       per-section snapshots (nightly only)
└── fixtures/     reusable mocks (Stripe, Supabase, LiteLLM)

Local commands

npm run test            # all suites except visual
npm run test:smoke      # < 30 seconds — route load + 200
npm run test:e2e        # full user flows
npm run test:api        # API contract tests
npm run test:a11y       # axe-core scan
npm run test:visual     # snapshot suite (use --update-snapshots after intentional UI changes)
npm run test:dashboard  # aggregate recent runs → docs/test-dashboard

Picking the right suite

ChangeRun
Markdown / blog contenttest:smoke
Component refactortest:smoke + test:e2e
New API endpointtest:api + add a smoke for it
Visual changetest:visual --update-snapshots after review
Pre-merge full sweepnpm test

What CI runs

  • Pull request: test:smoke + test:e2e + test:api — blocks merge on failure.
  • Nightly main: all suites + test:visual + dashboard publish.

See .github/workflows/test.yml for the full pipeline.

Last updated: