Files
cannamanage/docker-compose.test.yml
T
Patrick Plate 776149e7d3 test: add full-stack Playwright integration test infrastructure
Sprint 12 Phase 2: Real integration tests with seed DB
- R__seed_test_data.sql (Flyway repeatable, 7 members, strains, batches, docs, board, events)
- TestResetController (profile-gated per-test DB reset)
- docker-compose.test.yml (self-contained, tmpfs Postgres)
- Dockerfile.playwright (v1.60.0, pre-installed deps)
- 13 integration spec files, 70+ test cases (@smoke + @full)
- seed-constants.ts, selectors.ts, api-client.ts test helpers
2026-06-18 14:43:16 +02:00

80 lines
2.5 KiB
YAML

# Integration test profile — full stack with Flyway seed + Playwright
# Usage: docker compose -f docker-compose.test.yml up --build --abort-on-container-exit
services:
db:
image: postgres:16-alpine
container_name: cannamanage-test-db
tmpfs:
- /var/lib/postgresql/data
environment:
POSTGRES_DB: cannamanage_test
POSTGRES_USER: cannamanage
POSTGRES_PASSWORD: cannamanage_test
healthcheck:
test: ["CMD-SHELL", "pg_isready -U cannamanage -d cannamanage_test"]
interval: 3s
timeout: 2s
retries: 10
backend:
build:
context: .
dockerfile: Dockerfile.backend
container_name: cannamanage-test-backend
environment:
SPRING_PROFILES_ACTIVE: test
SPRING_DATASOURCE_URL: jdbc:postgresql://db:5432/cannamanage_test
SPRING_DATASOURCE_USERNAME: cannamanage
SPRING_DATASOURCE_PASSWORD: cannamanage_test
CANNAMANAGE_SECURITY_JWT_SECRET: dGVzdC1zZWNyZXQtZm9yLWludGVncmF0aW9uLXRlc3RzLW9ubHktMzJjaGFycw==
depends_on:
db:
condition: service_healthy
healthcheck:
test: ["CMD", "wget", "--spider", "-q", "http://localhost:8080/actuator/health"]
interval: 5s
timeout: 3s
retries: 15
start_period: 30s
frontend:
build:
context: ./cannamanage-frontend
dockerfile: Dockerfile
container_name: cannamanage-test-frontend
environment:
NEXTAUTH_URL: http://localhost:3000
NEXTAUTH_SECRET: test-nextauth-secret-minimum-32-characters
BACKEND_URL: http://backend:8080
AUTH_URL: http://localhost:3000
depends_on:
backend:
condition: service_healthy
playwright:
build:
context: ./cannamanage-frontend
dockerfile: Dockerfile.playwright
container_name: cannamanage-test-playwright
working_dir: /app
depends_on:
frontend:
condition: service_started
backend:
condition: service_healthy
environment:
BASE_URL: http://frontend:3000
API_URL: http://backend:8080
CI: "true"
# Volume mount allows test iteration without rebuild
# (Dockerfile pre-installs deps; mount overrides test files only)
volumes:
- ./cannamanage-frontend/e2e:/app/e2e:ro
command: >
sh -c "
echo 'Waiting for frontend...' &&
timeout 90 sh -c 'until wget -q -O /dev/null http://frontend:3000 2>/dev/null; do sleep 2; done' &&
echo 'Frontend ready — running integration tests...' &&
npx playwright test e2e/integration/ --reporter=html --grep @smoke
"