trails/playwright.config.ts
Ullrich Schäfer 888c706af1
experiment: let Playwright run with default parallel workers on CI
Previously `workers: process.env.CI ? 1 : undefined` pinned CI to a
single worker. PR #365 added a hydration helper that was supposed to
make workers=1 unnecessary; this PR validates that on real CI by
letting Playwright default to logical CPU count (~2 on standard
GitHub Actions runners).

If CI stays green here across the auth + journal + planner +
public-content projects, the speedup is essentially free. If flaky,
revert and we know we have more hydration work to do.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 02:42:21 +02:00

106 lines
2.8 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
export default defineConfig({
testDir: "./e2e",
outputDir: "./e2e/results",
fullyParallel: true,
retries: process.env.CI ? 2 : 0,
// Experiment: drop the CI=1 worker pin to see if the suite is stable in
// parallel on real CI. PR #365 introduced a hydration helper that was
// supposed to make workers=1 unnecessary; this validates that. `undefined`
// lets Playwright default to logical CPU count (~2 on standard GitHub
// Actions runners). If CI stays green, keep; if flaky, revert.
workers: 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"],
},
},
{
name: "notifications",
testMatch: "notifications.test.ts",
use: {
...devices["Desktop Chrome"],
baseURL: "http://localhost:3000",
},
},
],
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,
},
],
});