import { defineConfig } from '@playwright/test'; // Prefer the same offline-friendly Chromium resolution as Karma/unit tests. // Falls back to Playwright-managed installs when not available. // eslint-disable-next-line @typescript-eslint/no-var-requires const { resolveChromeBinary } = require('./scripts/chrome-path'); const port = process.env.PLAYWRIGHT_PORT ? Number.parseInt(process.env.PLAYWRIGHT_PORT, 10) : 4400; const chromiumExecutable = resolveChromeBinary(__dirname) as string | null; export default defineConfig({ testDir: 'tests/e2e', timeout: 30_000, retries: process.env.CI ? 1 : 0, use: { baseURL: process.env.PLAYWRIGHT_BASE_URL ?? `http://127.0.0.1:${port}`, trace: 'retain-on-failure', ...(chromiumExecutable ? { launchOptions: { executablePath: chromiumExecutable } } : {}), }, webServer: { command: 'npm run serve:test', reuseExistingServer: !process.env.CI, url: `http://127.0.0.1:${port}`, stdout: 'ignore', stderr: 'ignore', timeout: 120_000, }, });