import { defineConfig } from '@playwright/test'; // LIVE=https://… runs the same tests against a deployed copy (no local server). const LIVE = process.env.LIVE; // Every test runs in a fresh, throwaway browser profile (never the owner's real Chrome). export default defineConfig({ testDir: 'tests/e2e', timeout: 60_000, fullyParallel: true, workers: 4, reporter: [['list']], use: { baseURL: LIVE || 'http://localhost:4174/', channel: 'chrome', launchOptions: { args: ['--autoplay-policy=no-user-gesture-required'] }, }, webServer: LIVE ? undefined : { command: 'npx vite build --outDir dist-test --emptyOutDir && npx vite preview --outDir dist-test --port 4174 --strictPort', url: 'http://localhost:4174/', reuseExistingServer: false, timeout: 120_000, }, projects: [ { name: 'desktop', use: { viewport: { width: 1280, height: 800 } } }, { name: 'phone', use: { viewport: { width: 360, height: 740 }, isMobile: true, hasTouch: true, deviceScaleFactor: 3 } }, ], });