import { request } from '@playwright/test'; /** * Asks for every screen once before the suite starts. * * Against `pnpm dev` a route is compiled the first time it is requested, and whichever test * happens to be first pays for it: a sign in navigation runs past the five seconds * Playwright waits by default and fails for a reason that has nothing to do with the * product. Against a built stack these are cheap 200s and 307s. */ const ROUTES = [ '/es', '/en', '/es/login', '/es/registro', '/es/verificar', '/es/inicio', '/es/bandeja', '/es/comprobantes', '/es/comprobantes/nuevo', '/es/declaraciones', '/es/vencimientos', '/es/escanear', '/es/perfil', '/es/configuracion', '/es/consentimiento', '/es/usuarios', '/es/errores', '/es/auditoria', '/en/login', ]; export default async function globalSetup(): Promise { const baseURL = process.env['E2E_BASE_URL'] ?? 'http://localhost:3005'; const context = await request.newContext({ baseURL }); try { for (const route of ROUTES) { // A redirect to sign in is a compiled route, which is all this is after. await context .get(route, { failOnStatusCode: false, timeout: 120_000 }) .catch(() => undefined); } } finally { await context.dispose(); } }