import { defineConfig, devices } from '@playwright/test'; import { fileURLToPath } from 'url'; import { dirname } from 'path'; // ESM-compatible __dirname const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); export default defineConfig({ testDir: './tests/e2e', timeout: 30_000, retries: 0, fullyParallel: true, reporter: [['list']], use: { baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:4173', trace: 'on-first-retry' }, webServer: { // Build then preview to ensure static output exists command: 'pnpm build && pnpm preview', cwd: __dirname, port: 4173, reuseExistingServer: !process.env.CI }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] } } ] });