Problem
The Playwright E2E suite under tests/e2e/ has only two specs and does not cover the auth flow or the bulk-import wizards, even though those are among the most user-facing and easiest-to-break flows in the app. We are one CSS regression or routing change away from a silent broken-login deploy.
Evidence
tests/e2e/ contains 2 specs at audit time (budget calculations, sync dashboard).
src/app/(auth)/login/* — Credentials login + mustChangePassword first-login redirect.
src/app/users/import/* and src/app/assignments/import/* (or the equivalent bulk paths from spec 004 / spec 011) — multi-step wizards with file upload + preview + commit.
Proposed approach
Add three Playwright specs:
tests/e2e/auth-login.spec.ts
- Navigate to
/login.
- Submit invalid credentials → expect inline error and no nav.
- Submit valid credentials (use a seeded test user) → expect redirect to
/.
- Submit valid credentials for a
mustChangePassword user → expect redirect to /setup-password and successful change.
- After login, log out (if there is a logout UI) → expect redirect to
/login.
tests/e2e/users-bulk-import.spec.ts
- Login as admin.
- Navigate to the bulk-import wizard.
- Upload a small fixture CSV with 5 valid rows.
- Verify the preview renders the parsed rows.
- Confirm the import → expect a success toast and the new users visible in
/users.
- Re-upload the same CSV → expect duplicate handling per the spec.
tests/e2e/licenses-bulk-assign.spec.ts
- Login as admin.
- Navigate to the bulk license-assignment wizard.
- Upload a fixture CSV that assigns N users to a tool that has capacity.
- Confirm → expect success and the assignments visible in
/assignments.
- Try the same flow with capacity exceeded → expect the documented error.
Fixtures + harness
- Add
tests/e2e/fixtures/ with the CSVs.
- Reuse the seeding util used by other E2E specs, or create one if missing — needs to upsert a deterministic admin and at least one tool with a known capacity.
- Stub Resend so invite emails aren't sent (set
RESEND_API_KEY=test and short-circuit the email helper, or use Playwright route mocks).
Acceptance criteria
Verification
pnpm test:e2e tests/e2e/auth-login.spec.ts is green.
pnpm test:e2e tests/e2e/users-bulk-import.spec.ts is green.
pnpm test:e2e tests/e2e/licenses-bulk-assign.spec.ts is green.
- Break the credentials check in
lib/auth.ts (e.g. always reject) → login spec fails. Revert.
Problem
The Playwright E2E suite under
tests/e2e/has only two specs and does not cover the auth flow or the bulk-import wizards, even though those are among the most user-facing and easiest-to-break flows in the app. We are one CSS regression or routing change away from a silent broken-login deploy.Evidence
tests/e2e/contains 2 specs at audit time (budget calculations, sync dashboard).src/app/(auth)/login/*— Credentials login +mustChangePasswordfirst-login redirect.src/app/users/import/*andsrc/app/assignments/import/*(or the equivalent bulk paths from spec 004 / spec 011) — multi-step wizards with file upload + preview + commit.Proposed approach
Add three Playwright specs:
tests/e2e/auth-login.spec.ts/login./.mustChangePassworduser → expect redirect to/setup-passwordand successful change./login.tests/e2e/users-bulk-import.spec.ts/users.tests/e2e/licenses-bulk-assign.spec.ts/assignments.Fixtures + harness
tests/e2e/fixtures/with the CSVs.RESEND_API_KEY=testand short-circuit the email helper, or use Playwright route mocks).Acceptance criteria
tests/e2e/.pnpm test:e2e.beforeEach(or use fresh test branches).pnpm lint && pnpm typecheckpass.Verification
pnpm test:e2e tests/e2e/auth-login.spec.tsis green.pnpm test:e2e tests/e2e/users-bulk-import.spec.tsis green.pnpm test:e2e tests/e2e/licenses-bulk-assign.spec.tsis green.lib/auth.ts(e.g. always reject) → login spec fails. Revert.