2026-01-08 04:00:12 +00:00
|
|
|
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
|
|
2026-01-09 13:21:02 +00:00
|
|
|
// URL base configurable via variable de entorno (para CI/CD)
|
|
|
|
|
const baseURL = process.env['BASE_URL'] || 'http://localhost:4200';
|
|
|
|
|
const isCI = !!process.env['CI'];
|
|
|
|
|
const isProduction = baseURL.includes('https://');
|
|
|
|
|
|
2026-01-08 04:00:12 +00:00
|
|
|
export default defineConfig({
|
|
|
|
|
testDir: './e2e',
|
|
|
|
|
fullyParallel: true,
|
2026-01-09 13:21:02 +00:00
|
|
|
forbidOnly: isCI,
|
|
|
|
|
retries: isCI ? 2 : 0,
|
|
|
|
|
workers: isCI ? 1 : undefined,
|
|
|
|
|
reporter: isCI ? [['html'], ['list']] : 'html',
|
|
|
|
|
timeout: isProduction ? 60000 : 30000,
|
2026-01-08 04:00:12 +00:00
|
|
|
use: {
|
2026-01-09 13:21:02 +00:00
|
|
|
baseURL,
|
2026-01-08 04:00:12 +00:00
|
|
|
trace: 'on-first-retry',
|
|
|
|
|
screenshot: 'only-on-failure',
|
2026-01-09 13:21:02 +00:00
|
|
|
video: isCI ? 'retain-on-failure' : 'off',
|
2026-01-08 04:00:12 +00:00
|
|
|
},
|
|
|
|
|
projects: [
|
|
|
|
|
{
|
|
|
|
|
name: 'chromium',
|
|
|
|
|
use: { ...devices['Desktop Chrome'] },
|
|
|
|
|
},
|
|
|
|
|
],
|
2026-01-09 13:21:02 +00:00
|
|
|
// Solo iniciar servidor local si no es producción
|
|
|
|
|
...(isProduction
|
|
|
|
|
? {}
|
|
|
|
|
: {
|
|
|
|
|
webServer: {
|
|
|
|
|
command: 'npm run start',
|
|
|
|
|
url: 'http://localhost:4200',
|
|
|
|
|
reuseExistingServer: !isCI,
|
|
|
|
|
timeout: 120000,
|
|
|
|
|
},
|
|
|
|
|
}),
|
2026-01-08 04:00:12 +00:00
|
|
|
});
|