Skip to content

Commit 008f4aa

Browse files
committed
Add more chrome flags
Found in ref: teamcapybara/capybara#2796
1 parent 65edf9e commit 008f4aa

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

lib/solidus_dev_support/rspec/capybara.rb

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
# Set Chrome version you want to use
99
CAPYBARA_JAVASCRIPT_DRIVER_VERSION = ENV.fetch('CAPYBARA_JAVASCRIPT_DRIVER_VERSION', "135")
10+
# Make sure Selenium downloads this version of Chrome
1011
ENV['SE_BROWSER_VERSION'] = CAPYBARA_JAVASCRIPT_DRIVER_VERSION
1112

1213
Capybara.javascript_driver = ENV.fetch('CAPYBARA_JAVASCRIPT_DRIVER', "solidus_chrome_headless").to_sym
@@ -20,7 +21,20 @@
2021
opts.add_argument("--no-sandbox")
2122
opts.add_argument("--window-size=#{CAPYBARA_WINDOW_SIZE}")
2223
opts.add_argument("--disable-search-engine-choice-screen")
23-
opts.add_argument("--disable-backgrounding-occluded-windows")
24+
25+
# From https://github.com/teamcapybara/capybara/issues/2796
26+
# Chrome flags found from:
27+
# - https://peter.sh/experiments/chromium-command-line-switches/
28+
# - https://github.com/GoogleChrome/chrome-launcher/blob/main/docs/chrome-flags-for-tools.md
29+
#
30+
# Disable timers being throttled in background pages/tabs. Useful for parallel test runs.
31+
opts.add_argument("disable-background-timer-throttling")
32+
# Normally, Chrome will treat a "foreground" tab instead as backgrounded if the surrounding window is occluded (aka
33+
# visually covered) by another window. This flag disables that. Useful for parallel test runs.
34+
opts.add_argument("disable-backgrounding-occluded-windows")
35+
# This disables non-foreground tabs from getting a lower process priority. Useful for parallel test runs.
36+
opts.add_argument("disable-renderer-backgrounding")
37+
2438
opts.browser_version = CAPYBARA_JAVASCRIPT_DRIVER_VERSION
2539
end
2640
Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)

0 commit comments

Comments
 (0)