Skip to content

Testing strategy

LayerLocationPrimary toolsPurpose
Unit/integrationsrc/__tests__/Jest + Testing LibraryComponent, page, and script logic.
E2E/smokee2e/PlaywrightBrowser flows and auth/navigation behavior.
Perf checkstests/performance.test.mjsNode + fetch + testing helpersHeader and response-time checks.
Web vitalstests/core-web-vitals.test.mjsPuppeteer + vitals thresholdsUX metric checks in browser context.

Canonical scripts live in apps/cosmos/digital-services/package.json.

Common commands (from monorepo root):

  • yarn workspace cosmos-digital-services test:unit
  • yarn workspace cosmos-digital-services test:e2e
  • yarn workspace cosmos-digital-services test:performance
  • yarn workspace cosmos-digital-services test:web-vitals
  • yarn workspace cosmos-digital-services test (optional wrapper script)
  • UI/content/layout updates: run test:unit; add/update targeted tests.
  • Auth/protected route changes: run auth-related Playwright coverage (e2e/auth-navigation.spec.ts) and manual session checks.
  • Header/worker/performance-sensitive changes: run perf scripts and verify impacted routes manually.
  • Some optional test wrappers in the monorepo intentionally skip in restricted environments that throw spawn EPERM.
  • Keep test command documentation synchronized with app package.json.