trails/playwright.config.ts
Ullrich Schäfer ba4c4e1b4f
Apply demo-activity-bot: Bruno, the synthetic public-walk generator
Adds a background demo user (`bruno`) plus two pg-boss jobs that generate
public trekking routes and activities in inner Berlin and prune them
after 14 days. Disabled by default everywhere; flip `DEMO_BOT_ENABLED`
only in prod.

- Schema: `synthetic` boolean on routes + activities
- `ensureDemoUser()` idempotent insert + badge on /users/bruno
- Generation gate: 07-21 Berlin local, p=0.12, 40-route cap in 14d
- Initial 4-walk backfill on first enable; retention via daily prune
- Prometheus gauges `demo_bot_synthetic_routes_total` / `_activities_total`
- Unit + DB-gated integration + E2E tests

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-19 10:14:58 +02:00

93 lines
2.3 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
testDir: "./e2e",
outputDir: "./e2e/results",
fullyParallel: true,
retries: process.env.CI ? 2 : 0,
workers: process.env.CI ? 1 : undefined,
reporter: process.env.CI
? [["github"], ["html", { open: "never" }], ["json", { outputFile: "playwright-results.json" }]]
: "list",
use: {
baseURL: "http://localhost:3000",
trace: "on-first-retry",
screenshot: "only-on-failure",
},
projects: [
{
name: "journal",
testMatch: "journal.test.ts",
use: {
...devices["Desktop Chrome"],
baseURL: "http://localhost:3000",
},
},
{
name: "planner",
testMatch: "planner.test.ts",
use: {
...devices["Desktop Chrome"],
baseURL: "http://localhost:3001",
},
},
{
name: "auth",
testMatch: "auth.test.ts",
use: {
...devices["Desktop Chrome"],
baseURL: "http://localhost:3000",
},
},
{
name: "public-content",
testMatch: "public-content.test.ts",
use: {
...devices["Desktop Chrome"],
baseURL: "http://localhost:3000",
},
},
{
name: "demo-bot",
testMatch: "demo-bot.test.ts",
use: {
...devices["Desktop Chrome"],
baseURL: "http://localhost:3000",
},
},
{
name: "integration",
testMatch: "integration.test.ts",
use: {
...devices["Desktop Chrome"],
},
},
],
webServer: process.env.CI
? [
{
command: "npx react-router-serve ./build/server/index.js",
url: "http://localhost:3000",
cwd: "./apps/journal",
reuseExistingServer: false,
},
{
command: "node --experimental-strip-types server.ts",
url: "http://localhost:3001",
cwd: "./apps/planner",
reuseExistingServer: false,
},
]
: [
{
command: "pnpm --filter @trails-cool/journal dev",
url: "http://localhost:3000",
reuseExistingServer: true,
},
{
command: "pnpm --filter @trails-cool/planner dev",
url: "http://localhost:3001",
reuseExistingServer: true,
},
],
});