fix: use different test names for browser specific tests in launcher.spec.ts (#8250)

This commit is contained in:
Henrik Skupin 2022-04-20 11:16:42 +02:00 committed by Alex Rudenko
parent 9a9ec8f65b
commit c6cf1a9f27

View File

@ -404,44 +404,49 @@ describe('Launcher specs', function () {
await page.close(); await page.close();
await browser.close(); await browser.close();
}); });
itChromeOnly('should filter out ignored default arguments', async () => { itChromeOnly(
const { defaultBrowserOptions, puppeteer } = getTestState(); 'should filter out ignored default arguments in Chrome',
// Make sure we launch with `--enable-automation` by default. async () => {
const defaultArgs = puppeteer.defaultArgs(); const { defaultBrowserOptions, puppeteer } = getTestState();
const browser = await puppeteer.launch( // Make sure we launch with `--enable-automation` by default.
Object.assign({}, defaultBrowserOptions, { const defaultArgs = puppeteer.defaultArgs();
// Ignore first and third default argument. const browser = await puppeteer.launch(
ignoreDefaultArgs: [defaultArgs[0], defaultArgs[2]], Object.assign({}, defaultBrowserOptions, {
}) // Ignore first and third default argument.
); ignoreDefaultArgs: [defaultArgs[0], defaultArgs[2]],
const spawnargs = browser.process().spawnargs; })
if (!spawnargs) { );
throw new Error('spawnargs not present'); 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);
expect(spawnargs.indexOf(defaultArgs[2])).toBe(-1);
await browser.close();
} }
expect(spawnargs.indexOf(defaultArgs[0])).toBe(-1); );
expect(spawnargs.indexOf(defaultArgs[1])).not.toBe(-1); itFirefoxOnly(
expect(spawnargs.indexOf(defaultArgs[2])).toBe(-1); 'should filter out ignored default argument in Firefox',
await browser.close(); async () => {
}); const { defaultBrowserOptions, puppeteer } = getTestState();
itFirefoxOnly('should filter out ignored default arguments', async () => {
const { defaultBrowserOptions, puppeteer } = getTestState();
const defaultArgs = puppeteer.defaultArgs(); const defaultArgs = puppeteer.defaultArgs();
const browser = await puppeteer.launch( const browser = await puppeteer.launch(
Object.assign({}, defaultBrowserOptions, { Object.assign({}, defaultBrowserOptions, {
// Only the first argument is fixed, others are optional. // Only the first argument is fixed, others are optional.
ignoreDefaultArgs: [defaultArgs[0]], ignoreDefaultArgs: [defaultArgs[0]],
}) })
); );
const spawnargs = browser.process().spawnargs; const spawnargs = browser.process().spawnargs;
if (!spawnargs) { if (!spawnargs) {
throw new Error('spawnargs not present'); throw new Error('spawnargs not present');
}
expect(spawnargs.indexOf(defaultArgs[0])).toBe(-1);
expect(spawnargs.indexOf(defaultArgs[1])).not.toBe(-1);
await browser.close();
} }
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 () { it('should have default URL when launching browser', async function () {
const { defaultBrowserOptions, puppeteer } = getTestState(); const { defaultBrowserOptions, puppeteer } = getTestState();
const browser = await puppeteer.launch(defaultBrowserOptions); const browser = await puppeteer.launch(defaultBrowserOptions);