diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /remote/test/puppeteer/tools/download_chrome_canary.mjs | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-upstream/125.0.1.tar.xz firefox-upstream/125.0.1.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'remote/test/puppeteer/tools/download_chrome_canary.mjs')
-rw-r--r-- | remote/test/puppeteer/tools/download_chrome_canary.mjs | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/remote/test/puppeteer/tools/download_chrome_canary.mjs b/remote/test/puppeteer/tools/download_chrome_canary.mjs new file mode 100644 index 0000000000..9f523aea2a --- /dev/null +++ b/remote/test/puppeteer/tools/download_chrome_canary.mjs @@ -0,0 +1,51 @@ +/** + * @license + * Copyright 2024 Google Inc. + * SPDX-License-Identifier: Apache-2.0 + */ + +/* eslint-disable no-console */ + +/** + * @fileoverview Installs the latest Chrome Canary using + * `@puppeteer/browsers` to the directory provided as the first argument + * (default: cwd). The executable path is written to the `executablePath` output + * param for GitHub actions. + * + * Examples: + * + * - `node tools/download_chrome_canary.mjs` + * - `node tools/download_chrome_canary.mjs /tmp/cache` + */ +import actions from '@actions/core'; + +import { + Browser, + computeExecutablePath, + install, + resolveBuildId, + detectBrowserPlatform, +} from '@puppeteer/browsers'; + +try { + const cacheDir = process.argv[2] || process.cwd(); + const browser = Browser.CHROME; + const platform = detectBrowserPlatform(); + const buildId = await resolveBuildId(browser, platform, 'canary'); + await install({ + browser, + buildId, + cacheDir, + }); + const executablePath = computeExecutablePath({ + cacheDir, + browser, + buildId, + }); + if (process.argv.indexOf('--shell') === -1) { + actions.setOutput('executablePath', executablePath); + } + console.log(executablePath); +} catch (err) { + actions.setFailed(`Failed to download the browser: ${err.message}`); +} |