diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 28143b48..4443e612 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -23,10 +23,22 @@ require "capybara-select2" require "faker" require "plek" -require 'webdrivers' +require "selenium-webdriver" Dir["./spec/support/*.rb"].each { |f| require f } +unless ENV['GOVUK_TEST_USE_SYSTEM_CHROMEDRIVER'] + require 'webdrivers' + + # This stop webdrivers doing a lazy check for new versions + # of chromedriver, which interferes with WebMock.disable_net_connect + if ::Selenium::WebDriver::Service.respond_to? :driver_path= + Selenium::WebDriver::Chrome::Service.driver_path = Webdrivers::Chromedriver.update + else + Selenium::WebDriver::Chrome.driver_path = Webdrivers::Chromedriver.update + end +end + RSpec.configure do |config| # rspec-expectations config goes here. You can use an alternate # assertion/expectation library such as wrong or the stdlib/minitest @@ -115,7 +127,6 @@ config.add_setting :reload_page_wait_time, default: 60 end - Capybara.register_driver :headless_chrome do |app| capabilities = Selenium::WebDriver::Remote::Capabilities.chrome( acceptInsecureCerts: true,