From 1a9d34b10386bbda3e9e22a960cfeb9ce819b2c2 Mon Sep 17 00:00:00 2001 From: josemigallas Date: Mon, 23 Sep 2024 11:45:52 +0200 Subject: [PATCH] updates capybara's headless_chrome options --- features/support/capybara.rb | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/features/support/capybara.rb b/features/support/capybara.rb index 94a7360374..ba46d63044 100644 --- a/features/support/capybara.rb +++ b/features/support/capybara.rb @@ -90,6 +90,7 @@ def is_a?(klass) Capybara.register_driver :chrome do |app| options = Selenium::WebDriver::Chrome::Options.new options.add_argument('--window-size=1280,2048') + options.add_argument('--disable-search-engine-choice-screen') Capybara::Selenium::Driver.new(app, browser: :chrome, options: options) end @@ -100,19 +101,23 @@ def is_a?(klass) options.add_argument('--no-sandbox') options.add_argument('--disable-popup-blocking') options.add_argument('--window-size=1280,2048') - options.add_argument('--host-resolver-rules=MAP * ~NOTFOUND , EXCLUDE *.localhost') + options.add_argument('--host-resolver-rules=MAP * ~NOTFOUND , EXCLUDE *localhost*') + options.add_argument('--disable-search-engine-choice-screen') options.add_preference(:browser, set_download_behavior: { behavior: 'allow' }) options.add_option(:w3c, false) - options.add_option(:perfLoggingPrefs, {enableNetwork: true}) + options.add_option(:perfLoggingPrefs, { enableNetwork: true }) caps = Selenium::WebDriver::Remote::Capabilities.chrome( - loggingPrefs: {performance: 'ALL', browser: 'ALL'} + loggingPrefs: { performance: 'ALL', browser: 'ALL' } ) client = Selenium::WebDriver::Remote::Http::Default.new client.read_timeout = client.open_timeout = 120 # default 60 - driver = Capybara::Selenium::Driver.new(app, browser: :chrome, options: options, http_client: client, desired_capabilities: caps) + driver = Capybara::Selenium::Driver.new(app, browser: :chrome, + options: options, + http_client: client, + desired_capabilities: caps) driver end