feat(sprint-5): Phase 7 — System test harness
- docker-compose.test.yml: full stack test profile with seed + playwright - scripts/seed/init.sql: test data (admin, members, batches, distributions) - scripts/seed/seed.sh: backend readiness validation script - e2e/system-test.spec.ts: full user journey against real/mock stack - package.json: test:e2e, test:system, test:all scripts - scripts/README.md: system test documentation and usage instructions
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
# System test profile — runs full stack with seed data + Playwright
|
||||
# Usage: docker compose -f docker-compose.test.yml up --abort-on-container-exit
|
||||
include:
|
||||
- docker-compose.yml
|
||||
|
||||
services:
|
||||
# Override db to include seed data
|
||||
db:
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
- ./scripts/seed/init.sql:/docker-entrypoint-initdb.d/99-seed.sql:ro
|
||||
|
||||
# Seed container: waits for backend health, then validates readiness
|
||||
seed:
|
||||
image: curlimages/curl:latest
|
||||
container_name: cannamanage-seed
|
||||
depends_on:
|
||||
backend:
|
||||
condition: service_healthy
|
||||
entrypoint: /bin/sh
|
||||
command: ["-c", "/seed/seed.sh"]
|
||||
volumes:
|
||||
- ./scripts/seed:/seed:ro
|
||||
|
||||
# Playwright system tests
|
||||
playwright:
|
||||
image: mcr.microsoft.com/playwright:v1.52.0-noble
|
||||
container_name: cannamanage-playwright
|
||||
working_dir: /app
|
||||
depends_on:
|
||||
seed:
|
||||
condition: service_completed_successfully
|
||||
frontend:
|
||||
condition: service_started
|
||||
environment:
|
||||
BASE_URL: http://frontend:3000
|
||||
CI: "true"
|
||||
volumes:
|
||||
- ./cannamanage-frontend:/app
|
||||
command: >
|
||||
sh -c "
|
||||
echo 'Waiting for frontend to be ready...' &&
|
||||
timeout 60 sh -c 'until wget -q -O /dev/null http://frontend:3000 2>/dev/null; do sleep 2; done' &&
|
||||
echo 'Frontend ready — running system tests...' &&
|
||||
npx playwright test e2e/system-test.spec.ts --reporter=list
|
||||
"
|
||||
Reference in New Issue
Block a user