Bugzilla – Attachment 179171 Details for
Bug 38108
Make display of table filters in staff interface holdings table configurable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38108: Add Cypress tests
Bug-38108-Add-Cypress-tests.patch (text/plain), 8.46 KB, created by
Jonathan Druart
on 2025-03-11 15:57:00 UTC
(
hide
)
Description:
Bug 38108: Add Cypress tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-03-11 15:57:00 UTC
Size:
8.46 KB
patch
obsolete
>From be4377813c624e8115f648ed5cc6d85407a01b66 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 11 Mar 2025 16:55:39 +0100 >Subject: [PATCH] Bug 38108: Add Cypress tests > >--- > t/cypress/integration/KohaTable_spec.ts | 151 +++++++++++++++++------- > 1 file changed, 111 insertions(+), 40 deletions(-) > >diff --git a/t/cypress/integration/KohaTable_spec.ts b/t/cypress/integration/KohaTable_spec.ts >index 55eeffb0a02..efced8e4b6e 100644 >--- a/t/cypress/integration/KohaTable_spec.ts >+++ b/t/cypress/integration/KohaTable_spec.ts >@@ -591,9 +591,23 @@ describe("Hit all tables", () => { > }); > }); > }); >+ cy.query( >+ "SELECT value FROM systempreferences WHERE variable='AlwaysShowHoldingsTableFilters'" >+ ).then(value => { >+ cy.wrap(value).as("syspref_AlwaysShowHoldingsTableFilters"); >+ }); > }); > >- afterEach(() => {}); >+ afterEach( >+ () => >+ function () { >+ cleanup(); >+ cy.set_syspref( >+ "AlwaysShowHoldingsTableFilters", >+ this.syspref_AlwaysShowHoldingsTableFilters >+ ); >+ } >+ ); > > it("Correctly init the table", function () { > // Do not use `() => {` or this.biblio_id won't be retrieved >@@ -610,6 +624,7 @@ describe("Hit all tables", () => { > damaged_status: 0, > not_for_loan_status: 0, > course_item: null, >+ cover_image_ids: [], > }, > }).then(items => { > cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`, { >@@ -638,7 +653,6 @@ describe("Hit all tables", () => { > RESTdefaultPageSize > ); > >- cy.get(".show_filters").click(); > cy.get(`#${table_id}_wrapper .dt-info`).contains( > `Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries` > ); >@@ -660,6 +674,7 @@ describe("Hit all tables", () => { > damaged_status: 0, > not_for_loan_status: 0, > course_item: null, >+ cover_image_ids: [], > }, > }).then(items => { > cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`, { >@@ -671,52 +686,108 @@ describe("Hit all tables", () => { > }, > }); > >- cy.visit( >- "/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + >- biblio_id >- ); >+ cy.set_syspref("AlwaysShowHoldingsTableFilters", 0).then(() => { >+ cy.visit( >+ "/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + >+ biblio_id >+ ); > >- // Hide the 'URL' column >- mock_table_settings( >- { >- columns: { uri: { is_hidden: 1 } }, >- }, >- "items_table_settings.holdings" >- ); >+ // Hide the 'URL' column >+ mock_table_settings( >+ { >+ columns: { uri: { is_hidden: 1 } }, >+ }, >+ "items_table_settings.holdings" >+ ); > >- cy.window().then(win => { >- win.libraries_map = items.reduce((map, i) => { >- map[i.library_id] = i.library_id; >- return map; >- }, {}); >+ cy.window().then(win => { >+ win.libraries_map = items.reduce((map, i) => { >+ map[i.library_id] = i.library_id; >+ return map; >+ }, {}); >+ }); >+ >+ cy.get("@columns").then(columns => { >+ cy.get(`#${table_id}_wrapper tbody tr`).should( >+ "have.length", >+ RESTdefaultPageSize >+ ); >+ >+ // Filters are not displayed >+ cy.get(`#${table_id} thead tr`).should( >+ "have.length", >+ 1 >+ ); >+ >+ cy.get(`#${table_id} th`).contains("Status"); >+ cy.get(`#${table_id} th`) >+ .contains("URL") >+ .should("not.exist"); >+ cy.get(`#${table_id} th`) >+ .contains("Course reserves") >+ .should("not.exist"); >+ >+ cy.get(".show_filters").click(); >+ cy.get(`#${table_id}_wrapper .dt-info`).contains( >+ `Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries` >+ ); >+ // Filters are displayed >+ cy.get(`#${table_id} thead tr`).should( >+ "have.length", >+ 2 >+ ); >+ >+ cy.get(`#${table_id} th`).contains("Status"); >+ cy.get(`#${table_id} th`) >+ .contains("URL") >+ .should("not.exist"); >+ cy.get(`#${table_id} th`) >+ .contains("Course reserves") >+ .should("not.exist"); >+ }); > }); > >- cy.get("@columns").then(columns => { >- cy.get(`#${table_id}_wrapper tbody tr`).should( >- "have.length", >- RESTdefaultPageSize >+ cy.set_syspref("AlwaysShowHoldingsTableFilters", 1).then(() => { >+ cy.visit( >+ "/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + >+ biblio_id > ); > >- cy.get(`#${table_id} th`).contains("Status"); >- cy.get(`#${table_id} th`) >- .contains("URL") >- .should("not.exist"); >- cy.get(`#${table_id} th`) >- .contains("Course reserves") >- .should("not.exist"); >- >- cy.get(".show_filters").click(); >- cy.get(`#${table_id}_wrapper .dt-info`).contains( >- `Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries` >+ // Hide the 'URL' column >+ mock_table_settings( >+ { >+ columns: { uri: { is_hidden: 1 } }, >+ }, >+ "items_table_settings.holdings" > ); > >- cy.get(`#${table_id} th`).contains("Status"); >- cy.get(`#${table_id} th`) >- .contains("URL") >- .should("not.exist"); >- cy.get(`#${table_id} th`) >- .contains("Course reserves") >- .should("not.exist"); >+ cy.window().then(win => { >+ win.libraries_map = items.reduce((map, i) => { >+ map[i.library_id] = i.library_id; >+ return map; >+ }, {}); >+ }); >+ >+ cy.get("@columns").then(columns => { >+ cy.get(`#${table_id}_wrapper tbody tr`).should( >+ "have.length", >+ RESTdefaultPageSize >+ ); >+ >+ // Filters are displayed >+ cy.get(`#${table_id} thead tr`).should( >+ "have.length", >+ 2 >+ ); >+ >+ cy.get(".hide_filters").click(); >+ >+ // Filters are not displayed >+ cy.get(`#${table_id} thead tr`).should( >+ "have.length", >+ 1 >+ ); >+ }); > }); > }); > }); >-- >2.34.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 38108
:
178638
|
178639
|
178691
|
178692
|
178694
|
178695
|
178696
| 179171