Files
plantillas-proyectos/frontend/playwright.config.ts
Galindo97 4a9d4cfcd1 fix(e2e): usar usuario de prueba existente en lugar de Admin API
El usuario en a76-e2e-credentials no tiene permisos de KC admin (403).
En lugar de crear usuario efímero vía Admin API:
- Eliminar global-setup.ts, global-teardown.ts, fixtures/keycloak.ts
- Quitar globalSetup/globalTeardown de playwright.config.ts
- auth.setup.ts ya navega a /login → Workspace → llena form → /dashboard
- a76-e2e-credentials = usuario de prueba existente en Workspace (E2E_USER/E2E_PASS)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-20 14:10:59 -05:00

35 lines
1.1 KiB
TypeScript

import { defineConfig } from '@playwright/test';
import { fileURLToPath } from 'node:url';
import path from 'node: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: 60_000,
use: {
baseURL: process.env.PLAYWRIGHT_TEST_BASE_URL || 'http://localhost:5173',
headless: inCI ? true : false
},
workers: 1,
testDir: 'e2e',
projects: [
{
name: 'setup',
testMatch: '**/auth.setup.ts',
use: { storageState: { cookies: [], origins: [] } }
},
{
name: 'tests',
dependencies: ['setup'],
testIgnore: ['**/auth.setup.ts', '**/demo.test.ts'],
use: { storageState: authStatePath }
}
]
});