161 lines
4.9 KiB
YAML
Executable file
161 lines
4.9 KiB
YAML
Executable file
# =============================================================================
|
|
# E2E Integration Testing
|
|
# =============================================================================
|
|
#
|
|
# Full stack E2E testing with real database.
|
|
#
|
|
# Usage:
|
|
# docker compose -f docker-compose.e2e.yml up --build --abort-on-container-exit
|
|
# docker compose -f docker-compose.e2e.yml down -v
|
|
#
|
|
# Note: NPM_REGISTRY environment variable should be set (defaults to http://npm.black.lan/)
|
|
#
|
|
# =============================================================================
|
|
|
|
services:
|
|
# ===========================================================================
|
|
# DATABASE: PostgreSQL with seed data
|
|
# ===========================================================================
|
|
postgres:
|
|
image: postgres:16-alpine
|
|
environment:
|
|
POSTGRES_USER: e2e_user
|
|
POSTGRES_PASSWORD: e2e_password
|
|
POSTGRES_DB: conversation_assistant_e2e
|
|
volumes:
|
|
- ./e2e/seed.sql:/docker-entrypoint-initdb.d/01-seed.sql:ro
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U e2e_user -d conversation_assistant_e2e"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
networks:
|
|
- e2e-network
|
|
|
|
# ===========================================================================
|
|
# BACKEND: NestJS API Server
|
|
# ===========================================================================
|
|
api:
|
|
image: conversation-assistant-api:e2e
|
|
build:
|
|
context: .
|
|
dockerfile: e2e/Dockerfile.api
|
|
args:
|
|
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.black.lan/}
|
|
extra_hosts:
|
|
- "npm.black.lan:10.0.0.11"
|
|
- "forge.black.lan:10.0.0.11"
|
|
extra_hosts:
|
|
- "npm.black.lan:10.0.0.11"
|
|
- "forge.black.lan:10.0.0.11"
|
|
environment:
|
|
NODE_ENV: test
|
|
DATABASE_HOST: postgres
|
|
DATABASE_PORT: 5432
|
|
DATABASE_USER: e2e_user
|
|
DATABASE_PASSWORD: e2e_password
|
|
DATABASE_NAME: conversation_assistant_e2e
|
|
DATABASE_SYNCHRONIZE: "true"
|
|
JWT_SECRET: e2e-test-jwt-secret
|
|
PORT: 3000
|
|
CORS_ORIGIN: http://frontend-dev:5173
|
|
expose:
|
|
- "3000"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:3000/api/health"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 15
|
|
networks:
|
|
- e2e-network
|
|
|
|
# ===========================================================================
|
|
# FRONTEND-DEV: React Vite Dev Server
|
|
# ===========================================================================
|
|
frontend-dev:
|
|
image: conversation-assistant-frontend-dev:e2e
|
|
build:
|
|
context: .
|
|
dockerfile: e2e/Dockerfile.frontend
|
|
args:
|
|
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.black.lan/}
|
|
extra_hosts:
|
|
- "npm.black.lan:10.0.0.11"
|
|
- "forge.black.lan:10.0.0.11"
|
|
extra_hosts:
|
|
- "npm.black.lan:10.0.0.11"
|
|
- "forge.black.lan:10.0.0.11"
|
|
environment:
|
|
NODE_ENV: test
|
|
VITE_API_URL: http://api:3000
|
|
expose:
|
|
- "5173"
|
|
depends_on:
|
|
api:
|
|
condition: service_healthy
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:5173"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 15
|
|
networks:
|
|
- e2e-network
|
|
|
|
# ===========================================================================
|
|
# FRONTEND-MACOS-CLIENT: Simple static webapp for macOS menu bar app
|
|
# ===========================================================================
|
|
frontend-macos-client:
|
|
image: nginx:alpine
|
|
volumes:
|
|
- ./frontend-macos-client:/usr/share/nginx/html:ro
|
|
expose:
|
|
- "80"
|
|
healthcheck:
|
|
test: ["CMD", "wget", "-q", "--spider", "http://localhost:80"]
|
|
interval: 5s
|
|
timeout: 3s
|
|
retries: 10
|
|
networks:
|
|
- e2e-network
|
|
|
|
# ===========================================================================
|
|
# E2E TESTS: Playwright
|
|
# ===========================================================================
|
|
e2e-tests:
|
|
image: conversation-assistant-e2e-tests:e2e
|
|
build:
|
|
context: .
|
|
dockerfile: e2e/Dockerfile.e2e
|
|
args:
|
|
NPM_REGISTRY: ${NPM_REGISTRY:-http://npm.black.lan/}
|
|
extra_hosts:
|
|
- "npm.black.lan:10.0.0.11"
|
|
- "forge.black.lan:10.0.0.11"
|
|
extra_hosts:
|
|
- "npm.black.lan:10.0.0.11"
|
|
- "forge.black.lan:10.0.0.11"
|
|
environment:
|
|
CI: "true"
|
|
NODE_ENV: test
|
|
BASE_URL: http://frontend-dev:5173
|
|
MACOS_CLIENT_URL: http://frontend-macos-client:80
|
|
API_URL: http://api:3000
|
|
depends_on:
|
|
frontend-dev:
|
|
condition: service_healthy
|
|
frontend-macos-client:
|
|
condition: service_healthy
|
|
api:
|
|
condition: service_healthy
|
|
volumes:
|
|
- ./test-results:/app/test-results
|
|
networks:
|
|
- e2e-network
|
|
command: ["pnpm", "exec", "playwright", "test", "--config=playwright.docker.config.ts"]
|
|
|
|
networks:
|
|
e2e-network:
|
|
driver: bridge
|