feat(jenkins): enhance E2E testing and debugging capabilities
- Updated Jenkinsfile to include Playwright's trace option for better debugging on test failures. - Added archiving of test results, including trace files, error context, and screenshots for failed tests. - Enhanced error handling in `auth.setup.ts` to log diagnostic information when authentication fails, improving visibility into issues. These changes aim to improve the reliability and debuggability of E2E tests.
This commit is contained in:
@@ -36,7 +36,21 @@ setup('autenticacion', async ({ page }) => {
|
||||
// ── 3. Si Workspace muestra el app-launcher (usuario con múltiples apps),
|
||||
// elegir anexo76-dev — la app del launcher cuya URL apunta al frontend bajo prueba.
|
||||
// Cuando hay match directo de dominio, Workspace salta el launcher y este paso no ejecuta.
|
||||
await page.waitForURL(/\/(app-launcher|dashboard|auth\/callback)/, { timeout: 30_000 })
|
||||
try {
|
||||
await page.waitForURL(/\/(app-launcher|dashboard|auth\/callback)/, { timeout: 30_000 })
|
||||
} catch (e) {
|
||||
// Si seguimos en /login de Workspace, las credenciales fueron rechazadas o el form no aceptó.
|
||||
// Imprimir diagnóstico antes de fallar: URL actual + posibles mensajes de error visibles.
|
||||
const currentUrl = page.url()
|
||||
const errorMessages = await page.locator('.text-destructive, [role="alert"], .error, .invalid-feedback')
|
||||
.allTextContents()
|
||||
.catch(() => [] as string[])
|
||||
const visibleText = await page.locator('body').innerText().catch(() => '')
|
||||
console.log(`[auth.setup][DIAG] URL: ${currentUrl}`)
|
||||
console.log(`[auth.setup][DIAG] Mensajes de error: ${JSON.stringify(errorMessages)}`)
|
||||
console.log(`[auth.setup][DIAG] Body (primeros 800 chars): ${visibleText.slice(0, 800)}`)
|
||||
throw e
|
||||
}
|
||||
if (/\/app-launcher/.test(page.url())) {
|
||||
await page.getByRole('button', { name: /^anexo76-dev/i }).click()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user