import { defineConfig, devices } from '@playwright/test'; /** * Ende-zu-Ende-Tests gegen den Produktions-Build (vorher `npm run build`). * Die Tests teilen sich eine Datenbank und laufen deshalb nacheinander. * PW_CHROMIUM: Pfad zu einem vorhandenen Chromium (sonst `npx playwright install chromium`). */ const port = 4173; const executablePath = process.env.PW_CHROMIUM || undefined; export default defineConfig({ testDir: 'tests/e2e', fullyParallel: false, workers: 1, retries: process.env.CI ? 1 : 0, reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : 'list', timeout: 60_000, use: { baseURL: `http://localhost:${port}`, // kein „Headless“ im Kennzeichen, damit die anonyme Zählung greift (Bots werden verworfen) userAgent: 'Mozilla/5.0 (X11; Linux x86_64) WerkstattTest/1.0', launchOptions: { executablePath }, // axe wird für die Prüfung in die Seite eingebunden – die Content-Security-Policy würde das verhindern bypassCSP: true, trace: 'retain-on-failure' }, projects: [ { name: 'mobil', use: { ...devices['Pixel 7'], userAgent: 'Mozilla/5.0 (Linux; Android 14) WerkstattTest/1.0 Mobile', launchOptions: { executablePath }, bypassCSP: true }, testMatch: /leser\..*spec/ }, { name: 'desktop', use: { viewport: { width: 1360, height: 900 } }, testIgnore: /leser\..*spec/ } ], webServer: { command: 'node tests/e2e/server.mjs', url: `http://localhost:${port}/health`, reuseExistingServer: false, timeout: 120_000, env: { PORT: String(port), FAKE_AI_PORT: '9599' } } });