Sha256: ecc56dabe9e9bbf4e2d02ef99dcd15e8acfcedaabdc0dca504f2ad287ea86e26

Contents?: true

Size: 1000 Bytes

Versions: 4

Compression:

Stored size: 1000 Bytes

Contents

<% if automation == 'selenium' -%>
  def create_driver(*opts)
    @config = YAML.load_file('config/config.yml')
    browser = @config['browser'].to_sym
    Selenium::WebDriver.for(browser, options: browser_options(*opts))
  end

  def browser_options(*opts)
    opts = opts.empty? ? @config['browser_options'] : opts
    create_options(*opts)
  end

  # :reek:FeatureEnvy
  def create_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
    opts.each { |option| options.add_argument(option) }
    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.8.2 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.8.1 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.8.0 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.7.9 lib/generators/templates/helpers/partials/driver_and_options.tt