import { defineConfig, devices } from '@playwright/test'; // Allow pointing the suite at an already-running test server (e.g. one booted from a // specific worktree on a non-default port) via BASE_URL. When BASE_URL is set we skip // the auto-started webServer entirely, so parallel worktrees don't fight over :3333. const baseURL = process.env.BASE_URL ?? 'http://localhost:3333'; const useExternalServer = !!process.env.BASE_URL; export default defineConfig({ testDir: './e2e', fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, reporter: 'html', use: { baseURL, trace: 'on-first-retry', }, webServer: useExternalServer ? undefined : { command: 'lein run -m auto-ap.test-server', url: 'http://localhost:3333/test-info', reuseExistingServer: !process.env.CI, timeout: 120000, }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] }, }, ], });