Sha256: 18d90b1b41f9ce99908aebcb0541993cec93bd87078adae5135075b696b26a5a

Contents?: true

Size: 1.91 KB

Versions: 14

Compression:

Stored size: 1.91 KB

Contents

<% if axe? -%>
  def create_driver(browser, js_path, skip_iframes)
    AxeSelenium.configure(browser) do |config|
      config.jslib_path = js_path if js_path
      config.skip_iframes = skip_iframes if skip_iframes
    end.page
  end
<% elsif selenium_based? -%>
  def create_driver(*opts)
    @config = YAML.load_file('config/config.yml')
    browser = @config['browser'].to_sym
    Selenium::WebDriver.for(browser, options: create_webdriver_options(*opts))
  end

  def browser_arguments(*opts)
    opts.empty? ? @config['browser_arguments'][@config['browser']] : opts
  end

  def driver_options
    @config['driver_options']
  end

  # :reek:FeatureEnvy
  def create_webdriver_options(*opts)
    load_browser = @config['browser'].to_s
    browser = load_browser == 'ie' ? load_browser.upcase : load_browser.capitalize
    options = "Selenium::WebDriver::#{browser}::Options".constantize.new
    browser_arguments(*opts).each { |arg| options.add_argument(arg) }
    driver_options.each { |opt| options.add_option(opt.first, opt.last) }
    options
  end
<% elsif cross_platform? -%>
  def create_driver
    @driver = Appium::Driver.new({ caps: parsed_caps })
  end

  def platform
    @platform ||= YAML.load_file('config/config.yml')['platform'].to_s
  end

  def platform_caps
    @platform_caps ||= YAML.load_file('config/capabilities.yml')[platform]
  end

  # :reek:UtilityFunction
  def parsed_caps
    platform_caps['appium:options']['app'] = parse_app_path(platform_caps['appium:options']['app'])
    platform_caps
  end

  def parse_app_path(path)
    File.expand_path(path, Dir.pwd)
  end
<% else -%>
  def create_driver
    @driver = Appium::Driver.new({ caps: parsed_caps })
  end

  # :reek:UtilityFunction
  def parsed_caps
    caps = YAML.load_file('config/capabilities.yml')
    caps['appium:options']['app'] = app_path(caps['appium:options']['app'])
    caps
  end

  def app_path(path)
    File.expand_path(path, Dir.pwd)
  end
<% end -%>

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
ruby_raider-1.0.7 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-1.0.6 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-1.0.5 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-1.0.4 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-1.0.3 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-1.0.2 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-1.0.1 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-1.0.0 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.9.9 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.9.8 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.9.7 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.9.6 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.9.5 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.9.4 lib/generators/templates/helpers/partials/driver_and_options.tt