import { defineConfig, devices } from '@playwright/test' export default defineConfig({ testDir: './tests', globalSetup: './tests/global-setup.ts', fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 1, // Retries help AI "healer" skills see if a failure is flaky workers: process.env.CI ? 1 : undefined, reporter: 'html', use: { baseURL: 'https://localhost:5173', trace: 'retain-on-failure', // AI needs this to "see" why a test failed video: 'on-first-retry', // Great for visual debugging screenshot: 'only-on-failure', ignoreHTTPSErrors: true, }, /* Configure projects for different environments */ projects: [ { name: 'smoke', testMatch: /.*smoke.spec.ts/, use: { ...devices['Desktop Chrome'], storageState: 'tests/.auth/user.json', }, }, ], /* Run your local dev server before starting tests */ webServer: [ { command: 'npm run dev', url: 'https://localhost:5173', reuseExistingServer: !process.env.CI, stdout: 'pipe', stderr: 'pipe', ignoreHTTPSErrors: true, }, { command: '.venv\\Scripts\\python.exe -m flask run --host=0.0.0.0 --port=5000 --no-debugger --no-reload', url: 'http://localhost:5000/version', reuseExistingServer: !process.env.CI, stdout: 'pipe', stderr: 'pipe', cwd: '../../backend', env: { FLASK_APP: 'main.py', FLASK_DEBUG: '1', DB_ENV: 'e2e', DATA_ENV: 'e2e', SECRET_KEY: 'dev-secret-key-change-in-production', REFRESH_TOKEN_EXPIRY_DAYS: '90', }, }, ], })