From e44a364c671ebfcda0793c3098658ef2156b09a7 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 22 Apr 2025 14:40:42 +0200 Subject: [PATCH] Bug 39473: Add Cypress tests --- .../integration/KohaTable/Holdings_spec.ts | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/t/cypress/integration/KohaTable/Holdings_spec.ts b/t/cypress/integration/KohaTable/Holdings_spec.ts index 869d01e136d..ad194d9b158 100644 --- a/t/cypress/integration/KohaTable/Holdings_spec.ts +++ b/t/cypress/integration/KohaTable/Holdings_spec.ts @@ -362,6 +362,31 @@ describe("catalogue/detail/holdings_table", () => { new RegExp(`"me.item_type_id":\\["${item_type_id}"\\]`) ); }); + + cy.get(`#${table_id}_wrapper input.dt-input`).clear(); + // Show filters if not there already + cy.get(`.${table_id}_table_controls .show_filters`).then(link => { + if (link.is(":visible")) { + cy.wrap(link).click(); + cy.wait("@searchItems"); + } + }); + // Select first (non-empty) option + cy.get(`#${table_id}_wrapper th#holdings_itype select`).then( + select => { + item_type_id = select.find("option").eq(1).val(); + expect(item_type_id).to.match(/^\^/); + expect(item_type_id).to.match(/\$$/); + cy.wrap(select).select(item_type_id); + item_type_id = item_type_id.replace(/^\^|\$$/g, ""); // remove ^ and $ + } + ); + cy.wait("@searchItems").then(interception => { + const q = interception.request.query.q; + expect(q).to.match( + new RegExp(`{"me.item_type_id":"${item_type_id}"}`) + ); + }); }); }); }); -- 2.34.1