Docs

Testing

Browser and unit test coverage for the site.

Confidence loop
Tests aim to validate core behaviors without binding to fragile layout details. The goal is fast feedback, stable assertions, and minimal flake.
Jest Playwright Fixtures Deterministic

What we cover

  • Unit and component tests live under tests/.
  • End-to-end coverage uses Playwright under tests/e2e/.

Running tests

  • npm run test for Jest.
  • npm run test:e2e for Playwright (spins up npm run dev unless PLAYWRIGHT_BASE_URL is set).
  • First time only: npx playwright install to fetch browsers.
  • 01. Boot the app
    Use the dev server or PLAYWRIGHT_BASE_URL.
  • 02. Run suites
    Jest for units, Playwright for flows and navigation.
  • 03. Review artifacts
    Trace, screenshots, and log output in test-results/.
Determinism tips
  • Prefer role-based selectors and avoid brittle text matching.
  • Mock telemetry APIs when data might change.
  • Keep animation timing stable and avoid fixed waits.
Command Purpose Notes
npm run test Unit and component tests Fast feedback for shared helpers.
npm run test:e2e Browser flows Uses fixtures for telemetry APIs.

Local fixtures

  • MOCK_GITHUB_DATA_PATH points to JSON fixtures that bypass GitHub API calls in tests.
  • The Playwright config defaults this to tests/e2e/fixtures/github-repos.json.
  • If you use PLAYWRIGHT_BASE_URL, make sure the server you point to has either MOCK_GITHUB_DATA_PATH set or valid GitHub credentials.

Notes

  • E2E tests mock telemetry API routes in the browser to keep runs deterministic.