|
7 | 7 |
|
8 | 8 | # Set Chrome version you want to use |
9 | 9 | CAPYBARA_JAVASCRIPT_DRIVER_VERSION = ENV.fetch('CAPYBARA_JAVASCRIPT_DRIVER_VERSION', "135") |
| 10 | +# Make sure Selenium downloads this version of Chrome |
10 | 11 | ENV['SE_BROWSER_VERSION'] = CAPYBARA_JAVASCRIPT_DRIVER_VERSION |
11 | 12 |
|
12 | 13 | Capybara.javascript_driver = ENV.fetch('CAPYBARA_JAVASCRIPT_DRIVER', "solidus_chrome_headless").to_sym |
|
20 | 21 | opts.add_argument("--no-sandbox") |
21 | 22 | opts.add_argument("--window-size=#{CAPYBARA_WINDOW_SIZE}") |
22 | 23 | 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 | + |
24 | 38 | opts.browser_version = CAPYBARA_JAVASCRIPT_DRIVER_VERSION |
25 | 39 | end |
26 | 40 | Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options) |
|
0 commit comments