-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue1476 cypress tests for vocab home page tempate statistics #1558
base: main
Are you sure you want to change the base?
Issue1476 cypress tests for vocab home page tempate statistics #1558
Conversation
… added tests for page statistics
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## skosmos-3 #1558 +/- ##
============================================
Coverage 70.53% 70.53%
Complexity 1643 1643
============================================
Files 32 32
Lines 4313 4313
============================================
Hits 3042 3042
Misses 1271 1271 ☔ View full report in Codecov by Sentry. |
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
I looked at this and was able to replicate the occasional text failure. Here is example log output from Cypress: It looks like this test revealed a race condition in the alphabetical index Vue component. It starts loading the index entries for the letter A, but the user (here simulated by Cypress) clicks on D before that operation has finished. This leads to a race condition with both requests (for A and D) happening in parallel, and depending on the order in which they finish, the index will contain either 8 or 33 entries. The test expects 8, so it will fail if there are 33 entries. This is probably a more general problem with all kinds of asynchronous operations performed by Vue components. We should have some sort of queue mechanism, or a way to cancel/invalidate previous operations. In this case, when the user clicks on D before the request for A has finished, it would make sense to cancel the request for A. |
In Skosmos 2, similar cancellations and race conditions were handled by using a queue for Ajax requests. This implementation of course relies on jQuery functionality, which doesn't exist in Skosmos 3, so another solution is needed. Skosmos/resource/js/scripts.js Lines 86 to 136 in 88c2c78
|
I think we now have four different ways to proceed with this problem:
Which approach would you suggest @osma ? |
I think we need a new issue for the race condition. It is unrelated to the tests in this PR, so we can proceed with finishing up this PR. |
Reasons for creating this PR
All tests pass (including the new ones related to statistics), except for the "alphabetical index letters are clickable" test, which fails randomly. It sometimes passes if the entire vocab-home test is run again, but after making changes to the test, it sometimes fails and sometimes does not when run separately. I suspect it is related to some clicking issue.
This is an early-stage draft PR, so it does not aim to meet code formatting requirements or have sufficient descriptions. The code will be commented later.
Link to relevant issue(s), if any
Description of the changes in this PR
Known problems or uncertainties in this PR
Checklist
.sr-only
class, color contrast)