Bug 40051

Summary: cy.wait(delay) should not be used in Cypress tests
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Test SuiteAssignee: Jonathan Druart <jonathan.druart>
Status: Pushed to main --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: pedro.amorim
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
25.11.00
Circulation function:
Bug Depends on: 40046    
Bug Blocks:    
Attachments: Bug 40051: Remove cy.wait(delay) from cypress tests
Bug 40051: Remove cy.wait(delay) from cypress tests
Bug 40051: Remove cy.wait(delay) from cypress tests
Bug 40051: Remove cy.wait(delay) from cypress tests
Bug 40051: Remove 'only' from KohaTable_spec.ts
Bug 40051: Remove cy.wait(delay) from cypress tests
Bug 40051: Remove 'only' from KohaTable_spec.ts

Description Jonathan Druart 2025-06-02 11:49:22 UTC
It can cause random failures. We should rely on the existence of something, Cypress will retry if the test fails.
Comment 1 Jonathan Druart 2025-06-02 11:54:02 UTC
Created attachment 182905 [details] [review]
Bug 40051: Remove cy.wait(delay) from cypress tests

We should not use cy.wait(delay), it's a poor pattern and can cause
random failures.

Test plan:
All cypress tests should still pass after this patchset.

Note that t/cypress/integration/ERM/Titles_spec.ts is currently failing.
Comment 2 Jonathan Druart 2025-06-02 11:55:18 UTC
I've asked Pedro to have a look at Titles_spec.ts.
Comment 3 Jonathan Druart 2025-07-07 12:07:01 UTC
Created attachment 183835 [details] [review]
Bug 40051: Remove cy.wait(delay) from cypress tests

We should not use cy.wait(delay), it's a poor pattern and can cause
random failures.

Test plan:
All cypress tests should still pass after this patchset.

Note that t/cypress/integration/ERM/Titles_spec.ts is currently failing.
Comment 4 Jonathan Druart 2025-07-07 12:11:30 UTC
Created attachment 183836 [details] [review]
Bug 40051: Remove cy.wait(delay) from cypress tests

We should not use cy.wait(delay), it's a poor pattern and can cause
random failures.

Test plan:
All cypress tests should still pass after this patchset.
Comment 5 Jonathan Druart 2025-07-07 12:12:11 UTC
All tests passing now (on top of "Bug 38899: Fix Cypress tests" not pushed yet).
Comment 6 Pedro Amorim 2025-07-08 14:31:21 UTC
Created attachment 183863 [details] [review]
Bug 40051: Remove cy.wait(delay) from cypress tests

We should not use cy.wait(delay), it's a poor pattern and can cause
random failures.

Test plan:
All cypress tests should still pass after this patchset.

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Comment 7 Pedro Amorim 2025-07-08 14:31:23 UTC
Created attachment 183864 [details] [review]
Bug 40051: Remove 'only' from KohaTable_spec.ts

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Comment 8 Pedro Amorim 2025-07-08 14:33:39 UTC
InfiniteScrollSelect_spec.ts failed for me the first time:
  1) Infinite scroll
       Should correctly display labels:
     CypressError: Timed out retrying after 10000ms: `cy.wait()` timed out waiting `10000ms` for the 1st request to the route: `getPageTwo`. No request ever occurred.

But it doesn't seem related to this patchset and I wasn't able to get it to fail again.


Also not related to this patchset, but ManageMarcImport_spec.ts still fails for me consistently (3/3):

  1) loads the manage MARC import page
       upload a MARC record:
     AssertionError: Timed out retrying after 10000ms: Expected to find content: 'View batch' but never did.
Comment 9 Nick Clemens (kidclamp) 2025-08-01 12:37:48 UTC
Created attachment 184999 [details] [review]
Bug 40051: Remove cy.wait(delay) from cypress tests

We should not use cy.wait(delay), it's a poor pattern and can cause
random failures.

Test plan:
All cypress tests should still pass after this patchset.

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 10 Nick Clemens (kidclamp) 2025-08-01 12:37:51 UTC
Created attachment 185000 [details] [review]
Bug 40051: Remove 'only' from KohaTable_spec.ts

Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 11 Lucas Gass (lukeg) 2025-08-01 19:24:52 UTC
Nice work everyone!

Pushed to main for 25.11