import path from "node:path"; import { defineConfig } from "@playwright/test"; const WEB_DIR = process.cwd(); const REPO_ROOT = path.resolve(WEB_DIR, "..", ".."); const PYTHON = process.env.WP230E2E_PYTHON ?? path.join(REPO_ROOT, ".venv", "Scripts", "python.exe"); const DIST = path.join(WEB_DIR, "dist"); const WEB_PORT = 8780; const CONTROL_PORT = 8781; const OIDC_PORT = 8782; const WORKER_PORT = 8783; export default defineConfig({ testDir: "./tests/e2e", testMatch: /.*\.spec\.ts/, fullyParallel: false, workers: 1, retries: 0, reporter: [["list"], ["html", { open: "never", outputFolder: "playwright-report" }]], use: { baseURL: `https://127.0.0.1:${WEB_PORT}`, ignoreHTTPSErrors: true, trace: "retain-on-failure", screenshot: "only-on-failure", }, // Playwright starts array entries in order and waits for each `url` to // answer before starting the next -- required here because control-api // reads the CA file the oidc process writes at its own startup. webServer: [ { command: `"${PYTHON}" -m tests.e2e.harness oidc --port ${OIDC_PORT}`, url: `https://127.0.0.1:${OIDC_PORT}/.well-known/openid-configuration`, ignoreHTTPSErrors: true, reuseExistingServer: false, timeout: 90_000, cwd: REPO_ROOT, }, { command: `"${PYTHON}" -m tests.e2e.harness control-api --port ${CONTROL_PORT} --oidc-port ${OIDC_PORT} --web-port ${WEB_PORT}`, url: `http://127.0.0.1:${CONTROL_PORT}/ready`, reuseExistingServer: false, timeout: 90_000, cwd: REPO_ROOT, }, { command: `"${PYTHON}" -m tests.e2e.harness worker --port ${WORKER_PORT}`, url: `http://127.0.0.1:${WORKER_PORT}/health/ready`, reuseExistingServer: false, timeout: 90_000, cwd: REPO_ROOT, }, { command: `"${PYTHON}" -m tests.e2e.harness web --port ${WEB_PORT} --control-port ${CONTROL_PORT} --worker-port ${WORKER_PORT} --dist "${DIST}"`, url: `https://127.0.0.1:${WEB_PORT}/ready`, ignoreHTTPSErrors: true, reuseExistingServer: false, timeout: 90_000, cwd: REPO_ROOT, }, ], });