Module: QAT::Web::Browser::Loader

Extended by:
Loader
Includes:
Helper, Profile, Drivers::Default
Included in:
Loader
Defined in:
lib/qat/web/browser/loader.rb,
lib/qat/web/browser/firefox/loader/helper.rb

Overview

Module to load browsers and drivers from configuration files.

Since:

  • 1.0.0

Defined Under Namespace

Modules: Helper Classes: InvalidConfigurationError

Constant Summary

Constants included from Profile

Profile::ADDONS

Instance Method Summary collapse

Methods included from Helper

#load_generic_driver

Methods included from Profile

#create_profile

Methods included from Drivers::Default

#mapping

Instance Method Details

#load(file_path) ⇒ Object

Registers browser drivers in Capybara from a YAML file

Parameters:

  • file_path (String)

    file containing browser drivers

Since:

  • 1.0.0



25
26
27
28
# File 'lib/qat/web/browser/loader.rb', line 25

def load(file_path)
  controllers = HashWithIndifferentAccess.new(YAML::load(ERB.new(File.read(file_path)).result)) || {}
  load_config(controllers)
end

#load_config(config) ⇒ Object

Registers browser drivers in Capybara from a configuration hash

Parameters:

  • config (String)

    configuration hash containing browser drivers

Since:

  • 2.1.0



33
34
35
36
37
38
# File 'lib/qat/web/browser/loader.rb', line 33

def load_config(config)
  config.each do |controller, options|
    raise InvalidConfigurationError.new "No browser defined for controller #{controller}" unless options['browser']
    register_controller(controller.to_sym, options)
  end
end