import { defineConfig, devices } from "@playwright/test"; // The Website end to end (docs/WEBSITE-1.0-PLAN.md ยง13): the real backend on an in-memory database // with the demo church (e2e/server.ts), and the Next.js pages (a production build). Run with `npx playwright test` in // apps/website. Nothing needs a database; set E2E_DATABASE_URL (a database ending in _e2e, dropped and // made again) to run the same suite on real Postgres. E2E_REUSE=1 uses servers already running on 5310 / 3310. export default defineConfig({ testDir: "./e2e", testMatch: "**/*.spec.ts", workers: 1, fullyParallel: false, timeout: 120_000, expect: { timeout: 20_000 }, reporter: "list", outputDir: "e2e/test-results", use: { baseURL: "http://localhost:3310", trace: "retain-on-failure", navigationTimeout: 90_000 }, projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }], webServer: [ { command: "npx tsx e2e/server.ts", url: "http://127.0.0.1:5310/api/health", timeout: 120_000, reuseExistingServer: !!process.env.E2E_REUSE, stdout: "pipe", }, { // A production build, as churches run it (next dev's Fast Refresh remounts pages mid-test). command: "npx next build && npx next start -p 3310", cwd: "frontend", url: "http://localhost:3310/robots.txt", timeout: 300_000, reuseExistingServer: !!process.env.E2E_REUSE, env: { WEBSITE_API_URL: "http://127.0.0.1:5310", WEBSITE_CONTENT_CACHE_SECONDS: "0" }, }, ], });