diff --git a/test/test_helper.rb b/test/test_helper.rb index 59cdead96..2abbc2f16 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -11,8 +11,23 @@ Dir[Rails.root.join('test/support/*.rb')].each { |f| require f } -Capybara.default_driver = :selenium_chrome_headless -Capybara.javascript_driver = :selenium_chrome_headless +Capybara.register_driver :headless_chrome do |app| + capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( + chromeOptions: { args: %w(headless disable-gpu no-sandbox) } + ) + client = Selenium::WebDriver::Remote::Http::Default.new + client.timeout = 90 # Asset compilation can result in a timeout on the first request hence the increase. + + Capybara::Selenium::Driver.new( + app, + browser: :chrome, + desired_capabilities: capabilities, + http_client: client + ) +end + +Capybara.default_driver = :headless_chrome +Capybara.javascript_driver = :headless_chrome GovukAbTesting.configure do |config| config.acceptance_test_framework = :active_support