PMS-140: Add Playwright E2E suite against staging, run on every merge to main #90
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/pms-140-e2e-playwright"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes PMS-140.
What
Stands up a Playwright E2E suite under
e2e/that runs against the deployed staging instance (not a CI-built artifact) after every merge tomain. This is phase 1: get the harness working and shake out flakiness. The run is post-merge and informational, not a merge gate (the gate is PMS-141).Harness
Hybrid:
tests/global.setup.tslogs in through the staging SPA in a real browser and saves the session tostorageState; the request-contextapiproject reuses it for/api/v1calls. Theauth-uiproject logs in fresh so its logout assertion never invalidates the shared session.Coverage (all four AC areas)
tests/auth.spec.ts): browser SPA login asserts an authenticated session; logout invalidates it.tests/oidc.spec.ts): request-context/oauth2/authorize-> code ->/oauth2/token->/oauth2/userinfo-> refresh, PKCE, endpoints read from the live discovery document, code captured from the 302 Location without following it.tests/tickets.spec.ts): create/read/update/list in the E2E tenant.tests/contacts.spec.ts): company + contact CRUD, tenant-scoped smoke, and a cross-tenant leak canary (cross-cutting issue #8).Test-data policy
Every record carries an embedded
e2e-<epoch>-<runId>-<n>tag and lives only in the dedicated E2E tenant.global.teardown.tsdeletes this run's records and sweepse2e-residue older than 24h. Teardown is best-effort and never throws.CI
.forgejo/workflows/e2e.ymltriggers on push tomain, installs Node + Chromium, runs a deploy-sync gate (pollsGET /api/v1/versionuntil it reports the pushed commit's 12-char git hash, 15s interval / 10-min timeout) so it never tests a stale deploy, runs the suite, and uploadsplaywright-report/+test-results/on failure.Adds a
just test-e2erecipe ande2e/README.md(required secrets, one-time staging provisioning, local runs).Known limitations / notes for review
src/modules/tickets/routes.rs), so test-created tickets are not hard-deleted; their parent companies are deleted instead. Documented.lib/login.tsare permissive (the form markup lives in mokosh-clients, not this repo) and may need tuning on first real run; the post-login proof is an API probe, which is DOM-independent.codefor the already-authenticated session; if/oauth2/authorizeredirects to a login screen instead, a dedicated E2E OIDC client is needed (called out inREADME.mdand the test failure message).E2E_FOREIGN_COMPANY_IDis provided; otherwise it skips with a reason. A foreign-tenant-id read check always runs.tsc --noEmit) and Playwright test discovery both pass; first green run requires the one-time staging provisioning + secrets perREADME.md.Validation done
npm cilockfile committed;npx tsc --noEmitclean;npx playwright test --listdiscovers all 9 tests across the 3 projects.🤖 Generated with Claude Code