From de2f73c1317ee5f942a2023af1122953f653dc22 Mon Sep 17 00:00:00 2001 From: George Kalpakas Date: Wed, 16 Dec 2020 18:28:33 +0200 Subject: [PATCH] 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 --- dev-infra/browsers/README.md | 21 +++++++++++++------ ....js => puppeteer-chromedriver-versions.js} | 0 scripts/webdriver-manager-update.js | 8 +++---- 3 files changed, 19 insertions(+), 10 deletions(-) rename scripts/{puppeteer-chrome-versions.js => puppeteer-chromedriver-versions.js} (100%) diff --git a/dev-infra/browsers/README.md b/dev-infra/browsers/README.md index 55e377c723..5e5f19d26e 100644 --- a/dev-infra/browsers/README.md +++ b/dev-infra/browsers/README.md @@ -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 diff --git a/scripts/puppeteer-chrome-versions.js b/scripts/puppeteer-chromedriver-versions.js similarity index 100% rename from scripts/puppeteer-chrome-versions.js rename to scripts/puppeteer-chromedriver-versions.js diff --git a/scripts/webdriver-manager-update.js b/scripts/webdriver-manager-update.js index 384e69c107..28031a5b12 100644 --- a/scripts/webdriver-manager-update.js +++ b/scripts/webdriver-manager-update.js @@ -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); }