Shuffle/e2e/playwright.config.ts
cschlaefke f302c56904 test(auth): add Playwright project with api tests for KTO-01 (GoTrue, Mailpit, db helper)
Refs #38

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-03 10:29:18 +01:00

52 lines
1.7 KiB
TypeScript

import { defineConfig, devices, type Project } from '@playwright/test';
const webUrl = process.env.WEB_URL ?? 'http://localhost:3000';
/**
* Projekte (Spec #1 § 7):
* - api GoTrue ueber Kong + Mailpit-Helfer
* - web gebaute Flutter-Web-App (`app/build/web`, statisch auf Port 3000)
* - throttle Drosselung (Krit. 7) gegen den Extra-Container, nur mit THROTTLE_GOTRUE_URL
* - spike SMTP-Spike (Issue #37), nur mit SPIKE_GOTRUE_URL, nicht blockierend
*/
const projects: Project[] = [
{ name: 'api', testDir: './tests/api', use: {} },
{
name: 'web',
testDir: './tests/web',
use: {
...devices['Desktop Chrome'],
baseURL: webUrl,
// Englische Texte (app_en.arb); die App waehlt die Sprache nach dem Browser.
locale: 'en-US',
// Der Flutter-Service-Worker wuerde alte Builds cachen.
serviceWorkers: 'block',
},
},
];
if (process.env.THROTTLE_GOTRUE_URL) {
projects.push({ name: 'throttle', testDir: './tests/throttle', use: {} });
}
if (process.env.SPIKE_GOTRUE_URL) {
projects.push({ name: 'spike', testDir: './tests/spike', use: {}, retries: 0 });
}
export default defineConfig({
timeout: 60_000,
expect: { timeout: 10_000 },
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 1 : 0,
workers: process.env.CI ? 2 : 4,
reporter: process.env.CI ? [['list'], ['html', { open: 'never' }]] : [['list']],
use: { trace: 'retain-on-failure' },
projects,
// SPA-Fallback (`-s`), sonst liefert /auth/confirm?... 404.
webServer: {
command: 'npx serve -s ../app/build/web -l 3000 --no-clipboard',
url: webUrl,
reuseExistingServer: true,
timeout: 30_000,
},
});