Bugzilla – Attachment 187648 Details for
Bug 40981
KohaTable/Holdings_spec.ts is failing randomly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40981: Prevent KohaTable/Holdings_spec.ts to fail randomly
Bug-40981-Prevent-KohaTableHoldingsspects-to-fail-.patch (text/plain), 4.46 KB, created by
Jonathan Druart
on 2025-10-09 09:55:11 UTC
(
hide
)
Description:
Bug 40981: Prevent KohaTable/Holdings_spec.ts to fail randomly
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-10-09 09:55:11 UTC
Size:
4.46 KB
patch
obsolete
>From 9c6540d2d24cf7b1b457f55b7f5a4301f22a67f7 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 9 Oct 2025 11:31:26 +0200 >Subject: [PATCH] Bug 40981: Prevent KohaTable/Holdings_spec.ts to fail > randomly > >There is a JS warning raised by DT which makes the tests fail: >``` >The following error originated from your application code, not from Cypress. > > > DataTables warning detected in log: "DataTables warning: table id=holdings_table - Ajax error. For more information about this error, please see https://datatables.net/tn/7" >``` > >It is caused by a 404 returned by the API, because DT receives the >response during the afterEach (after the objects have been deleted) > >We must wait for the responses when needed. > >Test plan: > cypress run --spec t/cypress/integration/KohaTable/Holdings_spec.ts >should still pass >--- > .../integration/KohaTable/Holdings_spec.ts | 24 +++++++++++++++++++ > 1 file changed, 24 insertions(+) > >diff --git a/t/cypress/integration/KohaTable/Holdings_spec.ts b/t/cypress/integration/KohaTable/Holdings_spec.ts >index 8c77f678308..0b912641fae 100644 >--- a/t/cypress/integration/KohaTable/Holdings_spec.ts >+++ b/t/cypress/integration/KohaTable/Holdings_spec.ts >@@ -34,11 +34,18 @@ describe("catalogue/detail/holdings_table with items", () => { > it("Correctly init the table", function () { > // Do not use `() => {` or this.objects won't be retrieved > const biblio_id = this.objects.biblio.biblio_id; >+ >+ cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`).as( >+ "searchItems" >+ ); >+ > cy.set_syspref("AlwaysShowHoldingsTableFilters", 1).then(() => { > cy.visit( > "/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id > ); > >+ cy.wait("@searchItems"); >+ > cy.get(`#${table_id}_wrapper tbody tr`).should( > "have.length", > RESTdefaultPageSize >@@ -54,6 +61,10 @@ describe("catalogue/detail/holdings_table with items", () => { > // Do not use `() => {` or this.objects won't be retrieved > const biblio_id = this.objects.biblio.biblio_id; > >+ cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`).as( >+ "searchItems" >+ ); >+ > cy.set_syspref("AlwaysShowHoldingsTableFilters", 0).then(() => { > cy.visit( > "/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id >@@ -67,6 +78,8 @@ describe("catalogue/detail/holdings_table with items", () => { > "items_table_settings.holdings" > ); > >+ cy.wait("@searchItems"); >+ > cy.get("@columns").then(columns => { > cy.get(`#${table_id}_wrapper tbody tr`).should( > "have.length", >@@ -83,6 +96,7 @@ describe("catalogue/detail/holdings_table with items", () => { > .should("not.exist"); > > cy.get(`.${table_id}_table_controls .show_filters`).click(); >+ cy.wait("@searchItems"); > cy.get(`#${table_id}_wrapper .dt-info`).contains( > `Showing 1 to ${RESTdefaultPageSize} of ${baseTotalCount} entries` > ); >@@ -110,6 +124,8 @@ describe("catalogue/detail/holdings_table with items", () => { > "items_table_settings.holdings" > ); > >+ cy.wait("@searchItems"); >+ > cy.get("@columns").then(columns => { > cy.get(`#${table_id}_wrapper tbody tr`).should( > "have.length", >@@ -120,6 +136,7 @@ describe("catalogue/detail/holdings_table with items", () => { > cy.get(`#${table_id} thead tr`).should("have.length", 2); > > cy.get(`.${table_id}_table_controls .hide_filters`).click(); >+ cy.wait("@searchItems"); > > // Filters are not displayed > cy.get(`#${table_id} thead tr`).should("have.length", 1); >@@ -290,8 +307,15 @@ describe("catalogue/detail/holdings_table without items", () => { > // Do not use `() => {` or this.objects won't be retrieved > const biblio_id = this.objects.biblio.biblio_id; > >+ cy.intercept("get", `/api/v1/biblios/${biblio_id}/items*`).as( >+ "searchItems" >+ ); >+ > cy.visit("/cgi-bin/koha/catalogue/detail.pl?biblionumber=" + biblio_id); > >+ // No API request >+ cy.get("@searchItems.all").should("have.length", 0); >+ > cy.get(`#${table_id}_wrapper`).should("not.exist"); > }); > }); >-- >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 40981
:
187647
|
187648
|
187658