2026-03-23 11:46:45 +08:00
|
|
|
###############################################################################
|
|
|
|
|
# Test infrastructure - run with:
|
|
|
|
|
# docker compose -f docker/docker-compose.test.yml up --build --abort-on-container-exit
|
|
|
|
|
###############################################################################
|
|
|
|
|
services:
|
|
|
|
|
# ── Unit + Integration tests ─────────────────────────────────────────────
|
|
|
|
|
test-unit:
|
|
|
|
|
build:
|
|
|
|
|
context: ..
|
|
|
|
|
dockerfile: docker/Dockerfile.test
|
2026-04-24 18:02:21 +08:00
|
|
|
container_name: SnapOtter-test-unit
|
2026-03-23 11:46:45 +08:00
|
|
|
command: ["pnpm", "test:ci"]
|
|
|
|
|
environment:
|
|
|
|
|
- NODE_ENV=test
|
|
|
|
|
- AUTH_ENABLED=true
|
|
|
|
|
- DEFAULT_USERNAME=admin
|
|
|
|
|
- DEFAULT_PASSWORD=admin
|
2026-04-24 18:02:21 +08:00
|
|
|
- DB_PATH=/tmp/test-snapotter.db
|
2026-03-23 11:46:45 +08:00
|
|
|
- WORKSPACE_PATH=/tmp/test-workspace
|
|
|
|
|
- MAX_MEGAPIXELS=100
|
|
|
|
|
- RATE_LIMIT_PER_MIN=1000
|
|
|
|
|
tmpfs:
|
|
|
|
|
- /tmp/test-workspace
|
|
|
|
|
- /tmp
|
|
|
|
|
|
|
|
|
|
# ── E2E tests (Playwright against full app) ─────────────────────────────
|
|
|
|
|
test-e2e:
|
|
|
|
|
build:
|
|
|
|
|
context: ..
|
|
|
|
|
dockerfile: docker/Dockerfile.test
|
2026-04-24 18:02:21 +08:00
|
|
|
container_name: SnapOtter-test-e2e
|
2026-06-10 22:01:13 +08:00
|
|
|
# Visual project is excluded: linux baselines are managed by the
|
|
|
|
|
# update-visual-baselines workflow, not generated inside the container.
|
|
|
|
|
command:
|
|
|
|
|
[
|
|
|
|
|
"sh",
|
|
|
|
|
"-c",
|
|
|
|
|
"npx playwright install --with-deps chromium && pnpm playwright test --project=chromium && pnpm playwright test --project=chromium-serial --workers=1",
|
|
|
|
|
]
|
2026-03-23 11:46:45 +08:00
|
|
|
environment:
|
|
|
|
|
- NODE_ENV=test
|
|
|
|
|
- AUTH_ENABLED=true
|
|
|
|
|
- DEFAULT_USERNAME=admin
|
|
|
|
|
- DEFAULT_PASSWORD=admin
|
2026-04-24 18:02:21 +08:00
|
|
|
- DB_PATH=/tmp/test-snapotter.db
|
2026-03-23 11:46:45 +08:00
|
|
|
- WORKSPACE_PATH=/tmp/test-workspace
|
|
|
|
|
- MAX_MEGAPIXELS=100
|
|
|
|
|
- RATE_LIMIT_PER_MIN=1000
|
|
|
|
|
- CI=true
|
|
|
|
|
tmpfs:
|
|
|
|
|
- /tmp/test-workspace
|
|
|
|
|
- /tmp
|
|
|
|
|
depends_on:
|
|
|
|
|
test-unit:
|
|
|
|
|
condition: service_completed_successfully
|