Spaces:
Running
Running
File size: 1,690 Bytes
03608f2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 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 },
});
|