-
Notifications
You must be signed in to change notification settings - Fork 1
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
Frontend: Flaky test due to "cannot log after tests are done" error #290
Comments
At least this is an attempt to fix this flaky test as explained here: https://stackoverflow.com/a/61612357 . It's not clear that this will actually help, but it's worth a try. The general idea is that the test should wait until all changes have been processed.
Issue has not been solved with the above commit. https://github.com/cleodora-forecasting/cleodora/actions/runs/4480272259/jobs/7875344833?pr=338 |
Maybe related testing-library/react-testing-library#667 |
Following the instruction found here: https://devtrium.com/posts/async-functions-useeffect
Looking good so far after the latest commit. If there are no failures until the end of May in can be closed. |
It might have become less frequent but the job is still failing https://github.com/cleodora-forecasting/cleodora/actions/runs/5070288233/jobs/9105115234?pr=501 |
Even after running the tests ~500 times locally it did not fail, but it is still failing in GitHub actions. The explanation for that seems to be jestjs/jest#11132 i.e. it only fails in CI but not locally. |
Interesting comment, but the whole thread might be useful: jestjs/jest#9324 (comment) |
I am able to reproduce the issue locally with the following command. The error appears about every 10 executions.
|
Contrary to what I initially believed the issue does not seem to be in the Footer.test.tsx but in App.test.tsx . The error message appears after the Footer.test.tsx output and before the App.test.tsx output. The App test includes all components but was not checking for the footer content. My hypothesis is that when the test was done it tore down the msw handlers making the fetch request for config.json made in the Footer either abort or not be intercepted by msw. What set me on the right track was the following issue, in particular this comment jestjs/jest#9324 (comment) . Before this fix the tests would fail about once every 10 to 40 executions. After this fix the tests failed due to #561 after about 320 and after about 60 executions. There were no more failures because of this issue.
This is related to #290 because the same error could have appeared for this case since nothing was waiting for the table content.
It's probably some sort of race condition.
It happens from time to time e.g. here: https://github.com/cleodora-forecasting/cleodora/actions/runs/4294409786/jobs/7483394228
The text was updated successfully, but these errors were encountered: