Testing strategy
Test matrix
Section titled “Test matrix”| Layer | Location | Primary tools | Purpose |
|---|---|---|---|
| Unit/integration | src/__tests__/ | Jest + Testing Library | Component, page, and script logic. |
| E2E/smoke | e2e/ | Playwright | Browser flows and auth/navigation behavior. |
| Perf checks | tests/performance.test.mjs | Node + fetch + testing helpers | Header and response-time checks. |
| Web vitals | tests/core-web-vitals.test.mjs | Puppeteer + vitals thresholds | UX metric checks in browser context. |
Command source of truth
Section titled “Command source of truth”Canonical scripts live in apps/cosmos/digital-services/package.json.
Common commands (from monorepo root):
yarn workspace cosmos-digital-services test:unityarn workspace cosmos-digital-services test:e2eyarn workspace cosmos-digital-services test:performanceyarn workspace cosmos-digital-services test:web-vitalsyarn workspace cosmos-digital-services test(optional wrapper script)
Change-type expectations
Section titled “Change-type expectations”- 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.
CI and local caveats
Section titled “CI and local caveats”- 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.