Sha256: 1ecfbb35e23981a49ff015990f423936d7494ce3c3e1f5d6b36df25a8da61cf3

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 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

      def create_options(*opts)
        browser = @config['browser'] == :ie ? @config['browser'].to_s.upcase : @config['browser'].to_s.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

1 entries across 1 versions & 1 rubygems

Version Path
ruby_raider-0.4.3 lib/generators/templates/helpers/partials/driver_and_options.tt