One of the Cypress tests keeps failing randomly on D12. Last today, run #2999 Should correctly display labels.Infinite scroll Should correctly display labels Timed out retrying after 10000ms: `cy.wait()` timed out waiting `10000ms` for the 1st request to the route: `resetDropdown`. No request ever occurred. https://on.cypress.io/wait CypressError: Timed out retrying after 10000ms: `cy.wait()` timed out waiting `10000ms` for the 1st request to the route: `resetDropdown`. No request ever occurred. https://on.cypress.io/wait at cypressErr (http://localhost:8081/__cypress/runner/cypress_runner.js:75187:18) at Object.errByPath (http://localhost:8081/__cypress/runner/cypress_runner.js:75242:10) at checkForXhr (http://localhost:8081/__cypress/runner/cypress_runner.js:134821:84) at <unknown> (http://localhost:8081/__cypress/runner/cypress_runner.js:134844:28) 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/InfiniteScrollSelect_spec.ts:248:11)
Matt, the tests are failing quite consistently for me now. They almost fail all the time, but the error can be different. Always related to a time out. I have noticed a couple of things: * X-Base-Total-Count and X-Total-Count are always 20 when they should be 60 (certainly not the cause of the problem however) * The "delay" (to prevent too many requests) does not work. licenses?_per_page=-1&q=%7B%22me.name%22%3A%7B%22like%22%3A%22%25L%25%22%7D%7D licenses?_per_page=-1&q=%7B%22me.name%22%3A%7B%22like%22%3A%22%25Li%25%22%7D%7D licenses?_per_page=-1&q=%7B%22me.name%22%3A%7B%22like%22%3A%22%25Lic%25%22%7D%7D licenses?_per_page=-1&q=%7B%22me.name%22%3A%7B%22like%22%3A%22%25Lice%25%22%7D%7D licenses?_per_page=-1&q=%7B%22me.name%22%3A%7B%22like%22%3A%22%25Licen%25%22%7D%7D licenses?_per_page=-1&q=%7B%22me.name%22%3A%7B%22like%22%3A%22%25Licens%25%22%7D%7D licenses?_per_page=-1&q=%7B%22me.name%22%3A%7B%22like%22%3A%22%25License%25%22%7D%7D licenses?_per_page=-1&q=%7B%22me.name%22%3A%7B%22like%22%3A%22%25License+%25%22%7D%7D licenses?_per_page=-1&q=%7B%22me.name%22%3A%7B%22like%22%3A%22%25License+5%25%22%7D%7D licenses?_per_page=-1&q=%7B%22me.name%22%3A%7B%22like%22%3A%22%25License+50%25%22%7D%7D
(In reply to Jonathan Druart from comment #1) > Matt, the tests are failing quite consistently for me now. They almost fail > all the time, but the error can be different. Always related to a time out. > > I have noticed a couple of things: > * X-Base-Total-Count and X-Total-Count are always 20 when they should be 60 > (certainly not the cause of the problem however) > > * The "delay" (to prevent too many requests) does not work. We are only using setTimeout (so postponing the request), not implementing a throttle function.
(In reply to Jonathan Druart from comment #2) > (In reply to Jonathan Druart from comment #1) > > Matt, the tests are failing quite consistently for me now. They almost fail > > all the time, but the error can be different. Always related to a time out. > > > > I have noticed a couple of things: > > * X-Base-Total-Count and X-Total-Count are always 20 when they should be 60 > > (certainly not the cause of the problem however) > > > > * The "delay" (to prevent too many requests) does not work. > > We are only using setTimeout (so postponing the request), not implementing a > throttle function. Not the same place, this is for the scroll, not the filtering.
Created attachment 170468 [details] [review] Bug 37620: Improve cypress test to reduce random failures This patch makes some improvements to the Infinite Scroll cypress test to try and prevent random test failures - Fixes X-Base-Count and X-Total-Count for intercepted requests - Makes element selection more precise - Adds an intercepted request returning the requrired result for the filtered search - Awaits this request before selecting an element from the dropdown - Awaits all 10 requests triggered by typing "License 50" rather than just the first one - Ensures that the select dropdown is closed between operations by clicking into another field to remove focus from the select dropdown Test plan: 1) yarn cypress run --spec t/cypress/integration/InfiniteScrollSelect_spec.ts or 1) yarn cypress open and select the InfiniteScrollSelect test from the Cypress GUI
This should offer a substantial improvement, prior to this the test would fail relatively consistently locally, with this patch it passes every time. It will be interesting to see what happens when this is applied to a full test suite run on a Jenkins node
Thanks Matt!
Tested on main locally - tests pass. I'll throw it at Jenkins with the next push :)
Pushed for 24.11! Well done everyone, thank you!
We should actually throttle here, not request on every key press. Also I don't think the "40" are correct in this patch, it should be 60 everywhere (even for page 2 we expect 60 rows in total in DB).
Created attachment 170749 [details] [review] Bug 37620: Improve cypress test to reduce random failures This patch makes some improvements to the Infinite Scroll cypress test to try and prevent random test failures - Fixes X-Base-Count and X-Total-Count for intercepted requests - Makes element selection more precise - Adds an intercepted request returning the requrired result for the filtered search - Awaits this request before selecting an element from the dropdown - Awaits all 10 requests triggered by typing "License 50" rather than just the first one - Ensures that the select dropdown is closed between operations by clicking into another field to remove focus from the select dropdown Test plan: 1) yarn cypress run --spec t/cypress/integration/InfiniteScrollSelect_spec.ts or 1) yarn cypress open and select the InfiniteScrollSelect test from the Cypress GUI
Created attachment 170750 [details] [review] Bug 37620: Fix Total-Count headers
Created attachment 170752 [details] [review] Bug 37620: Fix Total-Count headers Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Pushed follow-up patch to main.
Backported to 24.05.x for upcoming 24.05.04
Depends on Bug 32474 not in 23.11.x