import { defineConfig, devices } from '@playwright/test'; /** * E2E tests for WellNuo Expo web app * * To run tests: * 1. Start Expo web server: npm run web * 2. Run tests: npm run test:e2e * * Or with custom URL: * E2E_BASE_URL=http://localhost:3000 npm run test:e2e */ export default defineConfig({ testDir: './e2e', fullyParallel: false, // Sequential tests to avoid rate limiting forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: 1, // Single worker to prevent 429 errors reporter: [ ['html', { open: 'never' }], ['list'], ], timeout: 60000, // 60 second timeout per test expect: { timeout: 10000, // 10 second timeout for assertions }, use: { // Use environment variable or default to local Expo web server baseURL: process.env.E2E_BASE_URL || 'http://localhost:8081', trace: 'on-first-retry', screenshot: 'only-on-failure', video: 'retain-on-failure', actionTimeout: 15000, navigationTimeout: 30000, }, // Optionally start Expo web server before tests webServer: process.env.E2E_START_SERVER ? { command: 'npm run web', url: 'http://localhost:8081', reuseExistingServer: !process.env.CI, timeout: 120000, } : undefined, projects: [ // Critical flows - desktop Chrome (primary) { name: 'chromium', use: { ...devices['Desktop Chrome'] }, testMatch: /critical-flows\/.*.spec.ts/, }, // Mobile Chrome for responsive testing { name: 'mobile-chrome', use: { ...devices['Pixel 5'] }, testMatch: /critical-flows\/.*.spec.ts/, }, // Legacy tests (original e2e files) { name: 'legacy', use: { ...devices['Desktop Chrome'] }, testMatch: /^(?!critical-flows).*.spec.ts/, }, ], });