Files
galaxy-game/ui/frontend/playwright.config.ts
T
Ilia Denisov 2294d8b3d9
Tests · UI / test (push) Has been cancelled
Tests · UI / test (pull_request) Successful in 2m47s
fix(ui): tighter order card — calculator-scale font, corner-flush ✕;
stabilise report-sections e2e

Owner review on PR #58:

- shrink the order-card body to 0.8rem (matching the calculator's body
  text scale) so the order list reads as part of the sidebar's
  density, not its own larger surface;
- shrink the delete ✕ to 0.95rem and glue it flush to the card's
  top-right corner (no offset, sized to fit the corner padding-space);
- tighten the card padding to match the smaller text.

Independently — the same review asked to fix `report-sections › every
TOC anchor lands its section in view`, which had been a long-standing
e2e flake (run #366 on `development` already failed it twice before
passing on retry; my PR's run #367 simply exhausted all five retries).
The root cause is the smooth `scrollIntoView` settling slower than
Playwright's 5 s viewport wait under heavy CI load. The production
TOC already honours `prefers-reduced-motion: reduce` and swaps to an
instant scroll there; switching the Playwright config to that media
mode makes every spec deterministic without touching production code.
2026-05-26 08:28:58 +02:00

59 lines
2.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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",
// Force `prefers-reduced-motion: reduce` for every spec. The
// production UI honours the preference (e.g. report-toc swaps
// `scrollIntoView({behavior: "smooth"})` for `"auto"`), so
// running the e2e suite in this mode keeps anchor scrolls and
// other animations synchronous — which avoids the long-standing
// `report-sections every TOC anchor lands its section in view`
// flake where the smooth-scroll for sections near the bottom of
// the page failed to settle within Playwright's 5 s viewport
// wait under CI load.
contextOptions: { reducedMotion: "reduce" },
},
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,
},
},
});