Sha256: a1fc9543184b5a1ff8cee3a6e7fa55d112d5b8df0bd2080fc02df9bb1907a0bc

Contents?: true

Size: 1.4 KB

Versions: 4

Compression:

Stored size: 1.4 KB

Contents

<% if automation == 'selenium' && axe? == true -%>
  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 automation == 'selenium' -%>
  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 automation == 'cross_platform' -%>
  def create_driver
    platform = config['platform'].to_s
    @driver = Appium::Driver.new({ caps: caps[platform] })
  end

  def config
     YAML.load_file('config/config.yml')
  end
<% else -%>
  def create_driver
    @driver = Appium::Driver.new({ caps: caps })
  end
<% end -%>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby_raider-0.9.1 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.9.0 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.8.9 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.8.8 lib/generators/templates/helpers/partials/driver_and_options.tt