Files
Spoolman/tests_frontend/docker-compose.yml
T
Donkie d9fd44eab9 Add Playwright frontend integration tests; fix broken SPA static serving
Add a browser-driven integration suite (tests_frontend/) that runs against
the real production image + PostgreSQL and drives the UI with Playwright:
a smoke test that navigates every page via the sidebar with no console
errors, and a CRUD test that creates a vendor -> filament -> spool entirely
through the UI. Wired up as `poe itest-frontend` and a new `test-frontend`
CI job (reusing the image built for the backend tests, gating releases).

Navigation goes through real UI buttons (language-independent link targets)
and the app language is forced to English so label matchers are stable
regardless of the runner's browser locale.

This immediately caught a real regression: Starlette 1.3.1 (pulled by a
recent dep bump) removed the `method` kwarg from FileResponse, so
SinglePageApplication 500'd on every static asset and the whole UI was dead.
Drop the removed kwarg — Starlette now derives HEAD handling from the scope.

Claude-Session: https://claude.ai/code/session_01BQjJiwEbu6bHbeDjPPDm3V
2026-07-07 09:12:42 +02:00

46 lines
1.4 KiB
YAML

# Spins up Spoolman exactly as it is deployed for real: the production image
# (client baked in, served on the same origin as the API) backed by a real
# PostgreSQL database. The frontend integration tests (Playwright) drive this
# through a browser on the host via the published port.
services:
db:
image: postgres:16-alpine
environment:
- POSTGRES_PASSWORD=spoolman
- POSTGRES_USER=spoolman
- POSTGRES_DB=spoolman
healthcheck:
test: ["CMD-SHELL", "pg_isready -U spoolman"]
interval: 1s
timeout: 5s
retries: 30
spoolman:
image: donkie/spoolman:test
environment:
- SPOOLMAN_DB_TYPE=postgres
- SPOOLMAN_DB_HOST=db
- SPOOLMAN_DB_PORT=5432
- SPOOLMAN_DB_NAME=spoolman
- SPOOLMAN_DB_USERNAME=spoolman
- SPOOLMAN_DB_PASSWORD=spoolman
- SPOOLMAN_LOGGING_LEVEL=INFO
- TZ=Europe/Stockholm
ports:
# Host port is configurable so the suite can avoid clashing with a
# locally running Spoolman. Container always listens on 8000.
- "${SPOOLMAN_HOST_PORT:-8000}:8000"
healthcheck:
test:
- "CMD"
- "python"
- "-c"
- "import urllib.request,sys; sys.exit(0 if urllib.request.urlopen('http://localhost:8000/api/v1/health').status==200 else 1)"
interval: 2s
timeout: 5s
retries: 45
start_period: 5s
depends_on:
db:
condition: service_healthy