import { defineConfig, devices } from '@playwright/test'; try { require('dotenv').config(); } catch (_) {} const baseURL = process.env.BASE_URL || 'http://localhost:3000'; const authFile = 'tests/e2e/.auth/user.json'; const useAuth = Boolean(process.env.E2E_USER); export default defineConfig({ testDir: './tests/e2e/specs', fullyParallel: false, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, reporter: [ ['html', { outputFolder: 'playwright-report', open: 'never' }], ['list'], ], use: { baseURL, screenshot: 'only-on-failure', video: 'on-first-retry', trace: 'on-first-retry', }, projects: useAuth ? [ { name: 'setup', testMatch: /auth\.setup\.ts/ }, { name: 'chromium', use: { ...devices['Desktop Chrome'], storageState: authFile }, dependencies: ['setup'], }, ] : [{ name: 'chromium', use: devices['Desktop Chrome'] }], });