Files
flights_web/playwright.config.ts

49 lines
1.4 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;
const workers = Number(process.env.E2E_WORKERS || "1");
// Deploy-only quarantine. Keep this list empty unless a documented external
// blocker makes a specific e2e test unsuitable for CI_DEPLOY.
const QUARANTINED_PATTERNS: string[] = [];
const grepInvert = process.env.CI_DEPLOY
&& QUARANTINED_PATTERNS.length > 0
? new RegExp(QUARANTINED_PATTERNS.join("|"))
: undefined;
export default defineConfig({
testDir: "tests/e2e",
timeout: 30000,
workers,
retries: isCI ? 2 : 0,
...(grepInvert ? { grepInvert } : {}),
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:full",
url: "http://localhost:8080",
reuseExistingServer: true,
timeout: 30000,
},
}
: {}),
});