Files
crosscode-platform/apps/events/playwright.config.ts
T
joshuaandClaude Opus 5.5 63d36c3ecf Events 3.0: auto-connect, demo people in Accounts, e2e; import.finish checks the subs
- contracts 1.8.0 / Accounts 1.1.0: import.finish lists the subs the product
  relies on; Accounts checks each is held, not deleted and known to it (the
  count+hash failed a second move after Undo once someone had joined
  through Accounts).
- Events: connects to the church's Accounts once the Hub lists it;
  moveNewPeople (demo data, people added after the move); set-demo moves
  demo people; e2e/sign-in-accounts.spec.ts with Accounts in memory and an
  e2e-only /api rewrite. test:accounts 14/14; Jest auto-connect tests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-19 14:28:54 +02:00

97 lines
3.5 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
// eslint-disable-next-line @typescript-eslint/no-require-imports
const { e2eDatabaseUrl } = require("./e2e/support/db-url");
// End-to-end tests: their own backend (port 5100) and frontend (port 3100) against a
// separate database that is recreated and seeded on every run (e2e/support/prepare-db.js).
// Run with `npm run test:e2e`. In CI (CI=true) the frontend is built and started instead
// of run in dev mode.
const API_PORT = 5100;
const WEB_PORT = 3100;
const ci = !!process.env.CI;
const databaseUrl = e2eDatabaseUrl();
export default defineConfig({
testDir: "./e2e",
testMatch: "**/*.spec.ts",
// One shared database, so tests run one after another.
workers: 1,
fullyParallel: false,
retries: ci ? 1 : 0,
timeout: 120_000,
expect: { timeout: 20_000 },
reporter: ci ? [["list"], ["html", { open: "never", outputFolder: "e2e/report" }]] : "list",
outputDir: "e2e/test-results",
use: {
baseURL: `http://localhost:${WEB_PORT}`,
trace: "retain-on-failure",
screenshot: "only-on-failure",
// Dev-mode pages compile on first visit.
navigationTimeout: 90_000,
},
projects: [{ name: "chromium", use: { ...devices["Desktop Chrome"] } }],
webServer: [
{
// tsx runs the TypeScript straight from src/ (never a stale dist/ build).
command: "node ../e2e/support/prepare-db.js && npx tsx src/index.js",
cwd: "backend",
url: `http://localhost:${API_PORT}/api/v2/setup/needed`,
timeout: 180_000,
reuseExistingServer: !ci,
stdout: "ignore",
stderr: "pipe",
env: {
PORT: String(API_PORT),
DATABASE_URL: databaseUrl,
E2E_DATABASE_URL: databaseUrl,
FRONTEND_URL: `http://localhost:${WEB_PORT}`,
APP_BASE_URL: `http://localhost:${WEB_PORT}`,
JOBS_ENABLED: "false",
// The test site has no licence; without this it would be read-only.
LICENCE_CHECK_DISABLED: "true",
SCHEDULED_EMAILS_ENABLED: "false",
// The kiosk test signs a supervisor in with a password (no 2FA code by email).
TWO_FACTOR_REQUIRED_ROLES: "false",
// webhooks.spec.ts runs its own receiver on localhost.
WEBHOOKS_ALLOW_PRIVATE: "true",
},
},
{
command: ci ? `npm run build && npx next start -p ${WEB_PORT}` : `npx next dev -p ${WEB_PORT}`,
cwd: "frontend",
url: `http://localhost:${WEB_PORT}`,
timeout: 600_000,
reuseExistingServer: !ci,
stdout: "ignore",
stderr: "pipe",
env: {
NEXT_PUBLIC_API_URL: `http://localhost:${API_PORT}`,
API_URL: `http://localhost:${API_PORT}`,
// 3.0.0: the site and its API on one address (as nginx does), for Accounts' callback.
E2E_API_PROXY: `http://localhost:${API_PORT}`,
NEXT_DIST_DIR: ci ? ".next" : ".next-e2e",
NEXT_TELEMETRY_DISABLED: "1",
},
},
// 3.0.0 (sign-in-accounts.spec.ts): the church's Accounts, in memory, and its pages.
{
command: "npx tsx e2e/support/accounts-server.mts",
url: "http://127.0.0.1:5221/api/health",
timeout: 120_000,
reuseExistingServer: !ci,
stdout: "ignore",
stderr: "pipe",
},
{
command: "npx next dev -p 3221 -H 127.0.0.1",
cwd: "../accounts/frontend",
url: "http://127.0.0.1:3221/privacy",
timeout: 300_000,
reuseExistingServer: !ci,
stdout: "ignore",
stderr: "pipe",
env: { ACCOUNTS_API_URL: "http://127.0.0.1:5221", NEXT_TELEMETRY_DISABLED: "1" },
},
],
});