-
Notifications
You must be signed in to change notification settings - Fork 8
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
IPLAYER-40770: Fix "No inspectable targets" error when connecting to chrome-remote-interface #62
Merged
Conversation
This file contains 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
anthonyec
changed the title
Chrome launcher CDP retry
Fix "No inspectable targets" error when connecting to chrome-remote-interface
Oct 25, 2021
anthonyec
changed the title
Fix "No inspectable targets" error when connecting to chrome-remote-interface
IPLAYER-40770: Fix "No inspectable targets" error when connecting to chrome-remote-interface
Oct 26, 2021
robtpaton
approved these changes
Oct 26, 2021
andymsuk
reviewed
Oct 26, 2021
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.
Presumably everything still works as expected when running a11y-tests-web locally on your Mac too?
@andymsuk yep, all works locally |
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.
Problem
Launching Chrome and connecting to the Chrome Dev Protocol (CDP) are separate actions, and are susceptible to a race condition. This race condition occurs if Chrome has launched but Chrome Dev Protocol is not yet ready.
If you try to connect to the Chrome Dev Protocol before it is ready, it will throw an error:
We have been experiencing this in our iPlayer CI.
Solution
Wait for the Chrome Dev Protocol to be ready before trying to connect to it.
Chrome provides an endpoint (
/json/list
) that lists inspectable targets. If the CDP is not ready, the list will be an empty array. We can poll this endpoint until the list is populated. This is basically the solution that has been suggested in the bug report for the chrome-launcher library. However, there hasn't been an official fix merged yet.Changes
nock
to mock requestswaitForInspectableTarget
before trying to connect to CDPLinks