import { defineConfig, devices } from "@playwright/test"; const baseURL = process.env.E2E_BASE_URL ?? "http://localhost:3000"; const startDevServer = process.env.START_DEV_SERVER === "true"; const browserMatrix = process.env.E2E_BROWSER_MATRIX === "1"; export default defineConfig({ testDir: "./tests/e2e", testMatch: /.*\.spec\.ts$/, fullyParallel: false, forbidOnly: !!process.env.CI, retries: process.env.CI ? 1 : 0, workers: 1, // The default 30s per-test timeout is too tight for this suite: the // outbox-drain readiness tests poll a real worker for a terminal execution // status for up to getWorkflowOutboxDrainPollTimeoutMs() (90s), and real // stream/execution runs against the remote target need margin under serial // load. A 30s cap made those legitimately-slow tests fail before they could // complete. Fast tests finish in seconds and are unaffected. timeout: 120_000, reporter: "list", use: { baseURL, trace: "retain-on-failure", }, projects: [ { name: "chromium", use: { ...devices["Desktop Chrome"] }, }, ...(browserMatrix ? [ { name: "mobile-chrome", use: { ...devices["Pixel 5"] }, }, { name: "mobile-safari", use: { ...devices["iPhone 13"] }, }, ] : []), ], ...(startDevServer ? { webServer: { command: "pnpm dev", url: baseURL, reuseExistingServer: !process.env.CI, timeout: 120_000, }, } : {}), });