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

Use WebdriverIOs driver setup mechanism #94

Closed
wants to merge 2 commits into from

Conversation

christian-bromann
Copy link
Contributor

@christian-bromann christian-bromann commented Nov 28, 2023

This patch will remove chromedriver and wdio-chromedriver-service in favor of WebdriverIOs own driver setup mechanism.

Note: this currently doesn't work yet as Chrome for testing started to release Chromedriver starting v115. VS Code however currently still relies on v114 for their latest VS Code release.

@openscript
Copy link
Contributor

If I set up a new project via wdio/cli and running wdio config it doesn't add ts-node to my dependencies. Maybe the setup can add it to the package.json.

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'ts-node' imported from /workspaces/monorepo/project
    at new NodeError (node:internal/errors:405:5)
    at packageResolve (node:internal/modules/esm/resolve:887:9)
    at moduleResolve (node:internal/modules/esm/resolve:936:20)
    at defaultResolve (node:internal/modules/esm/resolve:1129:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ESMLoader.import (node:internal/modules/esm/loader:524:22)
    at initializeLoader (node:internal/process/esm_loader:75:58)
    at loadESM (node:internal/process/esm_loader:90:11) {
  code: 'ERR_MODULE_NOT_FOUND'
}

README.md Outdated Show resolved Hide resolved
Co-authored-by: Sean Poulter <sean.poulter+gh@gmail.com>
@mattseddon
Copy link
Contributor

@christian-bromann version 1.86.0 of VS Code shipped with version 118.0.5993.159 of Chromium. Would it be possible to make this change now?

@christian-bromann
Copy link
Contributor Author

I haven't been able to make progress on this, if anyone wants to push it over the goal line I would appreciate it.

@seanpoulter
Copy link
Contributor

You've got our eyes on it @christian-bromann. How can we help? I'd suggest splitting the changes to the docs/imports out into a small quick PR, and we can focus on the behaviour changes separately.

@christian-bromann
Copy link
Contributor Author

I hope to be able to take a look at this sometime this week. If you like to take this one feel free.


#### `cachePath`

Define a cache path to avoid re-downloading all bundles. This is useful for CI/CD to avoid re-downloading VSCode and Chromedriver for every testrun.
Define a cache path to avoid re-downloading VS Code bundles. This is useful for CI/CD to avoid re-downloading VSCode and Chromedriver for every test run.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is out of scope of this PR but would we want to try to normalize how we write VS Code/VSCode, and Chromedriver/ChromeDriver?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

"yargs-parser": "^21.1.1"
},
"peerDependencies": {
"chromedriver": "latest",
"webdriverio": "^8.0.0"
Copy link
Contributor

@seanpoulter seanpoulter Feb 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand the blog post correctly, will this need to explicitly be ^8.14.0?

@@ -147,77 +137,24 @@ export default class VSCodeServiceLauncher extends ChromedriverServiceLauncher {
throw new Error(`No key "${VSCODE_CAPABILITY_KEY}" found in caps`)
}

if (versionsFileExist) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want to keep versions.txt at all @christian-bromann?

This looks really close. I think I've got it working/failing to start locally. That's a win because ChromeDriver on Linux on ARM isn't officially supported or downloaded.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you can confirm how to handle the cache, and that you wanted to set the browserName = 'chrome' and browserVersion` to the version of Chromium bundled with VS Code, then I think I've got most of it done.

The pipeline still fails but I suspect it's because the code building the download links from Puppeteer only supports a 3 digit version number, not a 4 digit like we extract from the manifest. 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks for looking into this. Mind raising a new PR and we take it from there?

Caching for Chromedriver is handled by WebdriverIO. It doesn't cache the VS Code binary though which I am not sure will become a problem. I've implemented this with the idea in mind that test should work no matter if the user has an internet connection or not. That said, I am ok with moving forward without that feature and raise an issue to re-add it back.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll open a PR when I find a moment.

I believe we could keep with your original intent with the cache if we pivot to store the chromium version instead of chromium and let WebdriverIO handle Chromium/ChromeDriver.

Since I haven't got VS Code to open yet, would you happen to know if we'll want to use ChromeDriver or can we use Chrome for Testing to interact with VS Code? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Chrome for Testing and Chromedriver are different things. The first is the browser the other the driver. For automating VS Code we need Chromedriver and download the desired VS Code version. VS Code is an Electron application and "acts" as a browser here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like I don't have to touch the browserName anyways. 🎉

@christian-bromann
Copy link
Contributor Author

Closing in favor of #105 ... thanks @seanpoulter 🙌

@christian-bromann christian-bromann deleted the cb/driver-setup-update branch February 13, 2024 16:50
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.

4 participants