build: fix instructions and process for updating Chrome version (#40150)

Previously, the instructions and process for updating the version of
Chrome ued in tests assumed that there was always going to be a
ChromeDriver version that corresponded to a Chrome version. For example,
if we wanted to use Chrome v87.0.4272.x, we assumed that there was going
to be ChromeDriver v87.0.4272.x. It turns out that this is not always
the case.

This commit updates the instructions and process for updating the Chrome
version to ensure a valid version of ChromeDriver will be used as well.

PR Close #40150
This commit is contained in:
George Kalpakas 2020-12-16 18:28:33 +02:00 committed by Joey Perrott
parent be48ad28ea
commit de2f73c131
3 changed files with 19 additions and 10 deletions

View File

@ -43,14 +43,23 @@ The process of updating the Chrome or Firefox version is not straightforward, bu
## Puppeteer
Visit https://github.com/puppeteer/puppeteer/blob/master/docs/api.md to determine which version of puppeteer corresponds to the version of Chrome desired.
Then update `scripts/puppeteer-chrome-versions.js` and all of the puppeteer versions throughout the repo,
1. Visit https://github.com/puppeteer/puppeteer/blob/master/docs/api.md to determine which version of puppeteer corresponds to the version of Chrome desired.
* `package.json`
* `aio/package.json`
* `aio/tools/examples/shared/package.json`
2. Visit https://chromedriver.chromium.org/downloads to determine which version of ChromeDriver should be used for the version of Chrome desired.
and their corresponding `yarn.lock` files.
> NOTE:
> The version of Chrome does not necessarily correspond exactly with the version of ChromeDriver.
> For example, you might have to use ChromeDriver v87.0.4280.x to drive Chrome v87.0.4272.x.
3. Update `scripts/puppeteer-chromedriver-versions.js` to include and entry with the new version of puppeteer as key and the new version of ChromeDriver as value (as determined in the two previous steps).
4. Update all of the puppeteer versions throughout the repo:
* `package.json`
* `aio/package.json`
* `aio/tools/examples/shared/package.json`
...and their corresponding `yarn.lock` files.
## Firefox

View File

@ -11,13 +11,13 @@
// where this will require /aio/node_modules/puppeteer
const puppeteerPkgPath = require.resolve('puppeteer/package.json', {paths: [process.cwd()]});
const puppeteerVersion = require(puppeteerPkgPath).version;
const chromeVersionMap = require('./puppeteer-chrome-versions');
const chromedriverVersionMap = require('./puppeteer-chromedriver-versions');
const spawnSync = require('child_process').spawnSync;
const version = chromeVersionMap[puppeteerVersion];
const version = chromedriverVersionMap[puppeteerVersion];
if (!version) {
console.error(`[webdriver-manager-update.js] Error: Could not find Chrome version for Puppeteer version '${
puppeteerVersion}' in Chrome/Puppeteer version map. Please update /scripts/puppeteer-chrome-versions.js.`);
console.error(`[webdriver-manager-update.js] Error: Could not find ChromeDriver version for Puppeteer version '${
puppeteerVersion}' in ChromeDriver/Puppeteer version map. Please update /scripts/puppeteer-chromedriver-versions.js.`);
process.exit(1);
}