39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
import { defineConfig } from "@playwright/test";
|
|
|
|
const baseURL = process.env.BASE_URL ?? "http://localhost:8080";
|
|
const startLocalServer = !process.env.BASE_URL;
|
|
|
|
// CI: throttle workers + retry transient flake (the upstream WAF rate-limits
|
|
// /api/* by source IP; nginx proxy_cache absorbs most repeat fetches but a
|
|
// burst can still trip 1-2 of them).
|
|
const isCI = !!process.env.CI;
|
|
|
|
export default defineConfig({
|
|
testDir: "tests/e2e",
|
|
timeout: 30000,
|
|
workers: isCI ? 1 : undefined,
|
|
retries: isCI ? 2 : 0,
|
|
use: {
|
|
baseURL,
|
|
headless: true,
|
|
httpCredentials:
|
|
process.env.BASIC_AUTH_USER && process.env.BASIC_AUTH_PASS
|
|
? {
|
|
username: process.env.BASIC_AUTH_USER,
|
|
password: process.env.BASIC_AUTH_PASS,
|
|
}
|
|
: undefined,
|
|
},
|
|
reporter: [["html", { open: "never" }], ["list"]],
|
|
...(startLocalServer
|
|
? {
|
|
webServer: {
|
|
command: "pnpm dev",
|
|
url: "http://localhost:8080",
|
|
reuseExistingServer: true,
|
|
timeout: 30000,
|
|
},
|
|
}
|
|
: {}),
|
|
});
|