import { defineConfig, devices } from '@playwright/test'; /** * Playwright E2E Test Configuration * * See https://playwright.dev/docs/test-configuration */ export default defineConfig({ testDir: './tests/e2e', // Maximum time one test can run for timeout: 30 * 1000, // Test execution settings fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, // Reporter configuration reporter: [ ['html', { outputFolder: 'tests/e2e/playwright-report' }], ['json', { outputFile: 'tests/e2e/test-results.json' }], ['list'] ], // Shared settings for all projects use: { // Base URL for tests baseURL: 'https://localhost', // Collect trace on retry trace: 'on-first-retry', // Screenshot on failure screenshot: 'only-on-failure', // Video on retry video: 'retain-on-failure', // Ignore HTTPS errors (for local development) ignoreHTTPSErrors: true, // Browser context options viewport: { width: 1280, height: 720 }, // User-Agent to avoid WAF blocking userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36' }, // Configure projects for different browsers projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] }, }, // Uncomment when needed // { // name: 'firefox', // use: { ...devices['Desktop Firefox'] }, // }, // { // name: 'webkit', // use: { ...devices['Desktop Safari'] }, // }, // Mobile viewports // { // name: 'Mobile Chrome', // use: { ...devices['Pixel 5'] }, // }, // { // name: 'Mobile Safari', // use: { ...devices['iPhone 12'] }, // }, ], // Run local dev server before starting tests webServer: { command: 'make up', url: 'https://localhost', reuseExistingServer: !process.env.CI, ignoreHTTPSErrors: true, timeout: 120 * 1000, // 2 minutes for Docker startup }, });