Files
CPLv4.0/playwright.config.ts
ISA 05c1c9c0cf Headless wird sicher erzwungen (auch wenn lokal anders).
Der Next.js-Server wird gebaut und via npm start im selben Container gestartet (statt npm run dev).

Robustere Browser-Flags für Container.

Artefakte (Trace/Screenshot/Video) nur bei Fehlern, damit der CI schnell bleibt.

baseURL kommt aus ENV (E2E_BASE_URL) – lokal bleibt’s http://localhost:3000.

PLAYWRIGHT_BROWSERS_PATH=0 bleibt (Option B).
2025-08-29 11:45:09 +02:00

66 lines
1.7 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.

import { defineConfig, devices } from "@playwright/test";
const CI = !!process.env.CI;
export default defineConfig({
testDir: "./playwright/tests",
// Globale Zeitlimits
timeout: 90_000,
expect: { timeout: 15_000 }, // etwas großzügiger im CI
// Setup/Parallelisierung
globalSetup: "./playwright/global-setup",
fullyParallel: true,
forbidOnly: CI,
retries: CI ? 2 : 0,
workers: CI ? 1 : undefined,
// Reporter & Ausgabepfade
reporter: [
["list"],
["html", { outputFolder: "playwright/report", open: "never" }],
],
outputDir: "playwright/test-results",
// Standard-Defaults für alle Tests/Projekte
use: {
// Base-URL: im CI per ENV steuerbar
baseURL: process.env.E2E_BASE_URL || "http://localhost:3000",
// Headless im CI (und wenn PW_HEADLESS=1); lokal darfst du headed verwenden
headless: process.env.PW_HEADLESS === "1" || CI,
// Container-robuste Flags
launchOptions: {
args: ["--no-sandbox", "--disable-dev-shm-usage"],
},
viewport: { width: 1920, height: 1080 },
// Artefakte sparsam, aber genug fürs Debugging
video: CI ? "retain-on-failure" : "on-first-retry",
screenshot: CI ? "only-on-failure" : "only-on-failure",
trace: "retain-on-failure",
// Optional: falls du Test-IDs nutzt
testIdAttribute: "data-testid",
},
// Projekte (nur Chromium)
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
// Webserver: baue & starte Next.js (statt "dev")
webServer: {
command: "npm run build && npm run start -p 3000",
url: process.env.E2E_BASE_URL || "http://localhost:3000",
reuseExistingServer: !CI,
timeout: 120_000, // Zeit für Build+Start
},
});