import path from "node:path"; import { defineConfig, devices } from "@playwright/test"; // End-to-end tests against a REAL API (tests/e2e/server.py: fresh embedded Postgres, demo pack, // scripted LLM) and a production build of the web app pointed at it. const API_PORT = Number(process.env.E2E_API_PORT ?? 8765); const WEB_PORT = Number(process.env.E2E_WEB_PORT ?? 3100); const API = `http://127.0.0.1:${API_PORT}`; const WEB = `http://127.0.0.1:${WEB_PORT}`; const PYTHON = process.env.WP_PYTHON ?? path.resolve( __dirname, process.platform === "win32" ? "../.venv/Scripts/python.exe" : "../.venv/bin/python", ); const SERVER = path.resolve(__dirname, "../tests/e2e/server.py"); export default defineConfig({ testDir: "./e2e", timeout: 60_000, expect: { timeout: 15_000 }, fullyParallel: false, workers: 1, retries: process.env.CI ? 1 : 0, reporter: process.env.CI ? [["list"], ["html", { open: "never" }]] : "list", use: { baseURL: WEB, trace: "retain-on-failure", ...devices["Desktop Chrome"], }, projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }], webServer: [ { command: `"${PYTHON}" "${SERVER}" --port ${API_PORT} --web-origin ${WEB}`, url: `${API}/healthz`, timeout: 180_000, reuseExistingServer: false, stdout: "pipe", }, { command: `npm run build && npx next start -p ${WEB_PORT} -H 127.0.0.1`, url: `${WEB}/login`, timeout: 400_000, reuseExistingServer: false, env: { NEXT_PUBLIC_API_URL: API, WP_API_URL: API, NEXT_TELEMETRY_DISABLED: "1" }, }, ], metadata: { api: API }, });