Sha256: 3888acf86e400591e5be7b89f9841f550e3c89ba1969a5f2319b11e3f4ebdd19

Contents?: true

Size: 1.16 KB

Versions: 15

Compression:

Stored size: 1.16 KB

Contents

require 'show_me_the_cookies'

module NdrDevSupport
  module IntegrationTesting
    module Drivers
      # A meta-driver that allows the driver to be set using the `INTEGRATION_DRIVER`
      # environment variable (e.g. for a CI matrix), assuming that driver has been pre-registered
      # with Capybara.

      # Although the aim is to move to Chrome headless, we keep poltergeist as the default
      # driver for now. For motivation behind not changing immediately, see the "Differences
      # between Poltergeist and Selenium" section of:
      #
      #   https://about.gitlab.com/2017/12/19/moving-to-headless-chrome/
      #
      module Switchable
        DEFAULT    = :poltergeist
        CONFIGURED = ENV.fetch('INTEGRATION_DRIVER', DEFAULT).to_sym

        Capybara.register_driver(:switchable) do |app|
          Capybara.drivers.fetch(CONFIGURED).call(app)
        end

        Capybara::Screenshot.register_driver(:switchable) do |driver, path|
          Capybara::Screenshot.registered_drivers.fetch(CONFIGURED).call(driver, path)
        end

        ShowMeTheCookies.register_adapter(:switchable, ShowMeTheCookies.adapters.fetch(CONFIGURED))
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
ndr_dev_support-5.8.1 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.8.0 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.7.1 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.7.0 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.6.0 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.5.0 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.4.8 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.4.7 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.4.6 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.4.5 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.4.4 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.4.3 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.4.2 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.4.1 lib/ndr_dev_support/integration_testing/drivers/switchable.rb
ndr_dev_support-5.4.0 lib/ndr_dev_support/integration_testing/drivers/switchable.rb