Repository Public
1import { defineConfig, devices } from '@playwright/test';23const PORT = Number(process.env.WEB_PORT ?? 3621);4const MOCK_PORT = Number(process.env.MOCK_PORT ?? 8621);5// Second instance of the SAME static export, answering as "Codex Remote" (MOCK_AGENT=codex): e2e/codex*.spec.ts.6const CODEX_PORT = Number(process.env.CODEX_WEB_PORT ?? 3622);7const CODEX_MOCK_PORT = Number(process.env.CODEX_MOCK_PORT ?? 8622);89/**10 * E2E runs against the STATIC EXPORT (apps/web/out) served by dev/serve-out.mjs with the11 * production CSP, with /api proxied to the dev mock. Build first:12 * NEXT_PUBLIC_E2E=1 pnpm --filter @cr/web build13 */14export default defineConfig({15 testDir: './e2e',16 outputDir: './test-results',17 fullyParallel: false,18 workers: 1, // one shared mock server (single administrator, shared lockout state)19 retries: 0,20 timeout: 45_000,21 expect: { timeout: 10_000 },22 reporter: [['list']],23 use: { baseURL: `http://127.0.0.1:${PORT}`, trace: 'retain-on-failure', actionTimeout: 10_000 },24 webServer: [25 { command: `node dev/mock-server.mjs`, env: { MOCK_PORT: String(MOCK_PORT), MOCK_LOCK_SEC: '4' }, url: `http://127.0.0.1:${MOCK_PORT}/api/v1/health`, reuseExistingServer: false },26 { 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 },27 { command: `node dev/mock-server.mjs`, env: { MOCK_PORT: String(CODEX_MOCK_PORT), MOCK_LOCK_SEC: '4', MOCK_AGENT: 'codex' }, url: `http://127.0.0.1:${CODEX_MOCK_PORT}/api/v1/health`, reuseExistingServer: false },28 { command: `node dev/serve-out.mjs`, env: { PORT: String(CODEX_PORT), MOCK_PORT: String(CODEX_MOCK_PORT), MOCK_AGENT: 'codex' }, url: `http://127.0.0.1:${CODEX_PORT}/login/`, reuseExistingServer: false },29 ],30 projects: [31 { name: 'desktop', testIgnore: /(mobile.*|codex.*)\.spec\.ts/, use: { ...devices['Desktop Chrome'], viewport: { width: 1440, height: 900 } } },32 { name: 'mobile', testMatch: /mobile.*\.spec\.ts/, use: { ...devices['iPhone 15'] } },33 { name: 'codex-desktop', testMatch: /codex\.spec\.ts/, use: { ...devices['Desktop Chrome'], viewport: { width: 1440, height: 900 }, baseURL: `http://127.0.0.1:${CODEX_PORT}` } },34 { name: 'codex-phone', testMatch: /codex-phone\.spec\.ts/, use: { ...devices['iPhone 15'], baseURL: `http://127.0.0.1:${CODEX_PORT}` } },35 ],36});37