Sha256: 13e74aeb21a57fa9ebe019054ab0124c62f1128eeea5b4a6d495ffaaa97a7c03

Contents?: true

Size: 1.02 KB

Versions: 3

Compression:

Stored size: 1.02 KB

Contents

require "govuk_test/railtie" if defined?(Rails)
require "govuk_test/version"

require "capybara"
require "puma"
require "selenium-webdriver"

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
  Selenium::WebDriver::Chrome::Service.driver_path = Webdrivers::Chromedriver.update
end

module GovukTest
  def self.configure
    Capybara.register_driver :headless_chrome do |app|
      Capybara::Selenium::Driver.new(app,
                                     browser: :chrome,
                                     options: headless_chrome_selenium_options)
    end

    Capybara.javascript_driver = :headless_chrome
    Capybara.server = :puma, { Silent: true }
  end

  def self.headless_chrome_selenium_options
    Selenium::WebDriver::Chrome::Options.new.tap do |options|
      options.headless!
      options.add_argument("--no-sandbox") if ENV["GOVUK_TEST_CHROME_NO_SANDBOX"]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
govuk_test-2.1.2 lib/govuk_test.rb
govuk_test-2.1.1 lib/govuk_test.rb
govuk_test-2.1.0 lib/govuk_test.rb