From 2ccc5c9f757ef98f851a0ba1bdfc27dc2223cd75 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 8 Jun 2026 11:18:29 +0000 Subject: [PATCH] Bug 42783: Fix ManageMarcImport_spec.ts If import_batch_profiles is slow to respond, it'll trigger select.change() in stage-marc-import.tt and change the format to ISO2709 before the form is submitted, causing the error. cypress run --spec t/cypress/integration/Tools/ManageMarcImport_spec.ts Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass Signed-off-by: Wainui Witika-Park --- t/cypress/integration/Tools/ManageMarcImport_spec.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/t/cypress/integration/Tools/ManageMarcImport_spec.ts b/t/cypress/integration/Tools/ManageMarcImport_spec.ts index 3d4066b2fa..ecca60686b 100644 --- a/t/cypress/integration/Tools/ManageMarcImport_spec.ts +++ b/t/cypress/integration/Tools/ManageMarcImport_spec.ts @@ -25,6 +25,7 @@ describe("loads the manage MARC import page", () => { }); it("upload a MARC record", () => { + cy.intercept("GET", "/api/v1/import_batch_profiles").as("profiles"); cy.visit("/cgi-bin/koha/tools/stage-marc-import.pl"); cy.fixture("sample.xml", null).as("sample_xml"); @@ -51,7 +52,12 @@ describe("loads the manage MARC import page", () => { "always_add" ); - cy.get('select[name="format"]').should("have.value", "MARCXML"); + // Wait for the profiles request to complete before making any + // selections. The getProfiles() callback calls select.change() + // which resets all form values to defaults — including format to + // ISO2709 and matcher to "". Waiting here ensures that reset has + // already fired before we set anything. + cy.wait("@profiles"); //select some new options cy.get("#matcher") @@ -67,6 +73,7 @@ describe("loads the manage MARC import page", () => { cy.get("#item_action") .select("ignore", { force: true }) .should("have.value", "ignore"); + cy.get('select[name="format"]').select("MARCXML"); // CI reproduction — simulates Apache returning 503 on the // first job poll (as happens during reset_all while Apache is restarting).