From aab83b9cda32c253fe56983b46e72151cd602c61 Mon Sep 17 00:00:00 2001 From: Nicholas Roscino Date: Fri, 27 Mar 2026 14:35:57 +0100 Subject: [PATCH 1/7] chore: remove canary usage on extensions tests --- scripts/test.mjs | 3 --- tests/tools/extensions.test.ts | 4 +--- tests/tools/pages.test.ts | 8 ++------ 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/scripts/test.mjs b/scripts/test.mjs index 4b07d6021..7e9af6362 100644 --- a/scripts/test.mjs +++ b/scripts/test.mjs @@ -92,9 +92,6 @@ 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 8f8b5a878..6f3fd38f3 100644 --- a/tests/tools/extensions.test.ts +++ b/tests/tools/extensions.test.ts @@ -148,9 +148,7 @@ describe('extension', () => { ); assert.ok(pageTargetAfter, 'Page should exist after action'); }, - { - executablePath: process.env.CHROME_M146_EXECUTABLE_PATH, - }, + {}, { categoryExtensions: true, } as ParsedArguments, diff --git a/tests/tools/pages.test.ts b/tests/tools/pages.test.ts index d278cd0a3..4b16777a8 100644 --- a/tests/tools/pages.test.ts +++ b/tests/tools/pages.test.ts @@ -89,9 +89,7 @@ describe('pages', () => { ); t.assert.snapshot?.(text); }, - { - executablePath: process.env.CHROME_M146_EXECUTABLE_PATH, - }, + {}, { categoryExtensions: true, } as ParsedArguments, @@ -196,9 +194,7 @@ describe('pages', () => { ); t.assert.snapshot?.(text); }, - { - executablePath: process.env.CHROME_M146_EXECUTABLE_PATH, - }, + {}, { categoryExtensions: true, } as ParsedArguments, From 077afb956e753618c4756bd350ff973346213cbf Mon Sep 17 00:00:00 2001 From: Nicholas Roscino Date: Fri, 27 Mar 2026 14:45:46 +0100 Subject: [PATCH 2/7] chore: formatting --- scripts/test.mjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/test.mjs b/scripts/test.mjs index 7e9af6362..cea872488 100644 --- a/scripts/test.mjs +++ b/scripts/test.mjs @@ -59,7 +59,7 @@ const nodeArgs = [ ...files, ]; -function installChrome(version) { +function _installChrome(version) { try { return execSync( `npx puppeteer browsers install chrome@${version} --format "{{path}}"`, From 0ce2a89ac60bd2e50a0ceb7d733da2112098bfee Mon Sep 17 00:00:00 2001 From: Nicholas Roscino Date: Fri, 27 Mar 2026 17:24:11 +0100 Subject: [PATCH 3/7] chore: adding uninstall to extension tests --- tests/tools/extensions.test.ts | 2 ++ tests/tools/pages.test.ts | 3 +++ 2 files changed, 5 insertions(+) diff --git a/tests/tools/extensions.test.ts b/tests/tools/extensions.test.ts index 6f3fd38f3..33d39751f 100644 --- a/tests/tools/extensions.test.ts +++ b/tests/tools/extensions.test.ts @@ -122,6 +122,7 @@ describe('extension', () => { assert.ok(list.length === 1, 'List should have only one extension'); const reinstalled = list.find(e => e.id === extensionId); assert.ok(reinstalled, 'Extension should be present after reload'); + await context.uninstallExtension(EXTENSION_WITH_SW_PATH); }); }); it('triggers an extension action', async () => { @@ -147,6 +148,7 @@ describe('extension', () => { t => t.type() === 'page' && t.url().includes(extensionId), ); assert.ok(pageTargetAfter, 'Page should exist after action'); + await context.uninstallExtension(EXTENSION_WITH_SW_PATH); }, {}, { diff --git a/tests/tools/pages.test.ts b/tests/tools/pages.test.ts index 4b16777a8..c72bea651 100644 --- a/tests/tools/pages.test.ts +++ b/tests/tools/pages.test.ts @@ -88,6 +88,7 @@ describe('pages', () => { '', ); t.assert.snapshot?.(text); + await context.uninstallExtension(extensionId); }, {}, { @@ -142,6 +143,7 @@ describe('pages', () => { '', ); t.assert.snapshot?.(text); + await context.uninstallExtension(extensionId); }, {}, { @@ -193,6 +195,7 @@ describe('pages', () => { '', ); t.assert.snapshot?.(text); + await context.uninstallExtension(extensionId); }, {}, { From c8a89cd6098451d20aa86fe9be37aafa2cfb3b7e Mon Sep 17 00:00:00 2001 From: Nicholas Roscino Date: Fri, 27 Mar 2026 17:39:13 +0100 Subject: [PATCH 4/7] chore: removed unused uninstallation of extension --- tests/tools/extensions.test.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/tools/extensions.test.ts b/tests/tools/extensions.test.ts index 33d39751f..6f3fd38f3 100644 --- a/tests/tools/extensions.test.ts +++ b/tests/tools/extensions.test.ts @@ -122,7 +122,6 @@ describe('extension', () => { assert.ok(list.length === 1, 'List should have only one extension'); const reinstalled = list.find(e => e.id === extensionId); assert.ok(reinstalled, 'Extension should be present after reload'); - await context.uninstallExtension(EXTENSION_WITH_SW_PATH); }); }); it('triggers an extension action', async () => { @@ -148,7 +147,6 @@ describe('extension', () => { t => t.type() === 'page' && t.url().includes(extensionId), ); assert.ok(pageTargetAfter, 'Page should exist after action'); - await context.uninstallExtension(EXTENSION_WITH_SW_PATH); }, {}, { From 6aba753e51656c2b7318a1d9364fa3ee1ea9a5df Mon Sep 17 00:00:00 2001 From: Nicholas Roscino Date: Fri, 27 Mar 2026 17:48:56 +0100 Subject: [PATCH 5/7] chore: adding uninstall of text to avoid test overlapping --- tests/tools/extensions.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/tools/extensions.test.ts b/tests/tools/extensions.test.ts index 6f3fd38f3..94d28c01b 100644 --- a/tests/tools/extensions.test.ts +++ b/tests/tools/extensions.test.ts @@ -122,6 +122,9 @@ describe('extension', () => { assert.ok(list.length === 1, 'List should have only one extension'); const reinstalled = list.find(e => e.id === extensionId); assert.ok(reinstalled, 'Extension should be present after reload'); + try { + await context.uninstallExtension(EXTENSION_WITH_SW_PATH); + } catch (e) {} }); }); it('triggers an extension action', async () => { @@ -147,6 +150,9 @@ describe('extension', () => { t => t.type() === 'page' && t.url().includes(extensionId), ); assert.ok(pageTargetAfter, 'Page should exist after action'); + try { + await context.uninstallExtension(EXTENSION_WITH_SW_PATH); + } catch (e) {} }, {}, { From 3d6d4a5a3f4d96f41e34fa26b9f0783aaf8308e1 Mon Sep 17 00:00:00 2001 From: Nicholas Roscino Date: Fri, 27 Mar 2026 18:27:21 +0100 Subject: [PATCH 6/7] chore: test --- tests/tools/extensions.test.ts | 6 ------ tests/tools/pages.test.ts | 4 +++- tests/utils.ts | 3 +++ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/tools/extensions.test.ts b/tests/tools/extensions.test.ts index 94d28c01b..6f3fd38f3 100644 --- a/tests/tools/extensions.test.ts +++ b/tests/tools/extensions.test.ts @@ -122,9 +122,6 @@ describe('extension', () => { assert.ok(list.length === 1, 'List should have only one extension'); const reinstalled = list.find(e => e.id === extensionId); assert.ok(reinstalled, 'Extension should be present after reload'); - try { - await context.uninstallExtension(EXTENSION_WITH_SW_PATH); - } catch (e) {} }); }); it('triggers an extension action', async () => { @@ -150,9 +147,6 @@ describe('extension', () => { t => t.type() === 'page' && t.url().includes(extensionId), ); assert.ok(pageTargetAfter, 'Page should exist after action'); - try { - await context.uninstallExtension(EXTENSION_WITH_SW_PATH); - } catch (e) {} }, {}, { diff --git a/tests/tools/pages.test.ts b/tests/tools/pages.test.ts index c72bea651..ef1945b89 100644 --- a/tests/tools/pages.test.ts +++ b/tests/tools/pages.test.ts @@ -197,7 +197,9 @@ describe('pages', () => { t.assert.snapshot?.(text); await context.uninstallExtension(extensionId); }, - {}, + { + userDataDir: '/tmp/chrome-test', + }, { categoryExtensions: true, } as ParsedArguments, diff --git a/tests/utils.ts b/tests/utils.ts index 4d48d970c..4af37ff60 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -62,6 +62,7 @@ export async function withBrowser( debug?: boolean; autoOpenDevTools?: boolean; executablePath?: string; + userDataDir?: string; } = {}, ) { const launchOptions: LaunchOptions = { @@ -74,6 +75,7 @@ export async function withBrowser( handleDevToolsAsPage: true, args: ['--screen-info={3840x2160}'], enableExtensions: true, + userDataDir: options.userDataDir, }; const key = JSON.stringify(launchOptions); @@ -102,6 +104,7 @@ export async function withMcpContext( autoOpenDevTools?: boolean; performanceCrux?: boolean; executablePath?: string; + userDataDir?: string; } = {}, args: ParsedArguments = {} as ParsedArguments, ) { From b89a23889e4fabf9c884eae7210662b00f7238cd Mon Sep 17 00:00:00 2001 From: Nicholas Roscino Date: Fri, 27 Mar 2026 19:09:28 +0100 Subject: [PATCH 7/7] chore: spawn new browser flag --- tests/tools/pages.test.ts | 2 +- tests/utils.ts | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/tests/tools/pages.test.ts b/tests/tools/pages.test.ts index ef1945b89..46178d900 100644 --- a/tests/tools/pages.test.ts +++ b/tests/tools/pages.test.ts @@ -198,7 +198,7 @@ describe('pages', () => { await context.uninstallExtension(extensionId); }, { - userDataDir: '/tmp/chrome-test', + spawnNewBrowser: true, }, { categoryExtensions: true, diff --git a/tests/utils.ts b/tests/utils.ts index 4af37ff60..670b8ab6a 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -62,7 +62,7 @@ export async function withBrowser( debug?: boolean; autoOpenDevTools?: boolean; executablePath?: string; - userDataDir?: string; + spawnNewBrowser?: boolean; } = {}, ) { const launchOptions: LaunchOptions = { @@ -75,11 +75,10 @@ export async function withBrowser( handleDevToolsAsPage: true, args: ['--screen-info={3840x2160}'], enableExtensions: true, - userDataDir: options.userDataDir, }; const key = JSON.stringify(launchOptions); - let browser = browsers.get(key); + let browser = options.spawnNewBrowser && browsers.get(key); if (!browser) { browser = await puppeteer.launch(launchOptions); browsers.set(key, browser); @@ -104,7 +103,7 @@ export async function withMcpContext( autoOpenDevTools?: boolean; performanceCrux?: boolean; executablePath?: string; - userDataDir?: string; + spawnNewBrowser?: boolean; } = {}, args: ParsedArguments = {} as ParsedArguments, ) {