-
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
Refactor the copy/paste logic in the integration tests and fix a race condition involving the waitForEvent
integration test helper function
#18331
Conversation
waitForEvent
integration test helper function
4ca71a8
to
ae4e8d5
Compare
/botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 1 Live output at: http://54.241.84.105:8877/a8bd6379e9f108b/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 1 Live output at: http://54.193.163.58:8877/ecc6f7761afddf0/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/a8bd6379e9f108b/output.txt Total script time: 7.72 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/ecc6f7761afddf0/output.txt Total script time: 19.34 mins
|
/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/8b2d77b3699e0cb/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/e6303dacd1d3a72/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/e6303dacd1d3a72/output.txt Total script time: 8.13 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/8b2d77b3699e0cb/output.txt Total script time: 18.78 mins
|
/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/270824e9e72aaca/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/4781d821f5a0b5f/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/4781d821f5a0b5f/output.txt Total script time: 7.78 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/270824e9e72aaca/output.txt Total script time: 19.89 mins
|
ae4e8d5
to
488e47b
Compare
/botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/68085c03b258a42/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 0 Live output at: http://54.193.163.58:8877/4fce05545aa2f20/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/68085c03b258a42/output.txt Total script time: 8.14 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/4fce05545aa2f20/output.txt Total script time: 19.06 mins
|
0e1997d
to
385550f
Compare
/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/107b5a7a5acaa86/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/6d478446cda4323/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/6d478446cda4323/output.txt Total script time: 7.76 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/107b5a7a5acaa86/output.txt Total script time: 18.42 mins
|
The integration tests are currently not consistent in how they do copy/pasting: some tests use the `kbCopy`/`kbPaste` functions with waiting for the event inline, some have their own helper function to combine those actions and some even call `kbCopy`/`kbPaste` without waiting for the event at all (which can cause intermittent failures). This commit fixes the issues by providing a set of four helper functions that all tests use and that abstract e.g. waiting for the event away from the caller. This makes the invididual tests simpler and consistent, reduces code duplication and fixes possible intermittent failures due to not waiting for events to trigger.
…lper function Debugging mozilla#17931 uncovered a race condition in the way we use the `waitForEvent` function. Currently the following happens: 1. We call `waitForEvent`, which starts execution of the function body and immediately returns a promise. 2. We do the action that triggers the event. 3. We await the promise, which resolves if the event is triggered or the timeout is reached. The problem is in step 1: function body execution has started, but not necessarily completed. Given that we don't await the promise, we immediately trigger step 2 and it's not unlikely that the event we trigger arrives before the event listener is actually registered in the function body of `waitForEvent` (which is slower because it needs to be evaluated in the page context and there is some other logic before the actual `addEventListener` call). This commit fixes the issue by passing the action to `waitForEvent` as a callback so `waitForEvent` itself can call it once it's safe to do so. This should make sure that we always register the event listener before triggering the event, and because we shouldn't miss events anymore we can also remove the retry logic for pasting.
385550f
to
7128b95
Compare
/botio integrationtest |
From: Bot.io (Linux m4)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/b791c8df3a640d7/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_integrationtest from @timvandermeij received. Current queue size: 0 Live output at: http://54.193.163.58:8877/be8cb320ef713bf/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/b791c8df3a640d7/output.txt Total script time: 7.75 mins
|
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/be8cb320ef713bf/output.txt Total script time: 18.82 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.
LGTM. Thank you.
The commit messages contain more details about the individual changes.
Note that this patch should fix the
waitForEvent
timeout logs (but not thewaitForEvent
validation logs yet) and reduce the likelyhood of theFreeText Editor Paste some html must check that pasting html just keep the text
integration test, and other related integration tests, failing (but not completely fix it yet). I'm fairly sure I now know how to fix it completely, but that'll be done in a follow-up which builds on top of this patch and the previous patches.Fixes a part of #17931.