Bug 40046: Use xml and auto-select it

Absolutely no idea why the previous code was not selecting MARCXML (MARC
was passed and so the import failed)

        cy.get('select[name="format"]')
            .select("MARCXML", { force: true })
            .should("have.value", "MARCXML");

But I found a bug in the JS code: we are supposed to auto-detect .xml
file and pre-select MARCXML. So let's rely on that behaviour!

sample.mrc is actually an xml file so it makes sense to rename it

Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 0802e46e18)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Jonathan Druart 2025-06-12 13:35:42 +02:00 committed by Paul Derscheid
parent b8709b9df0
commit 3c7ddb4070
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
3 changed files with 4 additions and 6 deletions

View File

@ -471,7 +471,7 @@
$('#fileuploadbutton').show();
$("#fileuploadcancel").hide();
var filename=$('#fileToUpload').prop('files')[0].name;
if( filename.match( new RegExp(/\.[^.]+xml$/) ) ) {
if( filename.match( new RegExp(/[^.]+\.xml$/) ) ) {
$('#format').val('MARCXML');
}
$("#processfile").show();

View File

@ -27,8 +27,8 @@ describe("loads the manage MARC import page", () => {
it("upload a MARC record", () => {
cy.visit("/cgi-bin/koha/tools/stage-marc-import.pl");
cy.fixture("sample.mrc", null).as("sample_mrc");
cy.get("input[type=file]").selectFile("@sample_mrc");
cy.fixture("sample.xml", null).as("sample_xml");
cy.get("input[type=file]").selectFile("@sample_xml");
cy.get("#fileuploadbutton").click();
cy.get("#fileuploadstatus").contains("100%");
@ -51,9 +51,7 @@ describe("loads the manage MARC import page", () => {
"always_add"
);
cy.get('select[name="format"]')
.select("MARCXML", { force: true })
.should("have.value", "MARCXML");
cy.get('select[name="format"]').should("have.value", "MARCXML");
//select some new options
cy.get("#matcher").select("3", { force: true });