fix: update health check URL in Jenkinsfile and reduce wait times in e2e tests

- Changed health check URL from localhost:8000 to localhost:3467 in Jenkinsfile.
- Reduced wait times in various e2e tests to improve performance and responsiveness.
- Cleaned up logging in middleware.py by removing unnecessary log statement.

These changes aim to enhance the CI pipeline efficiency and streamline the testing process.
This commit is contained in:
2026-05-22 16:23:29 -05:00
parent b10e6be860
commit 1249c54738
3 changed files with 47 additions and 49 deletions

2
Jenkinsfile vendored
View File

@@ -626,7 +626,7 @@ pipeline {
sshCommand remote: remote, command: '''
set -euo pipefail
for i in $(seq 1 12); do
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" http://localhost:8000/api/health 2>/dev/null || true)
STATUS=$(curl -sf -o /dev/null -w "%{http_code}" http://localhost:3467/api/health 2>/dev/null || true)
if [ "$STATUS" = "200" ]; then
echo "Smoke test OK — HTTP $STATUS"
exit 0

View File

@@ -186,9 +186,7 @@ class LicenseValidationMiddleware(BaseHTTPMiddleware):
"message": "Error interno al contactar el servicio de licencias.",
"status_code": 500,
}
)
logger.info(f"🔑 verify-license → status={response.status_code} body={response.text[:300]}")
)
if response.status_code == 404:
# Endpoint no existe en este Hub — dejar pasar

View File

@@ -49,7 +49,7 @@ async function fillInput(page: Page, selector: string, value: string) {
el.dispatchEvent(new Event('input', { bubbles: true }))
el.dispatchEvent(new Event('change', { bubbles: true }))
}, { sel: selector, val: value })
await page.waitForTimeout(2000)
await page.waitForTimeout(300)
}
async function fillTextarea(page: Page, selector: string, value: string) {
@@ -81,7 +81,7 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
await page.locator('#type').click()
await page.getByRole('option', { name: 'Proveedor' }).click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('button', { name: /Guardar Socio|Actualizar Socio/ }).click()
@@ -103,7 +103,7 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
await page.locator('#type').click()
await page.getByRole('option', { name: 'Cliente' }).click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('button', { name: /Guardar Socio|Actualizar Socio/ }).click()
@@ -144,7 +144,7 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
await expect(page.getByRole('heading', { name: 'Nuevo Tipo de Cambio' })).toBeVisible()
await page.locator('#date').fill(TODAY)
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await fillInput(page, '#value', '17.5')
@@ -163,7 +163,7 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
const prereqModal = page.getByRole('button', { name: /Continuar|Aceptar/ })
if (await prereqModal.isVisible()) await prereqModal.click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
// Año — input con id estable
await fillInput(page, '#year', PEDIMENTO_YEAR)
@@ -171,36 +171,36 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
// Aduana — bits-ui Select, 1er trigger de la fila superior
const triggers = page.locator('[data-select-trigger]')
await triggers.nth(0).click()
await page.waitForTimeout(2000)
await page.waitForTimeout(800)
await page.getByRole('option').first().click()
await page.waitForTimeout(1000)
await page.waitForTimeout(500)
// Patente — bits-ui Select, 2do trigger
await triggers.nth(1).click()
await page.waitForTimeout(2000)
await page.waitForTimeout(800)
await page.getByRole('option').first().click()
await page.waitForTimeout(1000)
await page.waitForTimeout(500)
// Número de pedimento — input con id estable
await fillInput(page, '#pedimento_number', PEDIMENTO_NUMBER)
// Clave — bits-ui Select, 3er trigger
await triggers.nth(2).click()
await page.waitForTimeout(2000)
await page.waitForTimeout(800)
await page.getByRole('option').first().click()
await page.waitForTimeout(1000)
await page.waitForTimeout(500)
// Tipo de Operación — bits-ui Select, 4to trigger
await triggers.nth(3).click()
await page.waitForTimeout(2000)
await page.waitForTimeout(800)
await page.getByRole('option').first().click()
await page.waitForTimeout(1000)
await page.waitForTimeout(500)
// Régimen — bits-ui Select, 5to trigger
await triggers.nth(4).click()
await page.waitForTimeout(2000)
await page.waitForTimeout(800)
await page.getByRole('option').first().click()
await page.waitForTimeout(2000)
await page.waitForTimeout(800)
await page.getByRole('button', { name: /Guardar Todos los Cambios/ }).click()
@@ -217,42 +217,42 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
const prereqModal = page.getByRole('button', { name: /Continuar|Aceptar/ })
if (await prereqModal.isVisible()) await prereqModal.click()
await page.waitForTimeout(5000)
await page.waitForTimeout(1500)
await page.locator('#invoice_number').click()
await page.keyboard.press('Control+A')
await page.locator('#invoice_number').pressSequentially(INVOICE_NUMBER, { delay: 1000 })
await page.locator('#invoice_number').pressSequentially(INVOICE_NUMBER, { delay: 50 })
await page.waitForTimeout(5000)
await page.waitForTimeout(1500)
await page.locator('#invoice_date').fill(TODAY)
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('tab', { name: /General/ }).click()
await page.waitForTimeout(5000)
await page.waitForTimeout(1500)
await page.locator('#provider_id').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('option').first().click()
await page.locator('#sold_to_id').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('option').first().click()
await page.locator('#shipped_to_id').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('option').first().click()
await page.locator('#customs_broker_id').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('option').first().click()
await page.locator('#aduana').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('option').first().click()
await page.locator('#document_type').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('option').first().click()
await page.getByRole('button', { name: /Guardar Todos los Cambios/ }).click()
@@ -271,7 +271,7 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
await expect(page.locator('main')).toBeVisible()
await fillInput(page, '#filter-invoice-number, input[placeholder="No. Factura"]', invoiceNumber)
await page.waitForTimeout(8000)
await page.waitForTimeout(2000)
await expect(page.locator('tbody').getByText(invoiceNumber).first()).toBeVisible({ timeout: 10000 })
})
@@ -294,34 +294,34 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
// Ir a pestaña Partidas
await page.getByRole('tab', { name: /Partidas/ }).click()
await page.waitForTimeout(3000)
await page.waitForTimeout(800)
// Abrir sheet de nueva partida
await page.getByRole('button', { name: /Agregar Partidas/ }).click()
await page.waitForTimeout(3000)
await page.waitForTimeout(1000)
// Clase — abre un dialog de búsqueda con tabla, scopear al dialog activo
await page.locator('#clase').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(800)
// El dialog de clase tiene data-nested y está encima del sheet
// Scopear al último dialog abierto para evitar que el sheet intercepte
const claseDialog = page.locator('[data-dialog-content]').last()
await claseDialog.locator('tbody tr').first().click()
await page.waitForTimeout(2000)
await page.waitForTimeout(500)
// Unidad de medida — mismo patron
await page.locator('#um').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(800)
const umDialog = page.locator('[data-dialog-content]').last()
await umDialog.locator('tbody tr').first().click()
await page.waitForTimeout(2000)
await page.waitForTimeout(500)
// País de origen — abre dialog con tabla igual que clase y UM
await page.locator('#pais_origen').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(800)
const paisDialog = page.locator('[data-dialog-content]').last()
await paisDialog.locator('tbody tr').first().click()
await page.waitForTimeout(2000)
await page.waitForTimeout(500)
// Cantidad
await fillInput(page, '#cantidad', '10')
@@ -339,7 +339,7 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
// Guardar partida — botón "Crear" dentro del sheet
const sheet = page.locator('[data-slot="sheet-content"]')
await sheet.getByRole('button', { name: /^(Crear|Guardar)$/i }).click()
await page.waitForTimeout(3000)
await page.waitForTimeout(800)
// Verificar que la partida aparece en la tabla
await expect(page.locator('tbody').first()).toBeVisible({ timeout: 10000 })
@@ -368,18 +368,18 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
await expect(page.getByText(/Factura #/)).toBeVisible()
await page.getByRole('tab', { name: /General/ }).click()
await page.waitForTimeout(5000)
await page.waitForTimeout(1500)
await page.locator('#customs_broker_id').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('option').first().click()
await page.locator('#aduana').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('option').first().click()
await page.locator('#document_type').click()
await page.waitForTimeout(3000)
await page.waitForTimeout(500)
await page.getByRole('option').first().click()
await page.getByRole('button', { name: /Guardar Todos los Cambios/ }).click()
@@ -404,13 +404,13 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
// Ir a pestaña Partidas
await page.getByRole('tab', { name: /Partidas/ }).click()
await page.waitForTimeout(3000)
await page.waitForTimeout(800)
// Abrir sheet de edición — la fila de la partida contiene "E2E01"; el primer botón
// de la cell de acciones es editar.
const partidaRow = page.locator('tbody tr').filter({ hasText: 'E2E01' }).first()
await partidaRow.locator('button').first().click({ force: true, timeout: 10000 })
await page.waitForTimeout(3000)
await page.waitForTimeout(1000)
// Modificar cantidad
await fillInput(page, '#cantidad', '20')
@@ -421,7 +421,7 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
// Guardar partida editada — botón "Actualizar" dentro del sheet
const sheetEdit = page.locator('[data-slot="sheet-content"]')
await sheetEdit.getByRole('button', { name: /^(Actualizar|Guardar)$/i }).click()
await page.waitForTimeout(3000)
await page.waitForTimeout(800)
// Guardar factura completa
await page.getByRole('button', { name: /Guardar Todos los Cambios/ }).click()
@@ -440,11 +440,11 @@ test.describe('Flujo completo — creacion y actualizacion de factura', () => {
// Seleccionar la fila
await page.locator('tbody tr').first().click()
await page.waitForTimeout(2000)
await page.waitForTimeout(800)
// Click en boton Actualizar del footer — tiene h-8, gap-1.5 y border
await page.locator('button.h-8:has([class*="lucide-refresh"])').click()
await page.waitForTimeout(5000)
await page.waitForTimeout(1500)
// Verificar resultado
await expect(page.getByText(/actualiz|procesad|exito/i).first()).toBeVisible({ timeout: 20000 })