version: "3.8" # Docker Compose for E2E Browser Testing # This provides a repeatable environment for running Playwright tests # with full browser automation against the real frontend and backend. # # Usage: # docker-compose -f docker-compose.e2e.yml up --build --abort-on-container-exit # # For headed mode (requires X11): # HEADED=true docker-compose -f docker-compose.e2e.yml up --build services: # Backend API server backend: build: context: ../backend dockerfile: Dockerfile environment: # Use an absolute sqlite path so Prisma CLI + the running app always point # at the same DB file (avoids schema being applied to a different relative path). - DATABASE_URL=file:/app/prisma/e2e-test.db - PORT=8000 - NODE_ENV=test - RESET_DB_ON_START=true # Include both with and without :80 because browsers omit default ports in Origin. - FRONTEND_URL=http://frontend,http://frontend:80,http://localhost:5173 ports: - "8000:8000" healthcheck: # Use IPv4 loopback explicitly to avoid IPv6 localhost resolution issues. test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:8000/health"] interval: 5s timeout: 5s retries: 10 start_period: 30s networks: - e2e-network # Frontend web server frontend: build: # Use the repo root as build context because `frontend/Dockerfile` expects # `frontend/...` paths (same as production `docker-compose.yml`). context: .. dockerfile: frontend/Dockerfile ports: - "5173:80" depends_on: backend: condition: service_healthy healthcheck: # Use IPv4 loopback explicitly to avoid IPv6 localhost resolution issues. test: ["CMD", "wget", "-q", "--spider", "http://127.0.0.1:80"] interval: 5s timeout: 5s retries: 10 start_period: 10s networks: - e2e-network # Playwright test runner playwright: build: context: . dockerfile: Dockerfile.playwright depends_on: frontend: condition: service_healthy backend: condition: service_healthy environment: - BASE_URL=http://frontend:80 - API_URL=http://frontend:80/api - NO_SERVER=true - CI=true volumes: - ./test-results:/app/test-results - ./playwright-report:/app/playwright-report networks: - e2e-network networks: e2e-network: driver: bridge