import { defineConfig, devices } from '@playwright/test'; import path from 'path'; import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); export default defineConfig({ testDir: './tests/e2e', globalSetup: './tests/fixtures/global-setup.ts', fullyParallel: false, // sequential: sessions depend on shared Docker DB state forbidOnly: !!process.env.CI, retries: process.env.CI ? 1 : 0, workers: 1, reporter: [['html', { open: 'never' }], ['list']], use: { // Match PUBLIC_APP_URL so the OAuth round-trip (Keycloak → GoTrue → SPA) // lands on the same origin the test started from. When PUBLIC_APP_URL is // a LAN IP (for phone/tablet previews) tests continue to work. baseURL: process.env.PUBLIC_APP_URL ?? 'http://localhost:5173', trace: 'on-first-retry', screenshot: 'only-on-failure', // Load anon storage state by default; individual tests override as needed }, projects: [ { name: 'chromium', use: { ...devices['Desktop Chrome'] } } ], webServer: { command: 'pnpm dev', url: 'http://localhost:5173', reuseExistingServer: true, timeout: 120_000 } });