Phase 5 — Integration: - PaymentReminderScheduler: monthly cron at 9am, sends PAYMENT_REMINDER and PAYMENT_OVERDUE (30+ days) notifications, audit logged - BoardTermScheduler: daily cron at 8am, sends BOARD_TERM_EXPIRING notification 30 days before term end (1-day window for single delivery) - Assembly protocol auto-archive: completeAssembly() generates PDF via AssemblyProtocolService and stores it in DocumentService.archiveProtocol() - PlanTierService: Sprint 8 limits added (Kassenbuch 3mo starter, 1 MV/year starter, 100MB/1GB/unlimited document storage) - Notification wiring: PAYMENT_RECEIVED sent to member on recordPayment(), sendToAllMembers() added to NotificationService for assembly invitations - Seed data: 2 fee schedules (Regular €30, Reduced €15), 4 fee assignments, 3 sample payments, 2 board positions, 2 board members Phase 6 — Testing infrastructure: - V22 migration: protocol_document_id on assemblies table - Schedulers disabled in test profile (cannamanage.schedulers.enabled=false) - Scheduler property configurable via SCHEDULERS_ENABLED env var Additional fixes (pre-existing Phase 4 issues): - AssemblyProtocolService: fixed Document import ambiguity (OpenPDF vs entity) - AuditService: added convenience overloads for UUID actorId/clubId - ReceiptPdfService: fixed getReceiptNumber/getMemberNumber/getPaymentDate - StaffPermissionChecker: added getUserId/getClubId/getTenantId helpers - FinanceService: added getPaymentById, exportLedgerCsv methods
System Test Harness
End-to-end system tests for CannaManage — runs against the full Docker stack or the local mock backend.
Architecture
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ PostgreSQL │────▶│ Backend │────▶│ Frontend │
│ + seed data │ │ (Spring Boot)│ │ (Next.js) │
└──────────────┘ └──────────────┘ └──────────────┘
│
┌───────▼───────┐
│ Playwright │
│ system tests │
└───────────────┘
Running System Tests
Option 1: Full Docker Stack (recommended for CI)
Runs PostgreSQL, backend, frontend, seeds test data, then executes Playwright:
docker compose -f docker-compose.test.yml up --abort-on-container-exit
The test exits with code 0 on success, non-zero on failure.
Option 2: Local with Mock Backend (fast, no Docker required)
Uses the smart mock backend that serves auth endpoints + catch-all responses. The frontend uses local mock data for all pages.
cd cannamanage-frontend
# Start mock backend (port 8080)
node e2e/mock-backend.mjs &
MOCK_PID=$!
# Start frontend dev server (port 3000)
pnpm dev &
DEV_PID=$!
# Wait for servers to be ready
sleep 8
# Run system tests
pnpm exec playwright test e2e/system-test.spec.ts
# Cleanup
kill $MOCK_PID $DEV_PID
Option 3: npm scripts (from cannamanage-frontend/)
cd cannamanage-frontend
# E2E tests (UI smoke tests with mock backend — fast)
pnpm test:e2e
# System tests (full user journey — requires running stack)
pnpm test:system
# All Playwright tests
pnpm test:all
Test Data
The seed data (scripts/seed/init.sql) creates:
| Entity | Count | Details |
|---|---|---|
| Club | 1 | "Grüner Daumen e.V." (Berlin) |
| Admin User | 1 | admin@test.de / test123 |
| Members | 5 | Mix of ages (1 under-21) |
| Strains | 3 | Northern Lights, Amnesia Haze, CBD Critical Mass |
| Batches | 3 | 500g, 300g, 200g |
| Distributions | 3 | Sample handouts |
| Monthly Quotas | 3 | December 2024 |
| Stock Movements | 4 | Harvest + distribution audit trail |
Troubleshooting
Backend Docker build fails
The Maven build may fail due to missing dependencies in the Docker image. The test harness (scripts, config, test files) is designed to be ready for when the backend compiles correctly. In the meantime, use Option 2 (mock backend).
Frontend not ready in time
The Playwright container waits up to 60 seconds for the frontend. If builds are slow, increase the timeout in docker-compose.test.yml.
Seed data not loaded
The SQL seed runs as a PostgreSQL init script. If the DB volume already exists with data, remove it:
docker compose -f docker-compose.test.yml down -v
docker compose -f docker-compose.test.yml up --abort-on-container-exit
Port conflicts
Default ports: PostgreSQL (5432), Backend (8080), Frontend (3000). If these are in use, stop conflicting services or modify docker-compose.yml.