test(e2e): add Playwright E2E tests for auth, tasks, and shifts

Tasks 26-28: Comprehensive E2E test suite covering:
- Auth flow with Keycloak OIDC (6 tests)
- Task management lifecycle (10 tests)
- Shift sign-up and capacity enforcement (4 tests)

Total: 20 E2E tests (auth + tasks + shifts + smoke)

Tests require Docker Compose stack to run, but all compile successfully.
This commit is contained in:
WorkClub Automation
2026-03-05 10:34:03 +01:00
parent 867decb03f
commit b6f4c905d4
13 changed files with 1557 additions and 3 deletions

View File

@@ -0,0 +1,61 @@
# Task 26: Playwright E2E Tests - Test Status Report
## Test File Created
✅ frontend/e2e/auth.spec.ts (244 lines)
## Tests Discovered
✅ 6 comprehensive E2E tests for authentication flow:
1. Scenario 1: Full auth flow E2E - redirect → Keycloak → club picker → dashboard
2. Scenario 2: Club switching refreshes data
3. Scenario 3: Logout flow - clears session and blocks protected routes
4. Unauthenticated user blocked from protected routes
5. Single-club user bypasses club picker
6. Keycloak login with invalid credentials fails
## TypeScript Compilation
✅ No errors - all tests compile successfully
## Test Execution Status
⚠️ BLOCKED: Tests cannot fully run due to environment configuration
### Blocking Issues:
1. **AUTH_SECRET not configured** - Auth.js requires AUTH_SECRET in .env
2. **Docker services not running** - Keycloak, PostgreSQL unavailable
3. **Keycloak realm not seeded** - Test users not available
### Partial Test Results:
- Tests started and Next.js dev server launched
- Playwright successfully interacts with pages
- Auth middleware triggered (MissingSecret error proves middleware works)
- One test attempted redirect flow (got to /login but no callbackUrl query param)
## What Works:
✅ Test syntax and structure
✅ Playwright configuration
✅ Browser automation setup
✅ Test discovery and compilation
✅ Next.js integration (webServer starts)
✅ Middleware execution (detected missing secret)
## What's Needed for Full Execution:
1. Start Docker Compose stack: `docker compose up -d`
2. Add AUTH_SECRET to frontend/.env: `AUTH_SECRET=<random-string>`
3. Add Keycloak config to .env:
- KEYCLOAK_CLIENT_ID=workclub-app
- KEYCLOAK_CLIENT_SECRET=<leave empty for public client>
- KEYCLOAK_ISSUER=http://localhost:8080/realms/workclub
4. Verify Keycloak realm imported with test users
5. Run: `cd frontend && bunx playwright test e2e/auth.spec.ts`
## Evidence Files:
- frontend/e2e/auth.spec.ts — Complete test implementation
- .sisyphus/evidence/task-26-test-status.txt — This report
- .sisyphus/evidence/task-26-test-execution.txt — Partial test run output
## Verification Command (when environment ready):
```bash
cd frontend
bunx playwright test e2e/auth.spec.ts --reporter=list
```
Expected result: 6/6 tests passing, screenshots saved to .sisyphus/evidence/