-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[Reporting] Fix browser diagnostic Jest test flakiness #118003
[Reporting] Fix browser diagnostic Jest test flakiness #118003
Conversation
Pinging @elastic/kibana-reporting-services (Team:Reporting Services) |
|
||
const BROWSER_LAUNCH_TIME_TO_WAIT = 5 * 1000; | ||
|
||
export const getBrowserLaunchTime = () => BROWSER_LAUNCH_TIME_TO_WAIT; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the chosen approach is correct. It is not a good idea to have a helper function returning a constant just for unit tests.
Have you tried jest.useFakeTimers
?
If that doesn't work, then the second option will be using RxJS marbles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I'll look into that 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing my feedback! LGTM 👍
@elasticmachine merge upstream |
💚 Build Succeeded
Metrics [docs]
History
To update your PR or re-run it, just comment with: |
* mock and reduce the wait time for reading diagnoistic logs * remove comment * run test suite 42 times - REVERT THIS * Revert "run test suite 42 times - REVERT THIS" This reverts commit f9474aa. * mock Rx.timer instead, revert previous solution * added comment * remove for loop Co-authored-by: Kibana Machine <[email protected]>
* mock and reduce the wait time for reading diagnoistic logs * remove comment * run test suite 42 times - REVERT THIS * Revert "run test suite 42 times - REVERT THIS" This reverts commit f9474aa. * mock Rx.timer instead, revert previous solution * added comment * remove for loop Co-authored-by: Kibana Machine <[email protected]>
…8325) * mock and reduce the wait time for reading diagnoistic logs * remove comment * run test suite 42 times - REVERT THIS * Revert "run test suite 42 times - REVERT THIS" This reverts commit f9474aa. * mock Rx.timer instead, revert previous solution * added comment * remove for loop Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
…8326) * mock and reduce the wait time for reading diagnoistic logs * remove comment * run test suite 42 times - REVERT THIS * Revert "run test suite 42 times - REVERT THIS" This reverts commit f9474aa. * mock Rx.timer instead, revert previous solution * added comment * remove for loop Co-authored-by: Kibana Machine <[email protected]> Co-authored-by: Kibana Machine <[email protected]>
* mock and reduce the wait time for reading diagnoistic logs * remove comment * run test suite 42 times - REVERT THIS * Revert "run test suite 42 times - REVERT THIS" This reverts commit f9474aa. * mock Rx.timer instead, revert previous solution * added comment * remove for loop Co-authored-by: Kibana Machine <[email protected]>
Summary
Closes #89369
Closes #89200
The proposed change is to reduce the amount of time tests need to wait for the mocked browser logs to be collected. This will move the timing away from the, currently, dangerously close 6 second timeout.
Tests
Test timings before the change
Test timings after the change (timeout set to 50ms)
Notes & TODO