Bugzilla – Attachment 175381 Details for
Bug 38632
holdings table - all columns shown when displaying the filters
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38632: Add tests
Bug-38632-Add-tests.patch (text/plain), 6.26 KB, created by
Brendan Lawlor
on 2024-12-11 20:01:14 UTC
(
hide
)
Description:
Bug 38632: Add tests
Filename:
MIME Type:
Creator:
Brendan Lawlor
Created:
2024-12-11 20:01:14 UTC
Size:
6.26 KB
patch
obsolete
>From 7c7b985789de5bb6ca1d372273a236a6d6ec9777 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 9 Dec 2024 12:21:34 +0100 >Subject: [PATCH] Bug 38632: Add tests > >You need bug 38461 to run successfully this test. > >Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org> >--- > .../tables/items/catalogue_detail.inc | 2 +- > t/cypress/integration/KohaTable_spec.ts | 95 +++++++++++++++++-- > 2 files changed, 90 insertions(+), 7 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >index f70f9b716d..189a666643 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers/tables/items/catalogue_detail.inc >@@ -262,7 +262,7 @@ > embed.push('analytics_count'); > [% END %] > >- let items_table_settings = { >+ var items_table_settings = { > holdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','holdings_table','json') | $raw %], > otherholdings: [% TablesSettings.GetTableSettings('catalogue', 'detail','otherholdings_table','json') | $raw %], > }; >diff --git a/t/cypress/integration/KohaTable_spec.ts b/t/cypress/integration/KohaTable_spec.ts >index 2d7fd114c7..7eacab0824 100644 >--- a/t/cypress/integration/KohaTable_spec.ts >+++ b/t/cypress/integration/KohaTable_spec.ts >@@ -22,24 +22,31 @@ function build_libraries() { > }); > } > >-function mock_table_settings(settings) { >+function mock_table_settings(settings, table_settings_var) { > cy.window().then(win => { >- win.table_settings.columns = win.table_settings.columns.map(c => ({ >+ let table_settings = >+ typeof table_settings_var === "undefined" >+ ? win.table_settings >+ : table_settings_var >+ .split(".") >+ .reduce((acc, key) => acc[key], win); >+ >+ table_settings.columns = table_settings.columns.map(c => ({ > ...c, > is_hidden: 0, > cannot_be_toggled: 0, > })); > if (settings && settings.hasOwnProperty("default_save_state")) { >- win.table_settings.default_save_state = settings.default_save_state; >+ table_settings.default_save_state = settings.default_save_state; > } > if (settings && settings.hasOwnProperty("default_save_state_search")) { >- win.table_settings.default_save_state_search = >+ table_settings.default_save_state_search = > settings.default_save_state_search; > } > > if (settings && settings.columns) { > Object.entries(settings.columns).forEach(([name, values]) => { >- let column = win.table_settings.columns.find( >+ let column = table_settings.columns.find( > cc => cc.columnname == name > ); > Object.entries(values).forEach(([prop, value]) => { >@@ -47,9 +54,10 @@ function mock_table_settings(settings) { > }); > }); > } >- cy.wrap(win.table_settings.columns).as("columns"); >+ cy.wrap(table_settings.columns).as("columns"); > }); > } >+ > describe("kohaTable (using REST API)", () => { > beforeEach(() => { > cy.login(); >@@ -528,5 +536,80 @@ describe("Hit all tables", () => { > ); > }); > }); >+ >+ it("Show filters", () => { >+ const biblio_id = 1; >+ cy.task("buildSampleObjects", { >+ object: "item", >+ count: RESTdefaultPageSize, >+ values: { >+ biblio_id, >+ checkout: null, >+ transfer: null, >+ lost_status: 0, >+ withdrawn: 0, >+ damaged_status: 0, >+ not_for_loan_status: 0, >+ course_item: null, >+ }, >+ }).then(items => { >+ cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`, { >+ statuscode: 200, >+ body: items, >+ headers: { >+ "X-Base-Total-Count": baseTotalCount, >+ "X-Total-Count": baseTotalCount, >+ }, >+ }); >+ >+ 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" >+ ); >+ >+ 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 >+ ); >+ >+ 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` >+ ); >+ >+ 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"); >+ }); >+ }); >+ }); > }); > }); >-- >2.39.5
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 38632
:
175296
|
175297
|
175380
| 175381