Files
Spoolman/tests_frontend/playwright.config.ts
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

37 lines
1.2 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
/**
* Playwright configuration for Spoolman's frontend integration tests.
*
* The tests run against a fully deployed Spoolman instance (see
* docker-compose.yml), reached over the published host port. The base URL is
* configurable so the same tests can point at any running instance.
*/
const baseURL = process.env.SPOOLMAN_BASE_URL ?? "http://localhost:8000";
export default defineConfig({
testDir: "./tests",
// Fail the build on CI if a test.only was left in the source.
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
// The tests share one Spoolman instance, so keep them serial to avoid
// cross-test interference in the shared database.
workers: 1,
reporter: process.env.CI ? [["list"], ["html", { open: "never" }]] : [["list"]],
use: {
baseURL,
// Pin the browser locale so date/number formatting is deterministic. The
// app's language is additionally forced to English in tests/fixtures.ts.
locale: "en-US",
trace: "on-first-retry",
screenshot: "only-on-failure",
video: "on-first-retry",
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
});