import { defineConfig, devices } from "@playwright/test"; import { join } from "node:path"; import { tmpdir } from "node:os"; // Override when another dev server already holds the default port. const port = Number(process.env.E2E_PORT ?? 4173); export default defineConfig({ testDir: "./e2e", timeout: 30_000, fullyParallel: false, // All specs share one server database; run them one at a time. workers: 1, reporter: "list", use: { baseURL: `http://127.0.0.1:${port}`, trace: "retain-on-failure", }, projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }], webServer: { command: `python -m uvicorn app.main:app --app-dir ../backend --host 127.0.0.1 --port ${port}`, url: `http://127.0.0.1:${port}/health`, reuseExistingServer: !process.env.CI, env: { ...process.env, SERVICEMAP_DB: join(tmpdir(), "servicemap-playwright-v160.db"), SERVICEMAP_STATIC_DIR: "dist", SERVICEMAP_AUTH_MODE: "disabled", SERVICEMAP_PROBE_INTERVAL: "0", SERVICEMAP_DEMO_ENABLED: "1", }, }, });