From 3c3ff65ab504ca3216b92bdf5f1d765a9e472ef5 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Mon, 30 Mar 2026 15:24:37 +0000 Subject: [PATCH] Bug 41247: (QA follow-up): Update cypress test This cleans up the now removed XML changes and improves the clean-up process to only delete the illbatches created during testing as well as uninstalling the plugin through the UI instead of all plugins through a database query The original XML based implementation is no longer relevant as plugins_restricted is now default 0 in ktd. Signed-off-by: Jonathan Druart Signed-off-by: Lucas Gass --- t/cypress/integration/ILL/Batches_spec.ts | 89 +++++++++-------------- 1 file changed, 33 insertions(+), 56 deletions(-) diff --git a/t/cypress/integration/ILL/Batches_spec.ts b/t/cypress/integration/ILL/Batches_spec.ts index fd4cb16710..a887349e9c 100644 --- a/t/cypress/integration/ILL/Batches_spec.ts +++ b/t/cypress/integration/ILL/Batches_spec.ts @@ -125,35 +125,33 @@ const parse_to_ill_response = { }; const batchstatuses = [ - { - "code": "NEW", - "id": 1, - "is_system": true, - "name": "New" - }, - { - "code": "IN_PROGRESS", - "id": 2, - "is_system": true, - "name": "In progress" - }, - { - "code": "COMPLETED", - "id": 3, - "is_system": true, - "name": "Completed" - }, - { - "code": "UNKNOWN", - "id": 4, - "is_system": true, - "name": "Unknown" - } + { + code: "NEW", + id: 1, + is_system: true, + name: "New", + }, + { + code: "IN_PROGRESS", + id: 2, + is_system: true, + name: "In progress", + }, + { + code: "COMPLETED", + id: 3, + is_system: true, + name: "Completed", + }, + { + code: "UNKNOWN", + id: 4, + is_system: true, + name: "Unknown", + }, ]; describe("ILL Batches", () => { - let original_plugin_restricted; - let kohaconf = "/etc/koha/sites/kohadev/koha-conf.xml"; beforeEach(() => { cy.login(); cy.task("query", { @@ -162,21 +160,8 @@ describe("ILL Batches", () => { cy.wrap(rows[0].value).as("syspref_ILLModule"); }); cy.set_syspref("ILLModule", 1); - cy.task("readXmlElementValue", { - filePath: kohaconf, - element: "plugins_restricted", - }).then(value => { - original_plugin_restricted = value; - if (value == "1") { - cy.task("modifyXmlElement", { - filePath: kohaconf, - element: "plugins_restricted", - value: "0", - }); - } - }); cy.title().should("eq", "Koha staff interface"); - cy.get("a.icon_administration").contains("Koha administration").click(); + cy.get("a.icon_administration").contains("Administration").click(); cy.get("a").contains("Manage plugins").click(); cy.get("a#upload_plugin").contains("Upload plugin").click(); @@ -188,30 +173,22 @@ describe("ILL Batches", () => { cy.intercept("GET", "/api/v1/ill/batchstatuses", { statusCode: 200, - body: batchstatuses + body: batchstatuses, }).as("get-batchstatuses"); - }); afterEach(function () { //Restore ILLModule sys pref original value cy.set_syspref("ILLModule", this.syspref_ILLModule); - //Restore plugins_restricted original value - cy.task("modifyXmlElement", { - filePath: kohaconf, - element: "plugins_restricted", - value: original_plugin_restricted, - }); //Clean-up created test batches cy.task("query", { - sql: "DELETE from illbatches", - }); - //Clean-up installed plugin(s) - cy.task("query", { - sql: "DELETE from plugin_data", - }); - cy.task("query", { - sql: "DELETE from plugin_methods", + sql: "DELETE from illbatches where name IN ('test batch', 'second test batch')", }); + //Uninstall plugin + cy.visit("/cgi-bin/koha/plugins/plugins-home.pl"); + cy.get('.actions .btn-group.dropup a[id*="Pubmed"]') + .contains("Actions") + .click(); + cy.get(".dropdown-item.uninstall_plugin").click(); }); it("ILL requests batch modal", function () { cy.visit("/cgi-bin/koha/mainpage.pl");