diff --git a/scripts/test.mjs b/scripts/test.mjs index 4b07d6021..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}}"`, @@ -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..46178d900 100644 --- a/tests/tools/pages.test.ts +++ b/tests/tools/pages.test.ts @@ -88,10 +88,9 @@ describe('pages', () => { '', ); t.assert.snapshot?.(text); + await context.uninstallExtension(extensionId); }, - { - executablePath: process.env.CHROME_M146_EXECUTABLE_PATH, - }, + {}, { categoryExtensions: true, } as ParsedArguments, @@ -144,6 +143,7 @@ describe('pages', () => { '', ); t.assert.snapshot?.(text); + await context.uninstallExtension(extensionId); }, {}, { @@ -195,9 +195,10 @@ describe('pages', () => { '', ); t.assert.snapshot?.(text); + await context.uninstallExtension(extensionId); }, { - executablePath: process.env.CHROME_M146_EXECUTABLE_PATH, + spawnNewBrowser: true, }, { categoryExtensions: true, diff --git a/tests/utils.ts b/tests/utils.ts index 4d48d970c..670b8ab6a 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -62,6 +62,7 @@ export async function withBrowser( debug?: boolean; autoOpenDevTools?: boolean; executablePath?: string; + spawnNewBrowser?: boolean; } = {}, ) { const launchOptions: LaunchOptions = { @@ -77,7 +78,7 @@ export async function withBrowser( }; 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); @@ -102,6 +103,7 @@ export async function withMcpContext( autoOpenDevTools?: boolean; performanceCrux?: boolean; executablePath?: string; + spawnNewBrowser?: boolean; } = {}, args: ParsedArguments = {} as ParsedArguments, ) {