From 591824044bc43c2555fbdec02413e787c8b30ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Fri, 23 Oct 2026 13:19:47 +0200 Subject: [PATCH] docs(testing): describe the critical journeys and their accounts --- docs/contributing/testing.md | 22 ++++++++++++++++++++++ playwright.config.ts | 8 ++++++++ 2 files changed, 30 insertions(+) diff --git a/docs/contributing/testing.md b/docs/contributing/testing.md index fd0a7d434..6821cba0d 100644 --- a/docs/contributing/testing.md +++ b/docs/contributing/testing.md @@ -27,6 +27,28 @@ ones: `src/__tests__/test-realism-ratchet.test.ts` counts route tests that mock those numbers may only fall. Mock at the process boundary you do not own instead: provider HTTP (`safeFetch`), APNs, SMTP, the model. +## Critical journeys + +A few e2e journeys carry `@critical` in their test titles: signing in with a +password and a passkey and signing out, a reading reaching the dashboard, a +dose moving compliance, a mood entry, a lab CSV import, a questionnaire in +German and Brazilian Portuguese, a setting that persists, a backup coming +back, sharing a record, and the offline page. `pnpm e2e:critical` runs them. + +They run against the real server and a seeded Postgres. A spec file that +carries the tag may not intercept anything under `/api`, directly or through +a helper it imports; `src/__tests__/e2e-critical-no-api-stub-guard.test.ts` +refuses it and keeps a floor on the number of tagged tests. Stubbing an +unreachable third-party host that is not the journey's subject is allowed, +with the reason next to the call. + +A journey that writes gets an account nobody else writes. The accounts in +`e2e/setup/critical-fixture.ts` are seeded by global setup, one per journey +and per Chromium project, so a journey runs at both widths without the two +projects meeting. Reset what a previous run left with `resetCriticalAccount` +in a `beforeEach`, and read results through the app's own routes rather than +through the database. + ## The route test kit `tests/kit/` holds two modules for tests under `tests/integration/`. diff --git a/playwright.config.ts b/playwright.config.ts index 9a53b27c1..cd8a69347 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -27,6 +27,14 @@ import { * * To run locally: `pnpm dlx playwright install --with-deps chromium` * once, then `pnpm e2e`. + * + * The journeys tagged `@critical` (`pnpm e2e:critical`) are the exception to + * the route interception above: they intercept nothing under `/api`, which + * `src/__tests__/e2e-critical-no-api-stub-guard.test.ts` holds. Most of them + * run in both Chromium projects on an account per project + * (`e2e/setup/critical-fixture.ts`), so they need no entry in the + * `chromium-mobile` ignore list below; the ones that are on that list are + * there for the reason written beside them. */ /** * Drawn once here, before any server or worker exists, and published through