Fix unstable concept page tests (mapping headers and copy functionality)#1906
Conversation
…ues in the output, not just pass/fail status, even when the test passes so that it is possible to observe what happens in cases of timeouts and incomplete strings
…for spinners and mapping properties and also add heading verification and wait fors for partial loads related to the Notation Clipboard
Notes and clarifications for the reviewerMapping-related tests were failing rather often with AssertionError. Why? The object tested strings but a null was given (the issue was identified after temporarily adding logging). The cause: race conditions in partial page loads where DOM elements were accessed before fully loaded. Changes Madeconcept-full-vs-partial.cy.js
Summa summarum:
concept.cy.js
Summa Summarum: Replaces .contains('text') with .invoke('text').should('contain', 'text') for explicit text checking and adds stabilization waits after spinner checks. Adds explicit waits for mapping labels (20 s timeout) and adds heading verification for partial page loads before accessing content.
Post Scriptum: |
osma
left a comment
There was a problem hiding this comment.
Thanks for the PR, it's good to get rid of the flaky tests.
I gave a couple of comments related to cy.wait() operations. I hope that we wouldn't have to use cy.wait() because it always slows down the tests and generally doesn't address the root cause.
I'm not a big fan of the "NOTE: we need to increase the timeout" comments, because it should be fairly obvious that when a large timeout is set, there is a reason for that and that reason is that something is slow. But if you think this makes the tests clearer, I'm OK with that.
…al reloading of the mapping + add a wait for the actual appearance of the copy-notation button
…r sign') to wait for the actual content, not just the element structure.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1906 +/- ##
=========================================
Coverage 70.32% 70.32%
Complexity 1658 1658
=========================================
Files 34 34
Lines 4364 4364
=========================================
Hits 3069 3069
Misses 1295 1295 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…til at least one element appears
|



Reasons for creating this PR
Inconsistently behaving tests make development harder and reduce confidence in the test results which can eventually impact the quality of the code and the application.
Link to relevant issue(s), if any
Description of the changes in this PR
Mostly added timeouts in appropriate places to ensure elements are fully loaded before being asserted and improved robustness and explicitness (e.g. .invoke())
Known problems or uncertainties in this PR
Checklist
.sr-onlyclass, color contrast)