Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several updates/fixes to the options passed to browsers #277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 33 additions & 25 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,37 @@ function sanitizeJSFlags (flag) {
return flag.replace(startExp, '--js-flags=').replace(endExp, '')
}

function getOptions (userDataDir, flags, url) {
// These are all the default options
return [
'--user-data-dir=' + userDataDir,

// Disable chrome features
// https://github.com/GoogleChrome/chrome-launcher/blob/master/docs/chrome-flags-for-tools.md#--enable-automation
'--enable-automation',
'--no-default-browser-check',
'--no-first-run',
'--disable-client-side-phishing-detection',
'--disable-default-apps',
'--disable-popup-blocking',
'--disable-features=Translate',
'--disable-background-timer-throttling',
'--disable-notifications',
'--mute-audio',

// Disable password prompt dialogs
// see: https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md#chromium-annoyances
'--password-store=basic',
'--use-mock-keychain',

// on macOS, disable-background-timer-throttling is not enough
// and we need disable-renderer-backgrounding too
// see https://github.com/karma-runner/karma-chrome-launcher/issues/123
'--disable-renderer-backgrounding',
'--disable-device-discovery-notifications'
].concat(flags, [url])
}

var ChromeBrowser = function (baseBrowserDecorator, args) {
baseBrowserDecorator(this)

Expand All @@ -32,22 +63,7 @@ var ChromeBrowser = function (baseBrowserDecorator, args) {
}
})

return [
'--user-data-dir=' + userDataDir,
// https://github.com/GoogleChrome/chrome-launcher/blob/master/docs/chrome-flags-for-tools.md#--enable-automation
'--enable-automation',
'--no-default-browser-check',
'--no-first-run',
'--disable-default-apps',
'--disable-popup-blocking',
'--disable-translate',
'--disable-background-timer-throttling',
// on macOS, disable-background-timer-throttling is not enough
// and we need disable-renderer-backgrounding too
// see https://github.com/karma-runner/karma-chrome-launcher/issues/123
'--disable-renderer-backgrounding',
'--disable-device-discovery-notifications'
].concat(flags, [url])
return getOptions(userDataDir, flags, url)
}
}

Expand Down Expand Up @@ -88,15 +104,7 @@ var ChromiumBrowser = function (baseBrowserDecorator, args) {
}
})

return [
'--user-data-dir=' + userDataDir,
'--no-default-browser-check',
'--no-first-run',
'--disable-default-apps',
'--disable-popup-blocking',
'--disable-translate',
'--disable-background-timer-throttling'
].concat(flags, [url])
return getOptions(userDataDir, flags, url)
}
}

Expand Down