From 49f8b8e0a493a1338be08e7e426f7129784e032f Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 27 May 2025 10:16:15 +0200 Subject: [PATCH] Bug 40002: Add a cypress test Signed-off-by: Lucas Gass --- .../integration/KohaTable/KohaTable_spec.ts | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/t/cypress/integration/KohaTable/KohaTable_spec.ts b/t/cypress/integration/KohaTable/KohaTable_spec.ts index 6e9194967e7..035404c11ae 100644 --- a/t/cypress/integration/KohaTable/KohaTable_spec.ts +++ b/t/cypress/integration/KohaTable/KohaTable_spec.ts @@ -375,6 +375,38 @@ describe("kohaTable (using REST API)", () => { ); }); }); + + it("Browse by last name", () => { + cy.task("buildSampleObjects", { + object: "patron", + count: RESTdefaultPageSize, + values: {}, + }).then(patrons => { + // Needs more properties to not explode + // account_balace: balance_str.escapeHtml(...).format_price is not a function + patrons = patrons.map(p => ({ ...p, account_balance: 0 })); + + cy.intercept("GET", "/api/v1/patrons*", { + statusCode: 200, + body: patrons, + headers: { + "X-Base-Total-Count": baseTotalCount, + "X-Total-Count": baseTotalCount, + }, + }); + + cy.visit("/cgi-bin/koha/members/members-home.pl"); + + cy.window().then(win => { + win.categories_map = patrons.reduce((map, p) => { + map[p.category_id] = p.category_id; + return map; + }, {}); + }); + + cy.get("#searchresults .browse .filterByLetter:first").click(); + }); + }); }); }); -- 2.39.5