Bugzilla – Attachment 182911 Details for
Bug 40043
Agreements_spec.ts is failing randomly (2)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 40043: Try to prevent Agreements_spec.ts to fail randomly
Bug-40043-Try-to-prevent-Agreementsspects-to-fail-.patch (text/plain), 4.28 KB, created by
David Nind
on 2025-06-02 18:53:10 UTC
(
hide
)
Description:
Bug 40043: Try to prevent Agreements_spec.ts to fail randomly
Filename:
MIME Type:
Creator:
David Nind
Created:
2025-06-02 18:53:10 UTC
Size:
4.28 KB
patch
obsolete
>From 8981b371769f2bf7ed269bca3b15367914190366 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 2 Jun 2025 10:50:05 +0200 >Subject: [PATCH] Bug 40043: Try to prevent Agreements_spec.ts to fail randomly > >One test is failing with: >""" >https://on.cypress.io/element-has-detached-from-dom" type="CypressError"><![CDATA[CypressError: Timed out retrying after 10050ms: `cy.click()` failed because the page updated while this command was executing. Cypress tried to locate elements based on this query: > >> <a.show> > >We initially found matching element(s), but while waiting for them to become actionable, they disappeared from the page. Common situations why this happens: > - Your JS framework re-rendered asynchronously > - Your app code reacted to an event firing and removed the element > >You can typically solve this by breaking up a chain. For example, rewrite: > >> `cy.get('button').click().click()` > >to > >> `cy.get('button').as('btn').click()` >> `cy.get('@btn').click()` > >https://on.cypress.io/element-has-detached-from-dom > at retryActionability (http://localhost:8081/__cypress/runner/cypress_runner.js:112246:74) > at tryCatcher (http://localhost:8081/__cypress/runner/cypress_runner.js:1807:23) > at Promise.attempt.Promise.try (http://localhost:8081/__cypress/runner/cypress_runner.js:4315:29) > at whenStable (http://localhost:8081/__cypress/runner/cypress_runner.js:143192:68) > at <unknown> (http://localhost:8081/__cypress/runner/cypress_runner.js:143133:14) > at tryCatcher (http://localhost:8081/__cypress/runner/cypress_runner.js:1807:23) > at Promise._settlePromiseFromHandler (http://localhost:8081/__cypress/runner/cypress_runner.js:1519:31) > at Promise._settlePromise (http://localhost:8081/__cypress/runner/cypress_runner.js:1576:18) > at Promise._settlePromise0 (http://localhost:8081/__cypress/runner/cypress_runner.js:1621:10) > at Promise._settlePromises (http://localhost:8081/__cypress/runner/cypress_runner.js:1701:18) > at Promise._fulfill (http://localhost:8081/__cypress/runner/cypress_runner.js:1645:18) > at <unknown> (http://localhost:8081/__cypress/runner/cypress_runner.js:5450:46) >From Your Spec Code: > at Context.eval (webpack://koha/./t/cypress/integration/ERM/Agreements_spec.ts:630:18)]]></failure> > </testcase> > </testsuite> >""" > >My guess is that it happens because we don't wait for the /agreements >response. > >Test plan: >Test should still pass, we will see how Jenkins behave after it's >pushed. > >Signed-off-by: David Nind <david@davidnind.com> >--- > t/cypress/integration/ERM/Agreements_spec.ts | 14 ++++---------- > 1 file changed, 4 insertions(+), 10 deletions(-) > >diff --git a/t/cypress/integration/ERM/Agreements_spec.ts b/t/cypress/integration/ERM/Agreements_spec.ts >index 6bbcb2cdf3..0b55448ee6 100644 >--- a/t/cypress/integration/ERM/Agreements_spec.ts >+++ b/t/cypress/integration/ERM/Agreements_spec.ts >@@ -569,9 +569,10 @@ describe("Agreement CRUD operations", () => { > "X-Base-Total-Count": "1", > "X-Total-Count": "1", > }, >- }); >+ }).as("get-agreements"); > cy.intercept("GET", "/api/v1/erm/agreements/*", agreement); > cy.visit("/cgi-bin/koha/erm/agreements"); >+ cy.wait("@get-agreements"); > > cy.get("#agreements_list table tbody tr:first") > .contains("Delete") >@@ -608,14 +609,8 @@ describe("Agreement CRUD operations", () => { > > // Delete from show > // Click the "name" link from the list >- cy.intercept("GET", "/api/v1/erm/agreements*", { >- statusCode: 200, >- body: agreements, >- headers: { >- "X-Base-Total-Count": "1", >- "X-Total-Count": "1", >- }, >- }); >+ cy.visit("/cgi-bin/koha/erm/agreements"); >+ cy.wait("@get-agreements"); > cy.intercept("GET", "/api/v1/erm/agreements/*", agreement).as( > "get-agreement" > ); >@@ -629,7 +624,6 @@ describe("Agreement CRUD operations", () => { > name_link.should("have.text", agreement.name); > name_link.click(); > cy.wait("@get-agreement"); >- cy.wait(500); // Cypress is too fast! Vue hasn't populated the form yet! > cy.get("#agreements_show h2").contains( > "Agreement #" + agreement.agreement_id > ); >-- >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 40043
:
182901
| 182911