-
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
Remove unneeded awaits for events from input actions #17378
Remove unneeded awaits for events from input actions #17378
Conversation
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @whimboo received. Current queue size: 0 Live output at: http://54.241.84.105:8877/52f0be53907afd9/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @whimboo received. Current queue size: 0 Live output at: http://54.193.163.58:8877/e80614651e4316e/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/52f0be53907afd9/output.txt Total script time: 23.89 mins
Image differences available at: http://54.241.84.105:8877/52f0be53907afd9/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/e80614651e4316e/output.txt Total script time: 34.68 mins
Image differences available at: http://54.193.163.58:8877/e80614651e4316e/reftest-analyzer.html#web=eq.log |
We use a similar pattern at different places in the tests for example:
pdf.js/test/integration/ink_editor_spec.mjs Lines 81 to 86 in 319e854
|
Yes, we wanted to get these tests running in CI first for this particular case with CDP to see if that makes a difference. While this is fine other tests are failing. Not sure if that is a known issue with reference images or not? Also please note that when I checked the puppeteer unit tests none of the input tests actually checked for events, so whenever such a related command has been awaited for we probably can assume that the event has been dispatched on the page. CC @OrKoN for proper feedback from the Puppeteer team. |
Yes, those failures in ref tests are known (due to small invisible pixel differences because of antialiasing most of the time). |
I wonder if we should address this in the BiDi spec. The pattern is relatively common in CDP/Puppeteer and I know that it used often in tests. In Chrome, the script is guaranteed to run first because both commands run on the page's main thread eventually. Is it not the case for Firefox? |
I am not sure that those awaits are completely unnecessary since they allow verifying that the even has been dispatched on an expected element which allows failing the test earlier. |
So to correct myself above: the dispatch of the evaluate was happening synchronously at some point but it has regressed. I'd recommend using the following pattern which would be more reliable:
|
… integration tests For reference: mozilla#17378 (comment)
… integration tests For reference: mozilla#17378 (comment)
… integration tests For reference: mozilla#17378 (comment)
… integration tests For reference: mozilla#17378 (comment)
… integration tests For reference: mozilla#17378 (comment)
… integration tests For reference: mozilla#17378 (comment)
This logic is problematic to run with WebDriver BiDi, because if we don't await on the script evaluation, we have no guarantee that the script was fully run before the code goes to the next step. In this case, for example, the event listener is set up after the input actions are triggered, so the event is never caught and promise is never resolved.
It looks like it's not really needed here, neither for WebDriver BiDi nor for CDP.