import { defineConfig, devices } from '@playwright/test'; const PORT = 3000; const BASE_URL = `http://localhost:${PORT}`; export default defineConfig({ testDir: './tests', fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, reporter: [['list'], ['html', { open: 'never' }]], use: { baseURL: BASE_URL, trace: 'retain-on-failure', screenshot: 'only-on-failure', }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] }, }, ], webServer: { // Run from the repo root so workspace resolution works. command: 'pnpm --filter @repo/operator-pwa dev', cwd: '..', url: BASE_URL, reuseExistingServer: !process.env.CI, timeout: 120_000, stdout: 'pipe', stderr: 'pipe', // Force the dev autologin on for E2E regardless of the developer's local // .env. This env applies only to the child dev server, not the test // process itself. env: { AUTH_DEV_AUTOLOGIN: 'true', }, }, });