Skip to content

Commit

Permalink
updates capybara's headless_chrome options
Browse files Browse the repository at this point in the history
  • Loading branch information
josemigallas committed Sep 23, 2024
1 parent a8dc5c7 commit 1a9d34b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions features/support/capybara.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

0 comments on commit 1a9d34b

Please sign in to comment.