Repository navigation
fix: support geckodriver download mirrors - #1341
Conversation
✅ Testplane E2E run succeed
|
commit: |
✅ Testplane browser-env run succeed
|
| const cargoVersionsToml = await retryFetch(GECKODRIVER_CARGO_TOML).then(res => res.text()); | ||
| const version = cargoVersionsToml.split("\n").find(line => line.startsWith("version = ")); | ||
| const execFileAsync = promisify(execFile); | ||
| const GECKODRIVER_PLATFORMS = { |
There was a problem hiding this comment.
Despite our mirror only has linux64 geckodriver, it sounds right to implement other platforms support for the future, in case there would be a mirror with other platforms support
| const versionLine = cargoVersionsToml.split("\n").find(line => /^version\s*=/.test(line)); | ||
| const version = versionLine?.match(/^version\s*=\s*["'](\d+\.\d+\.\d+)["']/); |
There was a problem hiding this comment.
Switched to using explicit regexp matching
| const isWindows = platform === BrowserPlatform.WIN32 || platform === BrowserPlatform.WIN64; | ||
| const filename = `geckodriver-v${version}-${GECKODRIVER_PLATFORMS[platform]}${isWindows ? ".zip" : ".tar.gz"}`; |
There was a problem hiding this comment.
Looks like every other mirror packs binaries into ".zip" for windows and ".tar.gz" for other platforms
So i suppose its fair to assume "geckodriver" would not be an exception
|
|
||
| try { | ||
| const archivePath = path.join(downloadDir, filename); | ||
| await pipeline(Readable.fromWeb(response.body as never), fs.createWriteStream(archivePath)); |
There was a problem hiding this comment.
For chromedriver and chrome, we can use puppeteer's mirror feature
But "geckodriver" npm package we use in order to download geckodriver, does not have the ability to specify mirrors. So we download + unpack it manually
No description provided.