Files
Ferrous-Solitaire/solitaire_server/e2e/playwright.config.js
T
funman300 d45b7cb82b
Build and Deploy / build-and-push (push) Successful in 1m6s
Web E2E / web-e2e (push) Successful in 4m40s
feat(e2e): add Playwright browser test suite for web routes
solitaire_server/e2e/:
- smoke.spec.js: verifies /play-classic loads, exposes window.__FERROUS_DEBUG__
  bridge, keyboard parity (Space=draw, U=undo), debug failure report, and
  replay payload builder exports schema-v2 moves.
- gameplay_review.spec.js: HUD/controls render check, stock-click + undo
  player flow, draw-mode toggle, autonomous play invariant batch, and
  cycle-detection regression guard.
- cycle_metrics.js: headless cycle-rate analysis tool; run via
  `npm run review:cycles` with configurable policy, game count, and
  thresholds. Regression gate baked into package.json scripts.
- playwright.config.js: targets the local server at http://localhost:8080.
- package.json / package-lock.json: @playwright/test 1.60.0.

.gitea/workflows/web-e2e.yml:
- Runs on pushes to solitaire_server/, solitaire_wasm/, solitaire_core/,
  or Cargo changes. Starts the server binary, waits for /health, runs
  the full Playwright suite, uploads test-results/ on failure.

docs/testing-architecture.md: documents the three-tier test strategy
  (unit → Playwright smoke → cycle regression) and the __FERROUS_DEBUG__
  bridge contract.

scripts/update_quaternions_deps.sh: helper to bump the Quaternions
  registry deps (klondike, card_game) by version and run the full
  safety gate including deterministic replay checks.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-02 12:40:30 -07:00

42 lines
1.2 KiB
JavaScript

const path = require("path");
const { defineConfig, devices } = require("@playwright/test");
const serverPort = 4173;
const repoRoot = path.resolve(__dirname, "../..");
module.exports = defineConfig({
testDir: "./tests",
timeout: 30_000,
expect: {
timeout: 5_000,
},
fullyParallel: false,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: [["list"], ["html", { open: "never" }]],
use: {
baseURL: `http://127.0.0.1:${serverPort}`,
trace: "retain-on-failure",
screenshot: "only-on-failure",
video: "retain-on-failure",
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
webServer: {
command:
`SQLX_OFFLINE=true ` +
`DATABASE_URL=sqlite://ferrous-solitaire-e2e.db ` +
`JWT_SECRET=ferrous_solitaire_e2e_secret_32_chars_long ` +
`SERVER_PORT=${serverPort} ` +
`cargo run -p solitaire_server --quiet`,
cwd: repoRoot,
url: `http://127.0.0.1:${serverPort}/health`,
timeout: 120_000,
reuseExistingServer: !process.env.CI,
},
});