feat(launcher): allow options to be passed into puppeteer.defaultArgs (#2950)

This commit is contained in:
Joel Einbinder
2018-08-07 13:22:04 -07:00
committed by Andrey Lushnikov
parent 2e0007669d
commit 6825088644
5 changed files with 85 additions and 70 deletions

View File

@@ -60,7 +60,6 @@ module.exports.addTests = function({testRunner, expect, PROJECT_ROOT, defaultBro
await rmAsync(downloadsFolder);
});
});
describe('Puppeteer.launch', function() {
it('should reject all promises when browser is closed', async() => {
const browser = await puppeteer.launch(defaultBrowserOptions);
@@ -135,8 +134,10 @@ module.exports.addTests = function({testRunner, expect, PROJECT_ROOT, defaultBro
await rmAsync(userDataDir).catch(e => {});
});
it('should return the default chrome arguments', async() => {
const args = puppeteer.defaultArgs();
expect(args).toContain('--no-first-run');
expect(puppeteer.defaultArgs()).toContain('--no-first-run');
expect(puppeteer.defaultArgs()).toContain('--headless');
expect(puppeteer.defaultArgs({headless: false})).not.toContain('--headless');
expect(puppeteer.defaultArgs({userDataDir: 'foo'})).toContain('--user-data-dir=foo');
});
it('should dump browser process stderr', async({server}) => {
const dumpioTextToLog = 'MAGIC_DUMPIO_TEST';
@@ -183,7 +184,6 @@ module.exports.addTests = function({testRunner, expect, PROJECT_ROOT, defaultBro
});
it('should support the pipe argument', async() => {
const options = Object.assign({}, defaultBrowserOptions);
options.ignoreDefaultArgs = true;
options.args = ['--remote-debugging-pipe'].concat(options.args);
const browser = await puppeteer.launch(options);
expect(browser.wsEndpoint()).toBe('');