import { defineConfig, devices } from "@playwright/test"; import { resolve } from "node:path"; const __dir = new URL(".", import.meta.url).pathname; const fakePi = resolve(__dir, "e2e/fixtures/fake-pi.mjs"); const fakeTht = resolve(__dir, "e2e/fixtures/fake-tht.mjs"); const harnessDir = resolve(__dir, "..", "harness"); export default defineConfig({ testDir: "./e2e", timeout: 60_000, retries: process.env.CI ? 2 : 0, use: { baseURL: "http://localhost:5199", }, projects: [ { name: "chromium", use: { ...devices["Desktop Chrome"] }, }, ], webServer: [ { // Backend — wired to both fakes; no VPN/Pi/Python required. command: "npm run dev", cwd: resolve(__dir, "..", "backend"), url: "http://localhost:8799/health", timeout: 30_000, reuseExistingServer: !process.env.CI, env: { PI_BIN: fakePi, THT_BIN: fakeTht, THT_HARNESS_DIR: harnessDir, PORT: "8799", AUTH_MODE: "none", }, }, { // Frontend dev server pointing at the hermetic backend. command: "npm run dev -- --port 5199", cwd: __dir, url: "http://localhost:5199", timeout: 30_000, reuseExistingServer: !process.env.CI, env: { VITE_BACKEND_URL: "http://localhost:8799", }, }, ], });