import { defineConfig, devices } from '@playwright/test' // Override with E2E_PORT when something else already occupies 3000 — otherwise // reuseExistingServer would silently run the suite against that foreign server. const PORT = Number(process.env.E2E_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, reporter: process.env.CI ? 'list' : 'html', use: { baseURL: BASE_URL, trace: 'on-first-retry', }, // Both projects run on the chromium binary, so `npx playwright install chromium` // is enough for the whole suite. projects: [ { name: 'desktop', use: { ...devices['Desktop Chrome'] } }, { name: 'mobile', use: { ...devices['Pixel 5'] } }, ], webServer: { command: `npm run dev -- --port ${PORT}`, url: BASE_URL, reuseExistingServer: !process.env.CI, timeout: 120_000, }, })