import { defineConfig, devices } from "@playwright/test"; /** * Playwright-Konfiguration für die Auth-Gating-Suite. * * HINWEIS: Diese Suite erfordert einen LAUFENDEN Server (Next.js) und eine * erreichbare Datenbank. In der Sandbox/CI ohne Server/DB wird sie NICHT * ausgeführt (deferred). `webServer` startet die App lokal, wenn vorhanden. */ export default defineConfig({ testDir: "./tests/e2e", fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, reporter: process.env.CI ? "github" : "list", // Migration + deterministischer Seed (deferred ohne DATABASE_URL). globalSetup: "./tests/e2e/global-setup.ts", use: { baseURL: process.env.E2E_BASE_URL ?? "http://localhost:3000", trace: "on-first-retry", }, projects: [ // 1. Echter Login je Konto -> storageState (tests/e2e/.auth/*.json). { name: "setup", testMatch: /fixtures\/auth\.setup\.ts/ }, // 2. Eigentliche Suiten; hängen vom Login-Setup ab. { name: "chromium", use: { ...devices["Desktop Chrome"] }, testIgnore: /fixtures\/auth\.setup\.ts/, dependencies: ["setup"], }, ], webServer: process.env.E2E_BASE_URL ? undefined : { command: "npm run build && npm run start", url: "http://localhost:3000/api/health", reuseExistingServer: !process.env.CI, timeout: 120_000, }, });