From e82a3c7f96b97a6a24d82d9bfcc576bf3d18b275 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 25 May 2026 07:48:02 +0200 Subject: [PATCH] Bug 42666: Add a Cypress test Signed-off-by: Jonathan Druart Signed-off-by: David Nind Signed-off-by: Jonathan Druart Signed-off-by: Pedro Amorim --- .../integration/KohaTable/KohaTable_spec.ts | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/t/cypress/integration/KohaTable/KohaTable_spec.ts b/t/cypress/integration/KohaTable/KohaTable_spec.ts index 04877ba5ce..783cdf02eb 100644 --- a/t/cypress/integration/KohaTable/KohaTable_spec.ts +++ b/t/cypress/integration/KohaTable/KohaTable_spec.ts @@ -589,3 +589,46 @@ describe("ERM ", () => { }); }); }); + +describe("Itemtypes", () => { + beforeEach(() => { + cy.login(); + cy.title().should("eq", "Koha staff interface"); + cy.task("buildSampleObjects", { + object: "item_type", + count: RESTdefaultPageSize, + }).then(itemtypes => { + itemtypes.forEach(itemtype => { + cy.task("insertObject", { + type: "item_type", + object: itemtype, + }); + }); + cy.wrap(itemtypes).as("itemtypes"); + }); + }); + + afterEach(function () { + cy.task("deleteSampleObjects", [this.itemtypes]); + }); + + const table_id = "table_item_type"; + it("Next && pageLength", function () { + cy.visit("/cgi-bin/koha/admin/itemtypes.pl"); + + cy.task("query", { + sql: "SELECT COUNT(*) as count FROM itemtypes", + }).then(result => { + cy.get(`#${table_id}_wrapper .dt-info`).contains( + `Showing 1 to 10 of ${result[0].count} entries` + ); + + cy.get( + `#${table_id}_wrapper .top.pager .dt-paging-button.next` + ).click(); + cy.get(`#${table_id}_wrapper .dt-info`).contains( + `Showing 11 to 20 of ${result[0].count} entries` + ); + }); + }); +});