Files
galaxy-game/ui/frontend/playwright.config.ts
T
Ilia Denisov 7ff81de2b6
Tests · UI / test (pull_request) Failing after 26s
Tests · UI / test (push) Successful in 2m21s
ui/frontend: cap Playwright at 4 workers, retry 4 times
Under host-mode runner the default 6 workers + 1 retry consistently
land on ~7 flakies and an occasional hard fail per ui-test run
(ui-test #59 most recently). Workers share CPU and the host Docker
daemon with gitea, the long-lived dev stack, and the user's host
Caddy; the extra wall time from contention pushes individual
expectations past their timeouts.

Lower the worker cap to 4 to keep parallelism but give each worker
real CPU headroom, and raise retries to 4 so the rare slow page is
absorbed without surfacing as failure.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-15 08:39:22 +02:00

49 lines
1.8 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
import { FIXTURE_PUBLIC_KEY_RAW_BASE64 } from "./tests/e2e/fixtures/gateway-key";
export default defineConfig({
testDir: "tests/e2e",
fullyParallel: true,
forbidOnly: !!process.env.CI,
// host-mode CI runner shares CPU/IO with the long-lived dev stack,
// gitea, and the user's host Caddy. The default 6 workers + 1
// retry produced ~7 flakies + 1 hard fail per ui-test run; cap at
// 4 workers (still parallel) and allow 4 retries to ride out
// transient timing hiccups without inflating wall time.
workers: 4,
retries: process.env.CI ? 4 : 0,
reporter: [["list"], ["html", { open: "never" }]],
use: {
baseURL: "http://localhost:5173",
trace: "retain-on-failure",
screenshot: "only-on-failure",
},
projects: [
{ name: "chromium-desktop", use: { ...devices["Desktop Chrome"] } },
{ name: "webkit-desktop", use: { ...devices["Desktop Safari"] } },
// devices["iPhone 13"] picks WebKit by default; the project name
// here claims a Chromium engine on a mobile viewport, so the
// browser is explicitly overridden. WebKit on a desktop viewport
// is already covered by webkit-desktop.
{
name: "chromium-mobile-iphone-13",
use: { ...devices["iPhone 13"], browserName: "chromium" },
},
{ name: "chromium-mobile-pixel-5", use: { ...devices["Pixel 5"] } },
],
webServer: {
command: "pnpm run dev",
url: "http://localhost:5173",
reuseExistingServer: !process.env.CI,
timeout: 120_000,
env: {
// The Phase 7 Playwright spec mocks the gateway and signs
// every response with the deterministic fixture key in
// `tests/e2e/fixtures/gateway-key.ts`. The dev server picks
// up the matching public key here so the in-page
// `GalaxyClient` accepts the forged signatures.
VITE_GATEWAY_RESPONSE_PUBLIC_KEY: FIXTURE_PUBLIC_KEY_RAW_BASE64,
},
},
});