2025-12-08 18:57:54 +00:00
|
|
|
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
2026-01-26 13:12:17 +00:00
|
|
|
testDir: './e2e/tests',
|
2025-12-08 18:57:54 +00:00
|
|
|
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())
|
2026-01-26 13:12:17 +00:00
|
|
|
|
2025-12-22 21:00:50 +00:00
|
|
|
// Global Setup: Login once and save authenticated state
|
2026-01-18 12:55:28 +00:00
|
|
|
// Désactivé temporairement pour les tests de debug
|
|
|
|
|
globalSetup: process.env.PLAYWRIGHT_SKIP_GLOBAL_SETUP ? undefined : './e2e/global-setup.ts',
|
2026-01-26 13:12:17 +00:00
|
|
|
|
2025-12-08 18:57:54 +00:00
|
|
|
reporter: [['html'], ['json', { outputFile: 'e2e-results.json' }]],
|
|
|
|
|
use: {
|
2026-02-17 15:42:48 +00:00
|
|
|
baseURL: process.env.PLAYWRIGHT_BASE_URL || process.env.VITE_FRONTEND_URL || `http://localhost:${process.env.PORT || '5173'}`,
|
2025-12-08 18:57:54 +00:00
|
|
|
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',
|
2025-12-08 18:57:54 +00:00
|
|
|
},
|
|
|
|
|
projects: [
|
|
|
|
|
{
|
|
|
|
|
name: 'chromium',
|
2026-01-26 13:12:17 +00:00
|
|
|
use: {
|
2025-12-22 21:00:50 +00:00
|
|
|
...devices['Desktop Chrome'],
|
|
|
|
|
// Each project can override storageState if needed
|
|
|
|
|
storageState: 'e2e/.auth/user.json',
|
|
|
|
|
},
|
2025-12-08 18:57:54 +00:00
|
|
|
},
|
2025-12-25 17:46:16 +00:00
|
|
|
{
|
|
|
|
|
name: 'firefox',
|
2026-01-26 13:12:17 +00:00
|
|
|
use: {
|
2025-12-25 17:46:16 +00:00
|
|
|
...devices['Desktop Firefox'],
|
|
|
|
|
storageState: 'e2e/.auth/user.json',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'webkit',
|
2026-01-26 13:12:17 +00:00
|
|
|
use: {
|
2025-12-25 17:46:16 +00:00
|
|
|
...devices['Desktop Safari'],
|
|
|
|
|
storageState: 'e2e/.auth/user.json',
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'msedge',
|
2026-01-26 13:12:17 +00:00
|
|
|
use: {
|
2025-12-25 17:46:16 +00:00
|
|
|
...devices['Desktop Edge'],
|
|
|
|
|
storageState: 'e2e/.auth/user.json',
|
|
|
|
|
},
|
|
|
|
|
},
|
2025-12-08 18:57:54 +00:00
|
|
|
],
|
|
|
|
|
webServer: {
|
2026-02-17 15:42:48 +00:00
|
|
|
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,
|
2025-12-08 18:57:54 +00:00
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|