54 lines
1.6 KiB
TypeScript
54 lines
1.6 KiB
TypeScript
|
|
import { defineConfig, devices } from "@playwright/test";
|
||
|
|
|
||
|
|
const BASE_URL = process.env.E2E_BASE_URL ?? "http://localhost:3100";
|
||
|
|
const PORT = new URL(BASE_URL).port || "3000";
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Playwright configuration for WFDASH.
|
||
|
|
*
|
||
|
|
* - `webServer` boots `next dev` on E2E_BASE_URL (defaults to port 3001 to
|
||
|
|
* avoid clashing with whatever else might be on 3000). It reuses an already
|
||
|
|
* running dev server locally; in CI it always boots a fresh one.
|
||
|
|
* - Most flows require a running PocketBase + a seeded user; those specs read
|
||
|
|
* credentials from env and skip cleanly when they're missing.
|
||
|
|
* - The /api/v1/health check is the only spec that needs no infra.
|
||
|
|
*
|
||
|
|
* Required env:
|
||
|
|
* E2E_BASE_URL — default http://localhost:3001
|
||
|
|
* E2E_POCKETBASE_URL — default http://127.0.0.1:8090
|
||
|
|
* E2E_TEST_EMAIL — seeded user email (skip auth specs if unset)
|
||
|
|
* E2E_TEST_PASSWORD — seeded user password
|
||
|
|
* E2E_AGENT_API_KEY — must match AGENT_API_KEY the dev server is using
|
||
|
|
*/
|
||
|
|
export default defineConfig({
|
||
|
|
testDir: "./e2e",
|
||
|
|
fullyParallel: true,
|
||
|
|
forbidOnly: !!process.env.CI,
|
||
|
|
retries: process.env.CI ? 2 : 0,
|
||
|
|
workers: process.env.CI ? 1 : undefined,
|
||
|
|
reporter: process.env.CI ? "github" : "list",
|
||
|
|
|
||
|
|
use: {
|
||
|
|
baseURL: BASE_URL,
|
||
|
|
trace: "on-first-retry",
|
||
|
|
screenshot: "only-on-failure",
|
||
|
|
},
|
||
|
|
|
||
|
|
projects: [
|
||
|
|
{
|
||
|
|
name: "chromium",
|
||
|
|
use: { ...devices["Desktop Chrome"] },
|
||
|
|
},
|
||
|
|
],
|
||
|
|
|
||
|
|
webServer: {
|
||
|
|
command: `npx next dev --webpack -p ${PORT}`,
|
||
|
|
url: BASE_URL,
|
||
|
|
reuseExistingServer: !process.env.CI,
|
||
|
|
timeout: 240_000,
|
||
|
|
stdout: "ignore",
|
||
|
|
stderr: "pipe",
|
||
|
|
},
|
||
|
|
});
|
||
|
|
|