WFDASH-WEBAPP/playwright.config.ts
SJCoetz c4e1c62882 chore: standardize line endings and add full test + config scaffolding
Fix inconsistent line endings across all project files for cross-environment consistency.
Add complete unit test suite covering core utilities, API routes, and server services.
Add Playwright E2E test setup with smoke, auth, and agent API tests.
Update all project configuration files to match standardized formatting.
Fix MCP API error handling to properly propagate HTTP status codes and use correct JSON-RPC error codes.
Add VSCode workspace configuration, extensions, and example MCP config files.
Update .gitignore to exclude new test and build artifacts.
2026-06-11 20:30:02 +02:00

53 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",
},
});