Summary: | Fix randomly failing tests for cypress/integration/InfiniteScrollSelect_spec.ts | ||
---|---|---|---|
Product: | Koha | Reporter: | Katrin Fischer <katrin.fischer> |
Component: | Test Suite | Assignee: | Matt Blenkinsop <matt.blenkinsop> |
Status: | RESOLVED FIXED | QA Contact: | Testopia <testopia> |
Severity: | normal | ||
Priority: | P5 - low | CC: | david, fridolin.somers, jonathan.druart, lucas, matt.blenkinsop, victor |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36012 | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: |
24.11.00,24.05.04
|
|
Circulation function: | |||
Bug Depends on: | 32474 | ||
Bug Blocks: | 25551, 38475 | ||
Attachments: |
Bug 37620: Improve cypress test to reduce random failures
Bug 37620: Improve cypress test to reduce random failures Bug 37620: Fix Total-Count headers Bug 37620: Fix Total-Count headers |
Description
Katrin Fischer
2024-08-12 13:23:49 UTC
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 Fixes tests, no change to UI, no changes required to the documentation. |