From 0af06dc5f3d8bfa12319c7f35f242ed57b4e9534 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 30 Mar 2026 09:28:38 +0100 Subject: [PATCH] Bug 41368: Fix ManageMarcImport Cypress test timing issue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace the no-op `#job_callback` existence check with a recursive `cy.wait('@jobPoll')` that loops through each `/api/v1/jobs/*` poll response (arriving every ~1s) until it sees `status: finished`. This avoids any fixed timeout — the test proceeds as soon as the API signals completion, however long that takes on a given machine. Signed-off-by: Lucas Gass (cherry picked from commit c513dee502a0a65819adc9c5df70f5fc8e2b6a4e) Signed-off-by: Jacob O'Mara --- t/cypress/integration/Tools/ManageMarcImport_spec.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/t/cypress/integration/Tools/ManageMarcImport_spec.ts b/t/cypress/integration/Tools/ManageMarcImport_spec.ts index c5f61f4329..43df8625e9 100644 --- a/t/cypress/integration/Tools/ManageMarcImport_spec.ts +++ b/t/cypress/integration/Tools/ManageMarcImport_spec.ts @@ -68,9 +68,17 @@ describe("loads the manage MARC import page", () => { .select("ignore", { force: true }) .should("have.value", "ignore"); + cy.intercept("GET", "/api/v1/jobs/*").as("jobPoll"); cy.get("#mainformsubmit").click(); - cy.get("#job_callback").should("exist"); + const waitForJobFinished = () => { + cy.wait("@jobPoll").then(interception => { + if (interception.response?.body?.status !== "finished") { + waitForJobFinished(); + } + }); + }; + waitForJobFinished(); cy.get("#job_callback").contains("View batch").click();