diff --git a/docs/sprint-12/SPRINT-12-SUMMARY.md b/docs/sprint-12/SPRINT-12-SUMMARY.md new file mode 100644 index 0000000..ea54fb3 --- /dev/null +++ b/docs/sprint-12/SPRINT-12-SUMMARY.md @@ -0,0 +1,205 @@ +# Sprint 12 — Golden Test Standard + +> **Everything Present Must Work** + +**Date:** 2026-06-18 +**Duration:** Single-day sprint +**Key Metric:** 6 P0 bugs fixed, full integration test infrastructure built + +--- + +## Overview + +Sprint 12 was a quality-focused sprint with a simple mandate: every button, every action, every interaction that exists in the UI must actually work. No dead buttons. No placeholder handlers. No "TODO: implement later." + +The sprint delivered two major outcomes: +1. **Phase 1** — Fixed all 6 non-functional buttons across Documents and Board pages, wired them to real service calls with React Query mutations +2. **Phase 2** — Built a complete Playwright integration test infrastructure (Docker Compose stack, 13 test specs, 70+ tests) to prevent regressions + +--- + +## Phase 1: Button Fixes + UX Polish + +### The Problem + +Six buttons across the Documents and Board pages were completely non-functional: + +| Page | Button | Issue | +|------|--------|-------| +| Documents | Upload | Closed dialog immediately, no file upload | +| Documents | Download | No `onClick` handler at all | +| Documents | Delete | No `onClick` handler at all | +| Board | Create Position | No service call wired | +| Board | Elect Member | No service call wired | +| Board | Remove Member | No service call wired | + +### The Fix + +Each button was wired to proper React Query mutations with: +- Optimistic UI updates where appropriate +- Error handling with toast notifications +- Loading states during async operations +- Mock-mode dual operation (works with mock data in dev, real API in production) + +### Results + +![Documents page dark mode](screenshots/documents-dark.png) +*Documents page with distinct category colors, icons, and properly sized table columns* + +![Documents upload dialog](screenshots/documents-upload-dialog.png) +*Upload dialog with controlled form state, validation, and real service call on submit* + +![Board page](screenshots/board-dark.png) +*Board management with functional Create Position, Elect Member, and Remove actions* + +![Documents page light mode](screenshots/documents-light.png) +*Documents page in light mode showing proper color contrast across both themes* + +--- + +## Phase 2: Integration Test Infrastructure + +### Architecture + +``` +┌─────────────────────────────────────────────────────────┐ +│ Docker Compose Test Stack │ +├──────────────┬──────────────┬───────────┬───────────────┤ +│ Postgres │ Backend │ Frontend │ Playwright │ +│ (tmpfs) │ (test prof.) │ (Next.js) │ (13 specs) │ +├──────────────┼──────────────┼───────────┼───────────────┤ +│ Seed via │ Flyway + │ Port 3000 │ Runs against │ +│ Flyway │ Reset EP │ │ real frontend │ +│ R__seed.sql │ /test/ │ │ + real backend│ +│ │ reset-db │ │ │ +└──────────────┴──────────────┴───────────┴───────────────┘ +``` + +### Components + +| Component | Role | Details | +|-----------|------|---------| +| **PostgreSQL** | Test database | tmpfs mount for speed, wiped between runs | +| **Backend** | Spring Boot (test profile) | Flyway migrations + `R__seed.sql` for test data, `/test/reset-db` endpoint | +| **Frontend** | Next.js | Standard build, connects to test backend | +| **Playwright** | Test runner | 13 spec files, 70+ tests, runs against real stack | + +### Seed Data + +The `R__seed.sql` repeatable migration provides a deterministic dataset: +- 1 association ("Grüner Daumen e.V.") +- 3 users (admin, board member, regular member) +- Sample documents across all categories +- Board positions with elected members +- Stock entries, distributions, and member records + +### Test Specs (13 files, 70+ tests) + +| Spec | Tests | Coverage | +|------|-------|----------| +| `auth.spec.ts` | 6 | Login, logout, session persistence, invalid credentials | +| `dashboard.spec.ts` | 5 | Widgets render, navigation, data loading | +| `documents.spec.ts` | 8 | Upload, download, delete, category filter, search | +| `board.spec.ts` | 7 | Create position, elect member, remove, term display | +| `members.spec.ts` | 6 | List, search, filter by status, detail view | +| `distributions.spec.ts` | 6 | Create, list, quota check, member assignment | +| `stock.spec.ts` | 5 | Inventory list, add entry, strain details | +| `grow.spec.ts` | 5 | Calendar view, phase tracking, notes | +| `reports.spec.ts` | 4 | Generate, download, filter by type | +| `events.spec.ts` | 5 | Create event, RSVP, calendar view | +| `finance.spec.ts` | 4 | Transactions, balance, member fees | +| `notifications.spec.ts` | 4 | List, mark read, preferences | +| `accessibility.spec.ts` | 5 | ARIA labels, keyboard nav, color contrast | + +### How to Run + +**CI (Linux — GitHub Actions / Gitea):** +```bash +docker compose -f docker-compose.test.yml up --build --abort-on-container-exit +``` + +**Local (macOS development):** +```bash +docker compose -f docker-compose.test.yml -f docker-compose.test.local.yml up --build +``` + +The `docker-compose.test.local.yml` override adjusts platform settings and port mappings for macOS development. + +--- + +## Quality Gates Passed + +| Gate | Result | Details | +|------|--------|---------| +| Expert Panel Review | ✅ APPROVED (v3, 95% confidence) | 3 cycles: v1→REVISE, v2→APPROVED@92%, v3→APPROVED@95% | +| Code Review | ✅ Approved with comments | 2 blockers found and fixed, 4 non-blocking warnings remaining | +| Build (frontend) | ✅ `pnpm build` passes | No TypeScript errors, no lint warnings | +| Build (backend) | ✅ `mvn compile` passes | Clean compilation | + +### Review Cycle History + +``` +v1 Plan → Expert Panel → REVISE (missing error handling, no seed isolation) +v2 Plan → Expert Panel → APPROVED @ 92% (added reset endpoint, tmpfs) +v3 Plan → Expert Panel → APPROVED @ 95% (final polish, accessibility spec added) +``` + +--- + +## Files Changed Summary + +**Total: 35 files, +5,278 lines** + +| Category | Files | Description | +|----------|-------|-------------| +| Frontend (pages) | 4 | Documents page, Board page, upload dialog, service hooks | +| Frontend (services) | 5 | `documents.ts`, `board.ts`, API client patches, React Query mutations | +| Frontend (test specs) | 13 | Full Playwright integration test suite | +| Frontend (config) | 3 | `playwright.config.ts`, `Dockerfile.playwright`, test utilities | +| Backend (seed) | 1 | `R__seed.sql` — repeatable Flyway migration with test data | +| Backend (config) | 1 | `application-test.properties` — test profile | +| Backend (controller) | 1 | `TestResetController` — DB reset endpoint for test isolation | +| Infrastructure | 3 | `docker-compose.test.yml`, `docker-compose.test.local.yml`, `Dockerfile.playwright` | +| Documentation | 6 | Analysis, plan, testplan, panel review, code review, this summary | + +--- + +## Running the App + +### Development mode (mock data, no backend needed): + +```bash +cd cannamanage-frontend && pnpm dev +``` + +Open http://localhost:3000 — login with `admin@gruener-daumen.de` / `TestAdmin123!` + +### Integration tests: + +```bash +# CI (Linux): +docker compose -f docker-compose.test.yml up --build --abort-on-container-exit + +# Local (macOS): +docker compose -f docker-compose.test.yml -f docker-compose.test.local.yml up --build +``` + +### Production build: + +```bash +cd cannamanage-frontend && pnpm build && pnpm start +``` + +--- + +## What's Next + +| Priority | Item | Sprint | +|----------|------|--------| +| P0 | Spin up and validate integration tests against real backend | 13 | +| P1 | Fix 4 non-blocking code review warnings | 13 | +| P2 | Sprint 13 feature work (TBD from backlog) | 13 | + +--- + +*Generated 2026-06-18 by Lumen (DocGen mode)* diff --git a/docs/sprint-12/screenshots/board-dark.png b/docs/sprint-12/screenshots/board-dark.png new file mode 100644 index 0000000..cd086e7 Binary files /dev/null and b/docs/sprint-12/screenshots/board-dark.png differ diff --git a/docs/sprint-12/screenshots/documents-dark.png b/docs/sprint-12/screenshots/documents-dark.png new file mode 100644 index 0000000..6ce9dda Binary files /dev/null and b/docs/sprint-12/screenshots/documents-dark.png differ diff --git a/docs/sprint-12/screenshots/documents-light.png b/docs/sprint-12/screenshots/documents-light.png new file mode 100644 index 0000000..f33ed88 Binary files /dev/null and b/docs/sprint-12/screenshots/documents-light.png differ diff --git a/docs/sprint-12/screenshots/documents-upload-dialog.png b/docs/sprint-12/screenshots/documents-upload-dialog.png new file mode 100644 index 0000000..d53bd85 Binary files /dev/null and b/docs/sprint-12/screenshots/documents-upload-dialog.png differ