devops: remove warnings when running under root without sandbox (#3749)

As discussed offline, our testing scenarios assume running trusted
web content - so this warning is just a noise for this usecases.

When it comes to dealing with untrusted web content though, automation
authors need to make sure to not launch browsers under root in the first
place.
This commit is contained in:
Andrey Lushnikov 2020-09-02 18:02:11 -07:00 committed by GitHub
parent 2d46cd8105
commit 7671e8e8be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View File

@ -89,10 +89,8 @@ export class Chromium extends BrowserTypeBase {
if (browserArguments.indexOf('--no-sandbox') !== -1)
return browserArguments;
const runningAsRoot = process.geteuid && process.geteuid() === 0;
if (runningAsRoot) {
console.warn('WARNING: Playwright is being run under "root" user - disabling Chromium sandbox! Run under regular user to get rid of this warning.');
if (runningAsRoot)
return ['--no-sandbox', ...browserArguments];
}
return browserArguments;
}

View File

@ -153,10 +153,8 @@ export class Electron {
if (os.platform() === 'linux') {
const runningAsRoot = process.geteuid && process.geteuid() === 0;
if (runningAsRoot && electronArguments.indexOf('--no-sandbox') === -1) {
console.warn('WARNING: Playwright is being run under "root" user - disabling Electron sandbox! Run under regular user to get rid of this warning.');
if (runningAsRoot && electronArguments.indexOf('--no-sandbox') === -1)
electronArguments.push('--no-sandbox');
}
}
const { launchedProcess, gracefullyClose, kill } = await launchProcess({