Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions scripts/test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const nodeArgs = [
...files,
];

function installChrome(version) {
function _installChrome(version) {
try {
return execSync(
`npx puppeteer browsers install chrome@${version} --format "{{path}}"`,
Expand Down Expand Up @@ -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;

Expand Down
4 changes: 1 addition & 3 deletions tests/tools/extensions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
9 changes: 5 additions & 4 deletions tests/tools/pages.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,9 @@ describe('pages', () => {
'<extension-id>',
);
t.assert.snapshot?.(text);
await context.uninstallExtension(extensionId);
},
{
executablePath: process.env.CHROME_M146_EXECUTABLE_PATH,
},
{},
{
categoryExtensions: true,
} as ParsedArguments,
Expand Down Expand Up @@ -144,6 +143,7 @@ describe('pages', () => {
'<extension-id>',
);
t.assert.snapshot?.(text);
await context.uninstallExtension(extensionId);
},
{},
{
Expand Down Expand Up @@ -195,9 +195,10 @@ describe('pages', () => {
'<extension-id>',
);
t.assert.snapshot?.(text);
await context.uninstallExtension(extensionId);
},
{
executablePath: process.env.CHROME_M146_EXECUTABLE_PATH,
spawnNewBrowser: true,
},
{
categoryExtensions: true,
Expand Down
4 changes: 3 additions & 1 deletion tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export async function withBrowser(
debug?: boolean;
autoOpenDevTools?: boolean;
executablePath?: string;
spawnNewBrowser?: boolean;
} = {},
) {
const launchOptions: LaunchOptions = {
Expand All @@ -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);
Expand All @@ -102,6 +103,7 @@ export async function withMcpContext(
autoOpenDevTools?: boolean;
performanceCrux?: boolean;
executablePath?: string;
spawnNewBrowser?: boolean;
} = {},
args: ParsedArguments = {} as ParsedArguments,
) {
Expand Down
Loading