Sha256: 58ca905183c2cf492aeb8c23eb02a5931256abd58b87de36a1e718c1f21e9ff3

Contents?: true

Size: 1.1 KB

Versions: 1

Compression:

Stored size: 1.1 KB

Contents

require 'ie/version'
require 'ie/ie_common'

module IE
  def self.init_envs
    setup_ie9_env
    setup_ie10_env
  end

  def self.setup_ie9_env
    ENV[IE9_VM_NAME] = get_ie_vm_ip(9)

    if ENV[IE9_VM_NAME].present? and ( ENV[IE9_VM_NAME].size > 0 )
      setup_ie_env(IE9_VM_NAME)
    end
  end

  def self.setup_ie10_env
    ENV[IE10_VM_NAME] = get_ie_vm_ip(10)

    if ENV[IE10_VM_NAME].present? and ( ENV[IE10_VM_NAME].size > 0 )
      setup_ie_env(IE10_VM_NAME)
    end
  end

  private

  def self.setup_ie_env(ie_vm_name)
    puts "configuring selenium driver to point to #{ie_vm_name} VM at #{ENV[ie_vm_name]}"
    ie_vm_ip = `VBoxManage guestproperty get "#{ie_vm_name}" '/VirtualBox/GuestInfo/Net/0/V4/IP' | awk '{print $NF}'`[0..-2]
    selenium_server_url = "http://#{ie_vm_ip}:4444/wd/hub"

    Capybara.register_driver :selenium do |app|
      Capybara::Selenium::Driver.new(app,
                                     :browser => :remote,
                                     :url => selenium_server_url,
                                     :desired_capabilities => :internet_explorer
      )
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ie-0.0.6 lib/ie.rb