devtools: Attempt to rerun command before waiting for a page load (that might timeout)#10068
Merged
christian-bromann merged 1 commit intowebdriverio:mainfrom Mar 27, 2023
Conversation
christian-bromann
approved these changes
Mar 27, 2023
Member
christian-bromann
left a comment
There was a problem hiding this comment.
👍 LGTM
I am not sure if this change has other implications but if this fixes your use case, let's go with it! Thank you!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
When using
automationProtocoldevtoolssometimes the Pupeteer execution context is destroyed.Currently, when that happens, we attempt to wait for a page loaded event to be emitted, after it is emitted, we retry the command. I recently discovered a case where the page load is never emitted, therefore the tests would hang for a long time and then finally error with
This same use case also benefits from an immediate retry of the command.
When rerun (without first waiting for the page load that is never emitted) the command successfully executes and returns the desired result.
I've implemented a 3 retry limit for a command, therefore the previous behavior is maintained but only after attempting the command again a couple of times.
You can see a demo for this with the actual use case in question.
retry.before.page.load.mov
Nothing was mocked for this demo, a real test executes a command with a destroyed context and then recovers after rerunning the command. This same demo would hang eventually with
Error: page load timeoutif these changes were not implemented, as the page load is never completed.Types of changes
Checklist
Further comments
Reviewers: @webdriverio/project-committers