test: setup sandbox on linux (#3530)

Drop all the `--no-sandbox` bits from tests and infrastructure. Instead, configure
Travis to enable user namespace clone.
This commit is contained in:
Andrey Lushnikov
2018-11-12 23:26:16 -08:00
committed by GitHub
parent 10a4c8c123
commit eb7bd9d7d3
10 changed files with 24 additions and 14 deletions

View File

@@ -55,7 +55,6 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions})
const extensionOptions = Object.assign({}, defaultBrowserOptions, {
headless: false,
args: [
'--no-sandbox',
`--disable-extensions-except=${extensionPath}`,
`--load-extension=${extensionPath}`,
],

View File

@@ -116,7 +116,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions})
it('userDataDir argument', async({server}) => {
const userDataDir = await mkdtempAsync(TMP_FOLDER);
const options = Object.assign({}, defaultBrowserOptions);
options.args = [`--user-data-dir=${userDataDir}`].concat(options.args);
options.args = [`--user-data-dir=${userDataDir}`].concat(options.args || []);
const browser = await puppeteer.launch(options);
expect(fs.readdirSync(userDataDir).length).toBeGreaterThan(0);
await browser.close();
@@ -209,7 +209,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions})
});
it('should support the pipe argument', async() => {
const options = Object.assign({}, defaultBrowserOptions);
options.args = ['--remote-debugging-pipe'].concat(options.args);
options.args = ['--remote-debugging-pipe'].concat(options.args || []);
const browser = await puppeteer.launch(options);
expect(browser.wsEndpoint()).toBe('');
const page = await browser.newPage();
@@ -256,7 +256,7 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions})
it('should have custom url when launching browser', async function({server}) {
const customUrl = server.PREFIX + '/empty.html';
const options = Object.assign({}, defaultBrowserOptions);
options.args = [customUrl].concat(options.args);
options.args = [customUrl].concat(options.args || []);
const browser = await puppeteer.launch(options);
const pages = await browser.pages();
expect(pages.length).toBe(1);

View File

@@ -47,7 +47,6 @@ const defaultBrowserOptions = {
slowMo,
headless,
dumpio: (process.env.DUMPIO || 'false').trim().toLowerCase() === 'true',
args: ['--no-sandbox']
};
let parallel = 1;