import { defineConfig } from '@playwright/test'; // Browsers run on the shared remote Playwright server (Docker, 192.168.1.4:3000); // the app under test is always the prod build behind Traefik (docker compose). // NOTE: never point this at a local `next dev` — Turbopack's HMR WS fails for // non-loopback clients and the page renders blank; a second instance also splits state. const remoteRunner = process.env.E2E_REMOTE === '1'; if (!process.env.PW_TEST_CONNECT_WS_ENDPOINT) { process.env.PW_TEST_CONNECT_WS_ENDPOINT = 'ws://192.168.1.4:3000/'; } export default defineConfig({ testDir: './e2e', // Serial execution: e2e/state.spec.ts restarts the compose container mid-run, // which would break any map test running concurrently in another worker. workers: 1, timeout: 30_000, retries: 1, use: { baseURL: process.env.E2E_BASE_URL ?? 'https://flight.dev.kkhost.pl', trace: 'on-first-retry', }, webServer: remoteRunner ? undefined : { command: 'docker compose up -d --build', url: 'https://flight.dev.kkhost.pl/api/airports', reuseExistingServer: true, timeout: 300_000, }, });