import { defineConfig } from '@playwright/test'; // Playwright runs the SvelteKit dev server on a dedicated port so it // doesn't reuse whatever the dev workflow has on the vite default // (`5173`). `--strictPort` makes vite fail fast on collision instead of // silently bumping to a free port, which would leave Playwright pointed // at the wrong host. Set `E2E_BASE_URL` to skip the embedded server and // point at an already-running deployment. const E2E_PORT = 5174; export default defineConfig({ testDir: 'e2e', timeout: 30_000, // The specs are deterministic in isolation, but a full parallel run // has a cold-start window: Vite compiles each route on first request, // so the first tests across 8 workers contend on the dev server and // can trip the timeout. One retry re-runs those on the now-warm server. // (The `/api/v1` fallback in e2e/fixtures.ts removes the other flake // source — unmocked calls stalling against the dead dev proxy.) retries: 1, use: { baseURL: process.env.E2E_BASE_URL ?? `http://localhost:${E2E_PORT}`, trace: 'retain-on-failure' }, webServer: process.env.E2E_BASE_URL ? undefined : { command: `npm run dev -- --port ${E2E_PORT} --strictPort`, port: E2E_PORT, reuseExistingServer: !process.env.CI, timeout: 120_000 } });