-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Fix the timeout logic in the waitForEvent
integration test helper function
#18325
Fix the timeout logic in the waitForEvent
integration test helper function
#18325
Conversation
…unction Debugging mozilla#17931, by printing all parts of the event lifecycle including timestamps, uncovered that some events for which a timeout was logged actually did get triggered correctly in the browser. Going over the code and discovering https://stackoverflow.com/questions/47107465/puppeteer-how-to-listen-to-object-events#comment117661238_65534026 showed what went wrong: if the event we wait for is triggered then `Promise.race` resolves, but that doesn't automatically cancel the timeout. The tests didn't fail on this because `Promise.race` resolved correctly, but slightly later once the timeout was reached we would see spurious log lines about timeouts for the already-triggered events. This commit fixes the issue by canceling the timeout if the event we're waiting for has triggered.
waitForEvent
integration test helper f…waitForEvent
integration test helper function
/botio integrationtest |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 0 Live output at: http://54.193.163.58:8877/28d99334c8f3d5e/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/d8e7a6b9abae7b1/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/d8e7a6b9abae7b1/output.txt Total script time: 7.76 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/28d99334c8f3d5e/output.txt Total script time: 19.12 mins
|
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.
r=me, thank you!
Debugging #17931, by printing all parts of the event lifecycle including timestamps, uncovered that some events for which a timeout was logged actually did get triggered correctly in the browser. Going over the code and discovering https://stackoverflow.com/questions/47107465/puppeteer-how-to-listen-to-object-events#comment117661238_65534026 showed what went wrong: if the event we wait for is triggered then
Promise.race
resolves, but that doesn't automatically cancel the timeout. The tests didn't fail on this becausePromise.race
resolved correctly, but slightly later once the timeout was reached we would see spurious log lines about timeouts for the already-triggered events.This commit fixes the issue by canceling the timeout if the event we're waiting for has triggered.
Note that this patch gets rid of the incorrect timeout logs, but this doesn't solve the problem of the correct timeout logs yet (but it's preparatory work for follow-up patches that address that problem).
Fixes a part of #17931.