veza/apps/web/playwright.config.ts

76 lines
2.4 KiB
TypeScript
Raw Normal View History

import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './e2e/tests',
fullyParallel: true,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
2025-12-22 21:00:50 +00:00
// ⚠️ CRITICAL: 1 worker pour éviter rate limiting backend (429)
// Le backend a un rate limiter qui bloque trop de requêtes simultanées
workers: 1,
// 🔴 FIX: Augmenter le timeout global par défaut pour les tests d'upload
timeout: 60000, // 60 secondes par défaut (peut être surchargé par test.setTimeout())
2025-12-22 21:00:50 +00:00
// Global Setup: Login once and save authenticated state
// Désactivé temporairement pour les tests de debug
globalSetup: process.env.PLAYWRIGHT_SKIP_GLOBAL_SETUP ? undefined : './e2e/global-setup.ts',
reporter: [['html'], ['json', { outputFile: 'e2e-results.json' }]],
use: {
baseURL: process.env.PLAYWRIGHT_BASE_URL || process.env.VITE_FRONTEND_URL || `http://localhost:${process.env.PORT || '5173'}`,
trace: 'on-first-retry',
screenshot: 'only-on-failure',
video: 'retain-on-failure',
2025-12-22 21:00:50 +00:00
// Load authenticated state from global setup
storageState: 'e2e/.auth/user.json',
},
projects: [
{
name: 'chromium',
use: {
2025-12-22 21:00:50 +00:00
...devices['Desktop Chrome'],
// Each project can override storageState if needed
storageState: 'e2e/.auth/user.json',
},
},
{
name: 'firefox',
use: {
...devices['Desktop Firefox'],
storageState: 'e2e/.auth/user.json',
},
},
{
name: 'webkit',
use: {
...devices['Desktop Safari'],
storageState: 'e2e/.auth/user.json',
},
},
{
name: 'msedge',
use: {
...devices['Desktop Edge'],
storageState: 'e2e/.auth/user.json',
},
},
],
webServer: {
command: process.env.PORT ? `PORT=${process.env.PORT} npm run dev` : 'npm run dev',
url: `http://localhost:${process.env.PORT || '5173'}`,
reuseExistingServer: process.env.CI ? false : true,
timeout: 300 * 1000, // 5 min for cold start (CI or slow machines)
// CI: ensure Vite proxy targets correct backend (veza.fr:18080)
env: process.env.CI
? {
...process.env,
PORT: process.env.PORT || '5174',
VITE_API_URL: process.env.VITE_API_URL || '/api/v1',
VITE_DOMAIN: process.env.VITE_DOMAIN || 'veza.fr',
VITE_BACKEND_PORT: process.env.VITE_BACKEND_PORT || '18080',
}
: undefined,
},
});