From 7db7879ccc2c2dda1ece63b78a9c5c1e8db819e5 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 15 Jun 2026 16:07:57 +0200 Subject: [PATCH] Bug 41604: Add Cypress tests Signed-off-by: Jason Robb Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Lucas Gass --- .../integration/KohaTable/KohaTable_spec.ts | 55 ++++++++++++++++++- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/t/cypress/integration/KohaTable/KohaTable_spec.ts b/t/cypress/integration/KohaTable/KohaTable_spec.ts index 783cdf02eb..f766fc3a69 100644 --- a/t/cypress/integration/KohaTable/KohaTable_spec.ts +++ b/t/cypress/integration/KohaTable/KohaTable_spec.ts @@ -213,7 +213,7 @@ describe("kohaTable (using REST API)", () => { // default settings: show "Code" cy.mock_table_settings({ default_save_state: 1, - columns: { library_code: { is_hidden: 0 } }, + columns: { library_code: { is_hidden: false } }, }); cy.get("@columns").then(columns => { @@ -246,7 +246,10 @@ describe("kohaTable (using REST API)", () => { cy.mock_table_settings({ default_save_state: 1, columns: { - library_code: { is_hidden: 0, force_visibility: 1 }, + library_code: { + is_hidden: false, + visibility_condition: true, + }, }, }); @@ -266,7 +269,10 @@ describe("kohaTable (using REST API)", () => { cy.mock_table_settings({ default_save_state: 1, columns: { - library_code: { is_hidden: 1, force_visibility: 1 }, + library_code: { + is_hidden: false, + visibility_condition: true, + }, }, }); @@ -283,6 +289,49 @@ describe("kohaTable (using REST API)", () => { }); }); + it("visibility_condition {visibility_condition: true, is_hidden: true}", () => { + build_libraries().then(() => { + cy.visit("/cgi-bin/koha/admin/branches.pl"); + + // default settings: hide "Code" + cy.mock_table_settings({ + default_save_state: 1, + columns: { + library_code: { + visibility_condition: true, + is_hidden: true, + }, + }, + }); + + cy.get("@columns").then(columns => { + cy.get(`#${table_id} th`).should( + "have.length", + columns.length - 1 + ); + cy.get(`#${table_id} th`).contains("Name"); + cy.get(`#${table_id} th`) + .contains("Code") + .should("not.exist"); + }); + + // Do not touch anything + // Should be kept hidden after reload + cy.visit("/cgi-bin/koha/admin/branches.pl"); + + cy.get("@columns").then(columns => { + cy.get(`#${table_id} th`).should( + "have.length", + columns.length - 1 + ); + cy.get(`#${table_id} th`).contains("Name"); + cy.get(`#${table_id} th`) + .contains("Code") + .should("not.exist"); + }); + }); + }); + it("Shareable link", { scrollBehavior: false }, () => { build_libraries().then(() => { cy.visit("/cgi-bin/koha/admin/branches.pl");