Skip to content

Commit

Permalink
fix: use separate tests for Puppeteer.launch should filter out ignore…
Browse files Browse the repository at this point in the history
…d default arguments
  • Loading branch information
whimboo committed Apr 14, 2022
1 parent a24f1b1 commit 6a35320
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion test/launcher.spec.ts
Expand Up @@ -404,7 +404,7 @@ describe('Launcher specs', function () {
await page.close();
await browser.close();
});
it('should filter out ignored default arguments', async () => {
itChromeOnly('should filter out ignored default arguments', async () => {
const { defaultBrowserOptions, puppeteer } = getTestState();
// Make sure we launch with `--enable-automation` by default.
const defaultArgs = puppeteer.defaultArgs();
Expand All @@ -423,6 +423,25 @@ describe('Launcher specs', function () {
expect(spawnargs.indexOf(defaultArgs[2])).toBe(-1);
await browser.close();
});
itFirefoxOnly('should filter out ignored default arguments', async () => {
const { defaultBrowserOptions, puppeteer } = getTestState();

const defaultArgs = puppeteer.defaultArgs();
const browser = await puppeteer.launch(
Object.assign({}, defaultBrowserOptions, {
// Only the first argument is fixed, others are optional.
ignoreDefaultArgs: [defaultArgs[0]],
})
);
const spawnargs = browser.process().spawnargs;
if (!spawnargs) {
throw new Error('spawnargs not present');
}
expect(spawnargs.indexOf(defaultArgs[0])).toBe(-1);
expect(spawnargs.indexOf(defaultArgs[1])).not.toBe(-1);
await browser.close();
});

it('should have default URL when launching browser', async function () {
const { defaultBrowserOptions, puppeteer } = getTestState();
const browser = await puppeteer.launch(defaultBrowserOptions);
Expand Down

0 comments on commit 6a35320

Please sign in to comment.