Sha256: 8ee9fdac44e86579db70f277698fce170b93a0cd8511c84f5d2afa2aa8a857c0

Contents?: true

Size: 996 Bytes

Versions: 5

Compression:

Stored size: 996 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, capabilities: 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
    caps = "Selenium::WebDriver::#{browser}::Options".constantize.new
    opts.each { |option| caps.add_argument(option) }
    caps
  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

5 entries across 5 versions & 1 rubygems

Version Path
ruby_raider-0.7.8 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.7.7 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.7.6 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.7.5 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.7.4 lib/generators/templates/helpers/partials/driver_and_options.tt