Sha256: 1a9ed02a637bdfc7baf90517ce2dbbdb5ad171475508b71fbaf142093ac2ca5b

Contents?: true

Size: 858 Bytes

Versions: 1

Compression:

Stored size: 858 Bytes

Contents

require "so_many_devices/version"

module SoManyDevices
  class Error < StandardError;
  end

  devices = YAML::load_file(File.join(__dir__, 'so_many_devices.yml'))

  devices.each do |device_name, options|
    standard_args = ['--disable-site-isolation-trials']
    headless_args = ['--headless', '--disable-site-isolation-trials']
    headless_args << '--disable-gpu' if Gem.win_platform?

    [[device_name.to_sym, standard_args], ["#{device_name}_headless".to_sym, headless_args]].each do |device_name, args|
      Capybara.register_driver device_name.to_sym do |app|
        capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(
            'goog:chromeOptions' => { args: args, mobileEmulation: options }
        )
        Capybara::Selenium::Driver.new(app, browser: :chrome, desired_capabilities: capabilities)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
so_many_devices-0.1.0 lib/so_many_devices.rb