Files
plantillas-proyectos/frontend/playwright.config.ts

36 lines
1.2 KiB
TypeScript

import { defineConfig } from '@playwright/test';
import { fileURLToPath } from 'url';
import path from 'path';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const authStatePath = path.join(__dirname, 'e2e/.auth/user.json');
/** GitHub/Gitea/GitLab suelen exportar CI=true; Jenkins no siempre, pero define JENKINS_URL. */
const inCI = process.env.CI === 'true' || Boolean(process.env.JENKINS_URL);
export default defineConfig({
// En CI, falla si queda un .only; en local no
forbidOnly: inCI,
timeout: 60000,
use: {
baseURL: 'http://localhost:5173',
// Sin display en agentes de integración: obligatorio headless
headless: inCI ? true : false
},
workers: 1,
testDir: 'e2e',
projects: [
{
name: 'setup',
testMatch: '**/auth.setup.ts',
// Navegador limpio: user.json se genera aquí y no debe existir al primer run / en CI
use: { storageState: { cookies: [], origins: [] } }
},
{
name: 'tests',
dependencies: ['setup'],
testIgnore: ['**/auth.setup.ts', '**/demo.test.ts'],
use: { storageState: authStatePath }
}
]
});