Repository Public
1import { defineConfig, devices } from '@playwright/test';23const PORT = Number(process.env.WEB_PORT ?? 3641);4const MOCK_PORT = Number(process.env.MOCK_PORT ?? 8641);56/**7 * E2E runs against the STATIC EXPORT (apps/web/out) served by dev/serve-out.mjs with the8 * production CSP, with /api proxied to the dev mock (fixture data, scripted agent). Build first:9 * NEXT_PUBLIC_E2E=1 pnpm --filter @aos/web build10 * (the E2E hook `window.__aos` only exists in that build; a normal build has no test hook).11 */12export default defineConfig({13 testDir: './e2e',14 outputDir: './test-results',15 fullyParallel: false,16 workers: 1, // one shared mock server (single administrator, shared state)17 retries: 0,18 timeout: 60_000,19 expect: { timeout: 12_000 },20 reporter: [['list']],21 use: { baseURL: `http://127.0.0.1:${PORT}`, trace: 'retain-on-failure', actionTimeout: 10_000 },22 webServer: [23 { command: `node dev/mock-server.mjs`, env: { MOCK_PORT: String(MOCK_PORT), MOCK_LOCK_SEC: '4', MOCK_SPEED: process.env.MOCK_SPEED ?? '0.45' }, url: `http://127.0.0.1:${MOCK_PORT}/api/v1/health`, reuseExistingServer: false },24 { command: `node dev/serve-out.mjs`, env: { PORT: String(PORT), MOCK_PORT: String(MOCK_PORT) }, url: `http://127.0.0.1:${PORT}/login/`, reuseExistingServer: false },25 ],26 projects: [27 { name: 'desktop', testIgnore: /phone.*\.spec\.ts/, use: { ...devices['Desktop Chrome'], viewport: { width: 1440, height: 900 } } },28 { name: 'phone', testMatch: /phone.*\.spec\.ts/, use: { ...devices['iPhone 15'] } },29 ],30});31