import { defineConfig, devices } from '@playwright/test'; /** * Playwright E2E configuration for the Mosaic web SPA. * * Assumes the NestJS gateway is already running on http://localhost:14242 and * serving the built SPA bundle (WEB_DIST_DIR pointing at apps/web/dist) — the * same serving path production uses (Phase P5, #1444). Override the target * with PLAYWRIGHT_BASE_URL. * * global-setup seeds the E2E users through the real bootstrap and admin APIs * when the database is empty; against an already-populated environment it * seeds nothing. * * Run with: pnpm --filter @mosaicstack/web test:e2e */ export default defineConfig({ testDir: './e2e', globalSetup: './e2e/global-setup.ts', fullyParallel: true, forbidOnly: !!process.env['CI'], retries: process.env['CI'] ? 2 : 0, workers: process.env['CI'] ? 1 : undefined, // CI needs the verdict in the step log; the html report is a local tool. reporter: process.env['CI'] ? 'list' : 'html', use: { baseURL: process.env['PLAYWRIGHT_BASE_URL'] ?? 'http://localhost:14242', trace: 'on-first-retry', screenshot: 'only-on-failure', }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] }, }, ], // Do NOT auto-start a server — tests assume the gateway is already running. // webServer is intentionally omitted so tests can run against a live env. });