From 2dfa858d054c967eaa57745c9e19ae4db62dd713 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 Signed-off-by: Katrin Fischer (cherry picked from commit da75bdc69206dbb710f54a8e3562e33f01e82b43) Signed-off-by: Paul Derscheid (cherry picked from commit 0b9c7a09d3ee3c3ff86aced160d5b4832631362d) Signed-off-by: Fridolin Somers --- .../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 6e9194967e..035404c11a 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(); + }); + }); }); });