From 892ee89f7b3531e87d59625574675e9252bad94c Mon Sep 17 00:00:00 2001 From: Nicholas Roscino Date: Tue, 3 Mar 2026 16:12:12 +0100 Subject: [PATCH 1/2] fix: installing chrome through test script --- .github/workflows/run-tests.yml | 6 ------ scripts/test.mjs | 18 +++++++++++++++++- tests/tools/extensions.test.ts | 2 +- 3 files changed, 18 insertions(+), 8 deletions(-) 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..277cf9ee5 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.TRIGGER_ACTION_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..039b9b949 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.TRIGGER_ACTION_EXECUTABLE_PATH, }, { categoryExtensions: true, From 086f5a7a270d1489a1ab3c93e65c0f9042c32012 Mon Sep 17 00:00:00 2001 From: Nicholas Roscino Date: Tue, 3 Mar 2026 16:50:24 +0100 Subject: [PATCH 2/2] chore: rename env variable --- scripts/test.mjs | 2 +- tests/tools/extensions.test.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/test.mjs b/scripts/test.mjs index 277cf9ee5..7a00c1151 100644 --- a/scripts/test.mjs +++ b/scripts/test.mjs @@ -92,7 +92,7 @@ async function runTests(attempt) { } const chromePath = installChrome('146.0.7680.31'); -process.env.TRIGGER_ACTION_EXECUTABLE_PATH = chromePath; +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 039b9b949..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.TRIGGER_ACTION_EXECUTABLE_PATH, + executablePath: process.env.CHROME_M146_EXECUTABLE_PATH, }, { categoryExtensions: true,