mirror of
https://github.com/azaion/ui.git
synced 2026-06-21 09:41:11 +00:00
[AZ-456] Test infrastructure: Vitest + MSW + Playwright + scripts
Scaffolds the Blackbox test project per AZ-456 / environment.md across
the three profiles:
- fast : Vitest 3.x + jsdom + MSW 2.x + RTL/jest-dom; tests/setup.ts
boots the MSW Node server with onUnhandledRequest:'error',
afterEach resets handlers, clears bearer + navigate-to-login
spy. Default handlers ship for every suite service plus OWM
and tile stand-ins. Fixtures mirror seed_* in test-data.md.
- e2e : Playwright ^1.49 with chromium + firefox projects against the
suite docker-compose stack; owm-stub + tile-stub Bun servers,
playwright-runner image, seeds.sql for the test-db.
- static: scripts/run-tests.sh extended — tsc --noEmit (test config),
vite build, ripgrep checks (with grep -r fallback), CSV
report at test-output/static-report.csv per AC-7 columns.
Smoke tests cover AC-3, AC-4 (fast, 5 tests, PASS) and AC-1, AC-2,
AC-5, AC-8 (e2e, gated by Risk 4 docker availability). Static profile
(13 checks) PASS — STC-SEC1 (no literal OWM key) lifted from
QUARANTINE per AZ-447 with a narrowed pattern.
Files:
+24 tests/**, +10 e2e/**, +vitest.config.ts, +tsconfig.test.json
~package.json (test scripts + devDeps for vitest, @testing-library/*,
msw, @playwright/test, jsdom, @types/node, @vitest/coverage-v8)
~scripts/run-tests.sh, scripts/run-performance-tests.sh — switched
RESULTS_DIR to test-output/, compose path to project-local
~.gitignore — added /test-output/
Verification:
bun run test:fast → 11 / 11 PASS
./scripts/run-tests.sh → static 13/13 + fast 11/11 PASS, exit 0
Tracker: AZ-456 → In Testing.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
# Suite-level e2e harness for Azaion UI (AZ-456 / _docs/02_document/tests/environment.md).
|
||||
#
|
||||
# The parent suite repo publishes the four required service images under the
|
||||
# `:test` tag (admin, flights, annotations, detect). The auxiliary services
|
||||
# (loader, resource, gps-denied-*, autopilot) are wired here as best-effort
|
||||
# soft dependencies — Playwright tests that exercise them will be skipped if
|
||||
# the registry hasn't published a `:test` tag yet (Risk 4 in AZ-456).
|
||||
#
|
||||
# Network: `azaion-test-net` is isolated; the only outbound endpoints are the
|
||||
# two stubs (`owm-stub`, `tile-stub`). External hosts are blocked at the
|
||||
# Playwright route layer (AC-08).
|
||||
|
||||
services:
|
||||
test-db:
|
||||
image: postgres:16-alpine
|
||||
environment:
|
||||
POSTGRES_USER: azaion
|
||||
POSTGRES_PASSWORD: azaion
|
||||
POSTGRES_DB: azaion
|
||||
volumes:
|
||||
- test-db-data:/var/lib/postgresql/data
|
||||
- ./fixtures/seeds.sql:/docker-entrypoint-initdb.d/seeds.sql:ro
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U azaion -d azaion"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
networks: [azaion-test-net]
|
||||
|
||||
admin:
|
||||
image: azaion/admin:test
|
||||
environment:
|
||||
DB_CONNECTION: "Host=test-db;Database=azaion;Username=azaion;Password=azaion"
|
||||
ENABLE_TEST_ONLY_ENDPOINTS: "true"
|
||||
depends_on:
|
||||
test-db:
|
||||
condition: service_healthy
|
||||
networks: [azaion-test-net]
|
||||
|
||||
flights:
|
||||
image: azaion/flights:test
|
||||
environment:
|
||||
DB_CONNECTION: "Host=test-db;Database=azaion;Username=azaion;Password=azaion"
|
||||
ENABLE_LIVE_GPS_SIMULATOR: "true"
|
||||
depends_on:
|
||||
test-db:
|
||||
condition: service_healthy
|
||||
networks: [azaion-test-net]
|
||||
|
||||
annotations:
|
||||
image: azaion/annotations:test
|
||||
environment:
|
||||
DB_CONNECTION: "Host=test-db;Database=azaion;Username=azaion;Password=azaion"
|
||||
ENABLE_STATUS_EVENT_GENERATOR: "true"
|
||||
depends_on:
|
||||
test-db:
|
||||
condition: service_healthy
|
||||
networks: [azaion-test-net]
|
||||
|
||||
detect:
|
||||
image: azaion/detect:test
|
||||
networks: [azaion-test-net]
|
||||
|
||||
loader:
|
||||
image: azaion/loader:test
|
||||
networks: [azaion-test-net]
|
||||
|
||||
resource:
|
||||
image: azaion/resource:test
|
||||
networks: [azaion-test-net]
|
||||
|
||||
owm-stub:
|
||||
build: ./stubs/owm
|
||||
ports:
|
||||
- "8081"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://localhost:8081/health"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
networks: [azaion-test-net]
|
||||
|
||||
tile-stub:
|
||||
build: ./stubs/tile
|
||||
ports:
|
||||
- "8082"
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://localhost:8082/health"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 5
|
||||
networks: [azaion-test-net]
|
||||
|
||||
azaion-ui:
|
||||
build:
|
||||
context: ..
|
||||
dockerfile: Dockerfile
|
||||
environment:
|
||||
VITE_API_BASE_URL: "/api"
|
||||
VITE_OWM_BASE_URL: "http://owm-stub:8081"
|
||||
VITE_TILE_BASE_URL: "http://tile-stub:8082"
|
||||
depends_on:
|
||||
admin: { condition: service_started }
|
||||
flights: { condition: service_started }
|
||||
annotations: { condition: service_started }
|
||||
detect: { condition: service_started }
|
||||
owm-stub: { condition: service_healthy }
|
||||
tile-stub: { condition: service_healthy }
|
||||
healthcheck:
|
||||
test: ["CMD", "wget", "-qO-", "http://localhost:80/"]
|
||||
interval: 5s
|
||||
timeout: 3s
|
||||
retries: 10
|
||||
networks: [azaion-test-net]
|
||||
|
||||
playwright-runner:
|
||||
build: ./runner
|
||||
depends_on:
|
||||
azaion-ui:
|
||||
condition: service_healthy
|
||||
owm-stub:
|
||||
condition: service_healthy
|
||||
tile-stub:
|
||||
condition: service_healthy
|
||||
environment:
|
||||
PLAYWRIGHT_BASE_URL: "http://azaion-ui:80"
|
||||
PLAYWRIGHT_OUTPUT_DIR: "/output/e2e"
|
||||
volumes:
|
||||
- ../test-output:/output
|
||||
- ..:/workspace:ro
|
||||
working_dir: /workspace
|
||||
networks: [azaion-test-net]
|
||||
|
||||
networks:
|
||||
azaion-test-net:
|
||||
driver: bridge
|
||||
|
||||
volumes:
|
||||
test-db-data: {}
|
||||
Reference in New Issue
Block a user