Files
d5ec009cb5 Add Playwright E2E suite (46 tests) + app testids + test_cases.md
- e2e/: full Playwright suite covering every spec case (staff auth/UI,
  welcome + session check-in, attendee access/gating, connections,
  profile visibility, speaker material, sponsor, feedback, E2E journeys,
  role security matrix). 46/46 passing.
- apps/convivo: add data-testid attributes (gate, tabs, scanner, toggles)
  to support the E2E suite.
- test_cases.md: spec-case-to-test coverage map (all cases fully covered).
- .gitignore: ignore e2e node_modules/reports/test-results.

Co-authored-by: Stephan Charles <[email protected]>
Co-authored-by: Amelia Hernandez <[email protected]>
Co-authored-by: Markus Franz <[email protected]>
Co-authored-by: Sabrina Hota <[email protected]>
Co-authored-by: Nilüfer Doğan <[email protected]>
2026-09-09 10:13:26 +02:00

84 lines
3.8 KiB
Markdown

# Convivo E2E Acceptance Suite
Playwright-based end-to-end acceptance tests for the Convivo application, covering
all four roles (Staff, Attendee, Speaker, Sponsor) across the full spec
(CONV-STAFF-AUTH-001 → CONV-E2E-002).
## Running
```bash
cd e2e
npm install # first time
npx playwright install chromium # first time
npx playwright test # full suite
npx playwright test <name> # a subset (e.g. `feedback`, `sponsor`)
npx playwright show-report reports/html
```
The suite runs against the live local stack (app :3000, Kong :54321, Postgres
container `supabase_db_Convivo`). Every test resets the relevant backend state
first (see `src/helpers/reset.ts`), so the suite is self-contained and
re-runnable.
## Layout
- `playwright.config.ts` — workers=1, 90s timeout, trace/screenshot/video on
failure, HTML report to `reports/html`.
- `src/helpers/` — `config` (identities, session ids), `db` (psql assertions),
`api` (PostgREST/Auth client for backend authorization checks), `reset`
(state reset + temporary-identity setup), `auth` (login flows), `multi`
(isolated per-user browser contexts).
- `src/pages/` — page objects (App, Home, Agenda, Scan, Connections, Profile,
Feedback).
- `tests/` — the spec cases, grouped by feature.
## Design decisions
- **Isolated BrowserContext per user** — multi-user tests (real-time gate lift,
connections, E2E journeys) create one context per participant so sessions never
leak and real-time behaviour is observed naturally.
- **Backend state validation** — assertions read the resulting persisted state
through a psql helper (spec §40), not just UI toasts. Authorization cases call
the RPC *as* a specific user (via their JWT) to prove the backend enforces the
rule, not just the frontend (spec §30/§39).
- **Stable `data-testid` selectors** — the app was instrumented with testids so
the suite is resilient to copy/label changes.
- **Real-time = 4s polling** — the app lifts the check-in gate via a 4s poll
(not Supabase Realtime); the real-time tests wait for that poll to fire.
## Results
**44/44 passing** (3.3 min, single worker).
| Area | Cases | Status |
|------|-------|--------|
| Staff auth | CONV-STAFF-AUTH-001..005 | ✅ |
| Staff UI | CONV-STAFF-UI-001 | ✅ |
| Welcome check-in + attendee access | CONV-CHECKIN-001..002, CONV-ATT-AUTH-001..003 | ✅ |
| Connections | CONV-CONN-001..008 | ✅ |
| Session check-in | CONV-SESSION-001..003 | ✅ |
| Profile visibility | CONV-PROFILE-001..005 | ✅ |
| Speaker + material | CONV-SPEAKER-001, CONV-MATERIAL-001..004 | ✅ |
| Sponsor | CONV-SPONSOR-001 | ✅ |
| Feedback | CONV-FEEDBACK-001..005 | ✅ |
| E2E journeys | CONV-E2E-001..002 | ✅ |
| Role security matrix | §39 (welcome/session check-in, material, feedback) | ✅ |
## Findings
- **Speakers have NULL `qr_token` in the seed** — the reset helper assigns
`CVV-SPK-9001` and re-hashes the auth password so the speaker can log in.
- **No sponsors exist in the seed** — the reset helper creates one
(`[email protected]` / `CVV-SPO-9001`).
- **Real-time is 4s polling, not Supabase Realtime** — the gate lift and
check-in activation are driven by a 4s poll in `App.tsx`.
- **`create_connection_request` is idempotent** — re-requesting an existing
connection returns the existing row rather than erroring.
- **GoTrue 500s on NULL `auth.users` token columns** — newly created auth users
must set `confirmation_token`, `email_change_token_new`, `email_change`,
`recovery_token`, `reauthentication_token`, `phone_change_token` to `''`
(empty string, not NULL) or the login endpoint returns a 500.
- **The speaker has 2 sessions** — so the pending-material pill shows a count
(not 0) even after uploading one session's material; tests assert the count
decreases by exactly 1.