From 5d04e297755c4a8b4e908f706d272520521341d4 Mon Sep 17 00:00:00 2001 From: Renaud Chaput Date: Thu, 15 Aug 2024 08:45:00 +0200 Subject: [PATCH] Disable Chrome's search engine selection screen when running system specs (#31437) --- spec/support/capybara.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/spec/support/capybara.rb b/spec/support/capybara.rb index be1378ffa..4357d5138 100644 --- a/spec/support/capybara.rb +++ b/spec/support/capybara.rb @@ -6,14 +6,20 @@ Capybara.app_host = "http://#{Capybara.server_host}:#{Capybara.server_port}" require 'selenium/webdriver' +def common_chrome_options + options = Selenium::WebDriver::Chrome::Options.new + options.add_argument '--window-size=1680,1050' + options.add_argument '--disable-search-engine-choice-screen' + options +end + Capybara.register_driver :chrome do |app| - Capybara::Selenium::Driver.new(app, browser: :chrome) + Capybara::Selenium::Driver.new(app, browser: :chrome, options: common_chrome_options) end Capybara.register_driver :headless_chrome do |app| - options = Selenium::WebDriver::Chrome::Options.new + options = common_chrome_options options.add_argument '--headless=new' - options.add_argument '--window-size=1680,1050' Capybara::Selenium::Driver.new( app,