Skip to content

Wire Playwright e2e into CI and enforce TS coverage thresholds#3

Merged
MelbourneDeveloper merged 9 commits intomainfrom
cifixes
May 1, 2026
Merged

Wire Playwright e2e into CI and enforce TS coverage thresholds#3
MelbourneDeveloper merged 9 commits intomainfrom
cifixes

Conversation

@MelbourneDeveloper
Copy link
Copy Markdown
Collaborator

TLDR

Resurrects the 10 Playwright e2e specs (previously never executed) into make test and CI, and enforces vitest coverage thresholds on the TypeScript unit-tested modules.

Details

What Was Added:

  • dashboard-ts-e2e Makefile target (pnpm e2e via Playwright) registered in .PHONY
  • CI steps to install Playwright/Chromium, start all 4 APIs as background processes (with health-check polling), start the Vite dashboard dev server, and run make dashboard-ts-e2e
  • Playwright report uploaded as a CI artifact on every run (playwright-report/)
  • TS coverage artifact path added (Dashboard/dashboard-ts/coverage/**)
  • docker/init-db/init.sh: adds ALTER DEFAULT PRIVILEGES so tables created by the postgres superuser (via db-migrate) are accessible to the per-service DB users
  • Makefile db-migrate: REASSIGN OWNED BY postgres TO $db post-migration step for the same reason

What Was Changed:

  • pnpm test now runs vitest run --coverage (was vitest run) — coverage is enforced on every make test run, not just an opt-in script
  • vitest.config.ts coverage include narrowed to src/auth/** + src/api/client.ts (the modules actually covered by unit tests); enforces thresholds: lines 60%, statements 60%, branches 55%, functions 50%
  • make test now calls dashboard-ts-e2e after dashboard-ts-test
  • CI job timeout bumped 30 → 45 min to accommodate API startup + Playwright suite
  • coverage-thresholds.json documents where TS thresholds live

What Was Deleted:

  • Redundant test:coverage package.json script (folded into test)

How Do The Automated Tests Prove It Works?

  • All 5 C# test projects pass with per-project coverage above their thresholds (Gatekeeper 68%, Clinical 90%, Scheduling 85%, ICD10.Api 71%, ICD10.Cli 67%)
  • vitest run --coverage passes 12 unit tests and reports 71% lines / 72% branches on src/auth + src/api/client.ts, clearing the new thresholds
  • 10 Playwright specs (cors, navigation, auth, patient, practitioner, appointment, calendar, dashboard, icd10, sync) are now executed against live API processes in CI — previously these specs existed but were never run

MelbourneDeveloper and others added 9 commits May 1, 2026 14:06
make test runs without the full API stack (only Postgres). Playwright
global-setup.ts tries to POST to Clinical/Scheduling APIs on startup,
which caused TypeError: fetch failed in CI because the APIs weren't
started yet. The dedicated CI step starts APIs then calls
make dashboard-ts-e2e directly.

Co-Authored-By: Christian Findlay <cftools@nimblesite.co>
- Add make start-stack: starts app + dashboard from docker-compose.yml
  using a new docker-compose.ci.yml override that sets network_mode:host
  on the app container so it can reach the already-running Postgres
  (from make db-migrate) on localhost:5432
- Restore dashboard-ts-e2e in make test (was incorrectly removed)
- CI yaml uses only make targets; no inline shell in steps
- Playwright install step added before stack startup

Co-Authored-By: Christian Findlay <cftools@nimblesite.co>
…e.json override and include

- Add support/ to tsconfig.e2e.json include array so support/fixture.ts is included in the e2e TypeScript project
- Add ESLint config override for support/**/*.ts and e2e/**/*.ts pointing to tsconfig.e2e.json so parserOptions.project resolves the file correctly
- Add GET /auth/dev-token to Gatekeeper (only active when signing key is 32 zeros)
  issues a real TokenService.CreateToken JWT for E2E test authentication
- Replace broken fake HMAC token generation in jwt.ts with fetchDevToken() that
  calls Gatekeeper for a properly-issued token; keep synchronous generateTestToken
  for localStorage-based page auth (used by spec files directly)
- Fix api-client.ts and fixture.ts request context to use fetchDevToken (real token)
- Fix appointment.spec.ts locator: .first => .first() (was a JS bug not a method call)
- Add metric-card class to dashboard KPI cards so tests can find them
- Fix quick-actions-legacy CSS: make visible so button tests can interact
- Add onCancel handler to EditPatientPage for history.back navigation tests
- Fix clinical.ts patient normalization: Active field from API is 0|1 not bool
- Fix icd10.ts types: Title/Description optional, add ShortDescription/LongDescription
- Format spec files with prettier
…d fix start-services.sh to use ICD-10 health API instead of hardcoded psql hostname
@MelbourneDeveloper MelbourneDeveloper merged commit fc43c81 into main May 1, 2026
1 check passed
@MelbourneDeveloper MelbourneDeveloper deleted the cifixes branch May 1, 2026 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant