Sha256: a6e4892f2cd4b6003a88d5a7bce2ac563d923c24912ea663c494d82ba65e0494

Contents?: true

Size: 971 Bytes

Versions: 11

Compression:

Stored size: 971 Bytes

Contents

<% if automation == 'selenium' -%>
      def new_driver(*opts)
      @config = YAML.load_file('config/config.yml')
      browser = @config['browser'].to_sym
      @driver = 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 new_driver
    platform = config['platform'].to_s
    @driver = Appium::Driver.new({ caps: caps[platform] })
  end
<% else -%>
  def new_driver
    @driver = Appium::Driver.new({ caps: caps })
  end
<% end -%>

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ruby_raider-0.7.1 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.7.0 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.6.9 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.6.8 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.6.7 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.6.6 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.6.5 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.6.4 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.6.3 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.6.2 lib/generators/templates/helpers/partials/driver_and_options.tt
ruby_raider-0.6.1 lib/generators/templates/helpers/partials/driver_and_options.tt