From 6030ee2f160855f7f7506119c9a616afc0bac3e1 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 11 Jun 2025 15:19:12 +0000 Subject: [PATCH] Bug 40118: Add cypress cypress run --spec t/cypress/integration/KohaTable/Holdings_spec.ts --- .../integration/KohaTable/Holdings_spec.ts | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/t/cypress/integration/KohaTable/Holdings_spec.ts b/t/cypress/integration/KohaTable/Holdings_spec.ts index 25928874b1b..2a6796137b4 100644 --- a/t/cypress/integration/KohaTable/Holdings_spec.ts +++ b/t/cypress/integration/KohaTable/Holdings_spec.ts @@ -1,6 +1,55 @@ const RESTdefaultPageSize = "20"; // FIXME Mock this const baseTotalCount = "42"; +describe("circ/pendingreserves/holdst", () => { + const table_id = "holdst"; + beforeEach(() => { + cy.login(); + cy.title().should("eq", "Koha staff interface"); + cy.query("DELETE FROM reserves;"); + cy.query( + "INSERT INTO reserves (reserve_id, borrowernumber, reservedate, biblionumber, deleted_biblionumber, item_group_id, branchcode, desk_id, notificationdate, reminderdate, cancellationdate, cancellation_reason, reservenotes, priority, found, timestamp, itemnumber, waitingdate, expirationdate, patron_expiration_date, lowestPriority, suspend, suspend_until, itemtype, item_level_hold, non_priority) VALUES (1, 51, '2025-06-11', 437, NULL, NULL, 'CPL', NULL, NULL, NULL, NULL, NULL, '', 1, NULL, '2025-06-11 14:05:16', NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, 0, 0), (2, 51, '2025-06-11', 76, NULL, NULL, 'CPL', NULL, NULL, NULL, NULL, NULL, '', 1, NULL, '2025-06-11 14:05:22', NULL, NULL, NULL, NULL, 0, 0, NULL, NULL, 0, 0);" + ); + cy.visit( + "/cgi-bin/koha/circ/pendingreserves.pl?from=2025-06-09&to=2025-06-11&run_report=Submit" + ); + }); + + it("Should render library filters", () => { + cy.get(`#${table_id} thead:first th:nth-child(6)`).should( + "have.text", + "Libraries" + ); + cy.get(`#${table_id} thead:first th:nth-child(6) select`) + .children() + .should("have.length", 4) + .then(options => { + expect(options.eq(0).val()).to.eq(""); + expect(options.eq(1).val()).to.eq("Centerville"); + expect(options.eq(2).val()).to.eq("Fairview"); + expect(options.eq(3).val()).to.eq("Midway"); + }); + }); + + it("Should filter table on library", () => { + cy.get(`#${table_id} thead:first th:nth-child(6) select`).select( + "Fairview" + ); + cy.get(`#${table_id} tbody tr:first td:nth-child(5)`).should( + "contain", + "Nordic roots" + ); + cy.get(`#${table_id} tbody tr:nth-child(2)`).should("not.exist"); + }); + + afterEach( + () => + function () { + cy.query("DELETE FROM reserves;"); + } + ); +}); + describe("catalogue/detail/holdings_table", () => { const table_id = "holdings_table"; beforeEach(() => { -- 2.39.5