diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index cab31d9ea..8aa274f0d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -41,12 +41,6 @@ jobs: shell: bash run: npm ci - - name: Install Chrome Canary - shell: bash - run: | - CANARY_PATH=$(npx @puppeteer/browsers install chrome@canary --format "{{path}}") - echo "CANARY_EXECUTABLE_PATH=$CANARY_PATH" >> $GITHUB_ENV - - name: Build run: npm run bundle env: diff --git a/scripts/test.mjs b/scripts/test.mjs index 43ee3871b..7a00c1151 100644 --- a/scripts/test.mjs +++ b/scripts/test.mjs @@ -7,7 +7,7 @@ // Note: can be converted to ts file once node 20 support is dropped. // Node 20 does not support --experimental-strip-types flag. -import {spawn} from 'node:child_process'; +import {spawn, execSync} from 'node:child_process'; import path from 'node:path'; import process from 'node:process'; @@ -58,6 +58,19 @@ const nodeArgs = [ ...files, ]; +function installChrome(version) { + try { + return execSync( + `npx @puppeteer/browsers install chrome@${version} --format "{{path}}"`, + ) + .toString() + .trim(); + } catch (e) { + console.error(`Failed to install Chrome ${version}:`, e); + process.exit(1); + } +} + async function runTests(attempt) { if (attempt > 1) { console.log(`\nRun attempt ${attempt}...\n`); @@ -78,6 +91,9 @@ async function runTests(attempt) { }); } +const chromePath = installChrome('146.0.7680.31'); +process.env.CHROME_M146_EXECUTABLE_PATH = chromePath; + const maxAttempts = shouldRetry ? 3 : 1; let exitCode = 1; diff --git a/tests/tools/extensions.test.ts b/tests/tools/extensions.test.ts index 61f85b903..dbea68e38 100644 --- a/tests/tools/extensions.test.ts +++ b/tests/tools/extensions.test.ts @@ -149,7 +149,7 @@ describe('extension', () => { assert.ok(pageTargetAfter, 'Page should exist after action'); }, { - executablePath: process.env.CANARY_EXECUTABLE_PATH, + executablePath: process.env.CHROME_M146_EXECUTABLE_PATH, }, { categoryExtensions: true,