import { defineConfig, devices } from '@playwright/test' /** * Playwright configuration for E2E tests. * Tests live streaming flow: Mobile Safari (publisher) → Desktop Chrome/Firefox (viewer) */ export default defineConfig({ testDir: './test/e2e', fullyParallel: false, // WebRTC tests need sequential execution forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 1, workers: 1, // Run tests sequentially for WebRTC reporter: 'html', globalSetup: './test/e2e/global-setup.js', globalTeardown: './test/e2e/global-teardown.js', use: { baseURL: 'https://localhost:3000', ignoreHTTPSErrors: true, // Accept self-signed certs from .dev-certs/ trace: 'on-first-retry', screenshot: 'only-on-failure', video: 'retain-on-failure', }, projects: [ { name: 'mobile-safari', use: { ...devices['iPhone 13'], // Use WebKit for Safari-like behavior (actual Safari requires macOS) channel: 'webkit', permissions: ['geolocation'], geolocation: { latitude: 37.7749, longitude: -122.4194 }, }, }, { name: 'desktop-chrome', use: { ...devices['Desktop Chrome'], launchOptions: { args: [ '--use-fake-ui-for-media-stream', '--use-fake-device-for-media-stream', ], }, }, }, { name: 'desktop-firefox', use: { ...devices['Desktop Firefox'], }, }, ], webServer: { command: 'npm run dev', url: 'https://localhost:3000/health', reuseExistingServer: true, // Always reuse existing server for E2E tests timeout: 120 * 1000, // 2 minutes for server startup ignoreHTTPSErrors: true, }, timeout: 60 * 1000, // 60 seconds per test (WebRTC setup takes time) })