Skip to content
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

delegate chromedriver version management to users #30

Merged
merged 14 commits into from
May 5, 2022

Conversation

goosewobbler
Copy link
Member

@goosewobbler goosewobbler commented May 3, 2022

Making electron-chromedriver an optional peerdep, looking for it when chromedriverCustomPath is not specified, throwing an error when not found.

  • impl
  • docs
  • manual tests - electron-chromedriver, chromedriver, error case
  • update example repo

@christian-bromann
Copy link
Contributor

Is there a way to detect the Chromium version based on the Electron version used? I had similar issues when working on the VSCode test service. Maybe we can hardcode a list of Chromedriver versions that are compatible to a specific Electron version.

Overall it would be nice if this service can help with the whole Chromedriver setup in some way or the other.

@goosewobbler
Copy link
Member Author

goosewobbler commented May 3, 2022

@christian-bromann I'm not sure. Obviously there is a mapping between Chromium version and Electron version but I'm not sure we can get either for a given app without running it first and/or doing something crazy:

https://stackoverflow.com/questions/50345957/how-to-display-version-of-electron-environment-in-an-electron-app

It would be nice to do something else though if it is possible to find the Electron version, even if it's just a command prompt to install a specific version of electron-chromedriver.

One possibility could be to install electron-chromedriver in a setup script where the user specifies which version of Electron they are wanting to test, I would consider that a follow-on piece from this work but would prefer to get the Typescript support done first.

@christian-bromann
Copy link
Contributor

@goosewobbler sounds good! How about we assume by default the user wants to test the latest Electron version and if not and an older version is being tested, that version needs to be specified in the capabilities. You can define your custom ones, e.g.: wdio:electronService: { electronVersion: "..." } or something similar. Then you read it in the launcher and feed that value into electron-chromedriver.

@goosewobbler
Copy link
Member Author

@christian-bromann any interaction with electron-chromedriver would have to be around the npm setup / install stage...it just downloads and installs the appropriate chromedriver package for your setup and specified electron version, I think just selecting a package from e.g. https://registry.npmmirror.com/binary.html?path=electron/16.0.0/ for v16. Installing the latest version gives you the chromedriver version for the latest version of electron.

https://github.com/electron/chromedriver

Could read the wdio config file as part of a setup script to ensure the right chromedriver version but it would need to be done separately from the launcher execution I reckon.

@christian-bromann
Copy link
Contributor

What I've did in the VSCode service is that as part of the launcher I would download the required Chromedriver version and put it into a .vscode-service directory. It seems like electron-chromedriver is not ideal for the task of downloading Chromedriver here, given it has no interface to do that during the launch process. I think there are two tasks at hand:

  1. find the dedicated Chromedriver version for the Electron version that is suppose to be tested: a solution for this can be a hardcoded list
  2. download Chromedriver during the launch process: I suggest to use the download package and pull it from https://chromedriver.storage.googleapis.com/ , an example of this implementation can be found here

What do you think?

@goosewobbler
Copy link
Member Author

goosewobbler commented May 4, 2022

Sounds good, I'll raise a separate ticket for it as it's a fair bit more involved than this stopgap approach. Basically taking electron-chromedriver and pulling it into the service. Can use https://github.com/electron/get to download chromedriver for a specific electron version I think, it's what electron-chromedriver uses.

@goosewobbler goosewobbler merged commit ee1d463 into main May 5, 2022
@goosewobbler goosewobbler deleted the chromedriver-fix branch May 5, 2022 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants