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 <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2026-06-08 11:18:29 +00:00 committed by Lucas Gass
parent b8fab422f4
commit 838fa2f78b
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 8 additions and 1 deletions

View File

@ -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).