Bug 41604: Add Cypress tests

Signed-off-by: Jason Robb <jrobb@sekls.org>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2026-06-15 16:07:57 +02:00 committed by Lucas Gass
parent d34a60e585
commit 7db7879ccc
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
1 changed files with 52 additions and 3 deletions

View File

@ -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");