From 125416a92d6504c87f874e67f45a6fb5d69fa1b6 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 1 Jun 2026 12:44:17 +0000 Subject: [PATCH] Bug 42733: Add tests Apply tests patch only, run: yarn cypress run --spec t/cypress/integration/Tools/ManageMarcImport_spec.ts Confirm it fails with the same error as Jenkins: Timed out retrying after 10000ms: `cy.wait()` timed out waiting `10000ms` for the 2nd request to the route: `jobPoll`. No request ever occurred. Apply fix patch. Run again. Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass --- .../Tools/ManageMarcImport_spec.ts | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/t/cypress/integration/Tools/ManageMarcImport_spec.ts b/t/cypress/integration/Tools/ManageMarcImport_spec.ts index 86cd322323..3d4066b2fa 100644 --- a/t/cypress/integration/Tools/ManageMarcImport_spec.ts +++ b/t/cypress/integration/Tools/ManageMarcImport_spec.ts @@ -68,12 +68,28 @@ describe("loads the manage MARC import page", () => { .select("ignore", { force: true }) .should("have.value", "ignore"); - cy.intercept("GET", "/api/v1/jobs/*").as("jobPoll"); + // CI reproduction — simulates Apache returning 503 on the + // first job poll (as happens during reset_all while Apache is restarting). + // Without the job_progress.js .fail() fix: no retry fires, the 2nd request + // never occurs, and cy.wait() times out — reproducing the exact CI error. + // With the fix: .fail() retries, the 2nd poll goes through, test passes. + let pollCount = 0; + cy.intercept("GET", "/api/v1/jobs/*", req => { + pollCount++; + if (pollCount === 1) { + req.reply({ statusCode: 503, body: {} }); + } else { + req.continue(); + } + }).as("jobPoll"); + cy.get("#mainformsubmit").click(); const waitForJobFinished = () => { cy.wait("@jobPoll").then(interception => { - if (interception.response?.body?.status !== "finished") { + const status = interception.response?.body?.status; + expect(status, "Background job failed").not.to.eq("failed"); + if (status !== "finished") { waitForJobFinished(); } });