mirror of
https://github.com/Donkie/Spoolman.git
synced 2026-10-19 00:29:46 -05:00
Mirrors tests_frontend, but drives the Svelte client instead of the legacy React one: same production image, same PostgreSQL-backed compose stack, same "only the first navigation uses a URL" discipline. - smoke.spec.ts clicks through every top-bar tab, asserting each route's title and the app shell, with no browser console errors; a second test proves the library reached the API rather than falling into its offline state. - crud.spec.ts walks the first-use happy path. client_v2 folds the legacy client's three create forms into one "Add spools" modal, so a manufacturer, a filament and a spool are created by a single submit, then verified back in the library list and on the locations page. Two client_v2-specific helpers earn their keep: the top bar renders its nav twice (desktop + mobile, one hidden by CSS) so nav locators need narrowing to the visible one, and NumberInput's accessible name picks up its stepper and help buttons, so numeric fields are found via their form item instead of getByLabel. The suite publishes on host port 8001 so it can run alongside the legacy one. CI gains a test-frontend-v2 job cloned from test-frontend, gating publish-images alongside it. Also fixes tests_frontend/run.py: it only built client/dist, but the Dockerfile copies client_v2/build unconditionally, so the image could not be built from a clean checkout.
50 lines
1.7 KiB
YAML
50 lines
1.7 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
|
|
# These Playwright tests target the legacy (React) client's DOM. The new
|
|
# Svelte client is now the default, so pin this suite to the legacy client.
|
|
# The equivalent suite for the new client lives in ../tests_frontend_v2.
|
|
- SPOOLMAN_LEGACY_CLIENT=TRUE
|
|
- 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
|