Files
GerbilManager/gerbil-manager-web/playwright.config.ts

63 lines
1.9 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* QA-1: App-weite E2E-Smoke-Suite (Playwright, getrennt von vitest).
*
* Zwei Betriebsarten:
* - MOCK (Standard): startet den Vite-Dev-Server auf :5199 und fängt alle
* API-Aufrufe per Route-Interception ab (Fixtures nach DATA-2-Vertrag,
* siehe e2e/mock-api.ts). Kein Backend nötig.
* - LIVE: `E2E_BASE_URL` zeigt auf das laufende Frontend (z. B. via Aspire
* AppHost); es wird NICHT gemockt und kein Dev-Server gestartet.
* Fixture-gebundene Tests überspringen sich dann selbst.
*
* Viewports: Smartphone (390px, mobile-first) und Laptop (1280px) — jede
* Spec läuft in beiden Projekten.
*/
import { defineConfig, devices } from '@playwright/test'
const LIVE_BASE_URL = process.env.E2E_BASE_URL
const MOCK_PORT = 5199
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
// CI-Flake-Schutz (Dwights Beobachtung, 2× 'Kontakt anlegen'): alle Worker
// teilen sich EINEN Vite-Dev-Server; unbegrenzte Parallelität erzeugt dort
// Timing-Druck (on-demand-Transforms). Lokal bleibt Playwrights Default.
workers: process.env.CI ? 4 : undefined,
reporter: [['list']],
timeout: 30_000,
use: {
baseURL: LIVE_BASE_URL ?? `http://localhost:${MOCK_PORT}`,
locale: 'de-DE',
trace: 'retain-on-failure',
},
projects: [
{
name: 'phone',
use: {
...devices['Desktop Chrome'],
viewport: { width: 390, height: 844 },
deviceScaleFactor: 2,
hasTouch: true,
},
},
{
name: 'desktop',
use: {
...devices['Desktop Chrome'],
viewport: { width: 1280, height: 800 },
},
},
],
webServer: LIVE_BASE_URL
? undefined
: {
command: `npm run dev -- --port ${MOCK_PORT} --strictPort`,
url: `http://localhost:${MOCK_PORT}`,
reuseExistingServer: true,
timeout: 60_000,
},
})