Pruebas: apuntar a cualquier despliegue con BASE y no fijar el orden del tabulador

playwright.config.mjs toma BASE del entorno, y cuando no es local no arranca
ningun servidor. Asi la misma suite verifica el portal ya desplegado.

La prueba de teclado esperaba que el segundo Tab cayera en una tarjeta de
acceso; contra un servidor remoto las tarjetas todavia no estaban pintadas y
el foco caia en otra cosa. Ahora espera a que existan, tabula hasta
alcanzarlas y comprueba ademas que el foco se vea.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Uriel Jareth
2026-07-30 00:02:17 -06:00
co-authored by Claude Opus 5
parent 1ae2e9c010
commit 20eb73d4aa
2 changed files with 37 additions and 13 deletions
+18 -9
View File
@@ -1,7 +1,12 @@
import { defineConfig, devices } from '@playwright/test';
// La demo se verifica en WebKit, en escritorio y en un iPhone real de perfil.
// Un solo worker: las pruebas comparten la base de la demo y algunas escriben.
// Por omisión se prueba el portal local. Con BASE apuntando a otra dirección
// se prueba ese despliegue y no se arranca ningún servidor:
// $env:BASE="https://instademo.urieljareth.org"; npx playwright test
const BASE = process.env.BASE ?? 'http://localhost:4180';
const esLocal = BASE.includes('localhost') || BASE.includes('127.0.0.1');
// Un solo worker: las pruebas comparten la base y algunas escriben.
export default defineConfig({
testDir: './tests',
fullyParallel: false,
@@ -9,7 +14,7 @@ export default defineConfig({
retries: 0,
reporter: [['list'], ['html', { open: 'never', outputFolder: 'tests/reporte' }]],
use: {
baseURL: 'http://localhost:4180',
baseURL: BASE,
locale: 'es-MX',
timezoneId: 'America/Mexico_City',
screenshot: 'only-on-failure',
@@ -19,10 +24,14 @@ export default defineConfig({
{ name: 'webkit', use: { ...devices['Desktop Safari'], viewport: { width: 1440, height: 900 } } },
{ name: 'webkit-movil', use: { ...devices['iPhone 13'] } },
],
webServer: {
command: 'node server/index.mjs',
url: 'http://localhost:4180/api/auth/demo',
reuseExistingServer: true,
timeout: 30_000,
},
...(esLocal
? {
webServer: {
command: 'node server/index.mjs',
url: `${BASE}/salud`,
reuseExistingServer: true,
timeout: 30_000,
},
}
: {}),
});