mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
test: fix chromedriver download URL (#24464)
This commit is contained in:
parent
7524894512
commit
4d38d84612
@ -1,6 +1,7 @@
|
||||
const playwright = require('playwright-core');
|
||||
const { execSync } = require('child_process');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
(async () => {
|
||||
const dir = process.argv[2];
|
||||
@ -10,13 +11,24 @@ const path = require('path');
|
||||
console.log(`Found Chrome version ${version}`);
|
||||
|
||||
const [major] = version.split('.');
|
||||
const driverVersion = execSync(`curl https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${major} --silent`).toString('utf-8');
|
||||
console.log(`Found ChromeDriver version ${driverVersion}`);
|
||||
const downloadsInfo = JSON.parse(execSync(`curl https://googlechromelabs.github.io/chrome-for-testing/latest-versions-per-milestone-with-downloads.json --silent`).toString('utf-8'));
|
||||
|
||||
let currentPlatform = '';
|
||||
if (process.platform === 'darwin')
|
||||
currentPlatform = process.arch === 'arm64' ? 'mac-arm64' : 'mac-x64';
|
||||
else if (process.platform === 'linux')
|
||||
currentPlatform = 'linux64';
|
||||
else
|
||||
currentPlatform = 'win64';
|
||||
const chromeDriverURL = downloadsInfo.milestones[major].downloads.chromedriver.find(({ platform, url }) => platform === currentPlatform).url;
|
||||
console.log(`Found ChromeDriver download URL: ${chromeDriverURL}`);
|
||||
|
||||
const zip = path.join(dir, 'chromedriver.zip');
|
||||
execSync(`curl https://chromedriver.storage.googleapis.com/${driverVersion}/chromedriver_${process.platform === 'darwin' ? 'mac' : 'linux'}64.zip --output ${zip} --silent`);
|
||||
execSync(`curl ${chromeDriverURL} --output ${zip} --silent`);
|
||||
console.log(`Downloaded ${zip}`);
|
||||
|
||||
execSync(`unzip ${zip}`, { cwd: dir });
|
||||
console.log(`Unzipped ${zip}`);
|
||||
|
||||
fs.renameSync(`chromedriver-${currentPlatform}`, `chromedriver`);
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user