import { defineConfig, devices } from "@playwright/test"; const CI = !!process.env.CI; export default defineConfig({ testDir: "./tests", // Single worker per process — CI uses --shard to split tests across matrix // runners (each gets its own 4 vCPUs). Tests run serially within the worker // because the testPage fixture does e2eReset on a shared worker-scoped // backend before each test. fullyParallel: false, forbidOnly: CI, retries: CI ? 2 : 0, workers: 1, timeout: 60_000, // CI uses blob reporter for cross-shard merge-reports; local uses list. reporter: CI ? [["blob", { outputDir: "./blob-report" }]] : "list", outputDir: "./test-results", use: { trace: "on-first-retry", screenshot: "only-on-failure", video: "on-first-retry", }, projects: [ { name: "chromium", testIgnore: /mobile-.*\.spec\.ts/, use: { ...devices["Desktop Chrome"] }, }, { name: "mobile-chrome", testMatch: /mobile-.*\.spec\.ts/, use: { ...devices["Pixel 5"] }, }, ], // No webServer — each Playwright worker spawns its own frontend // via the backend fixture (see fixtures/backend.ts) globalSetup: "./global-setup.ts", });