applitools / Eyes.Selenium.Ruby

Deprecated! Applitools Eyes Ruby SDK for Selenium WebDriver
Other
11 stars 11 forks source link

Unable to run with Internet Explorer in Sauce Labs #2

Closed tourdedave closed 9 years ago

tourdedave commented 9 years ago

When running a test against Sauce Labs on Windows XP with Internet Explorer 8, I receive the following error:

/Users/tourdedave/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/rspec-expectations-3.1.2/lib/rspec/matchers.rb:938:in `method_missing': undefined method `[]' for nil:NilClass (NoMethodError)
    from /Users/tourdedave/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/eyes_selenium-2.5.0/lib/eyes_selenium/eyes/agent_connector.rb:40:in `start_session'
    from /Users/tourdedave/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/eyes_selenium-2.5.0/lib/eyes_selenium/eyes/eyes.rb:282:in `start_session'
    from /Users/tourdedave/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/eyes_selenium-2.5.0/lib/eyes_selenium/eyes/eyes.rb:307:in `check_region_'
    from /Users/tourdedave/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/eyes_selenium-2.5.0/lib/eyes_selenium/eyes/eyes.rb:151:in `check_window'
    from example_3.rb:40:in `block in <main>'
    from example_3.rb:34:in `run'
    from example_3.rb:38:in `<main>'

shell returned 1

The session gets created in Sauce Labs and then throws this error. Also, running my script against other browsers (e.g., Chrome and Firefox) works without issue. Here is the script:

require 'selenium-webdriver'
require 'rspec/expectations'
include RSpec::Matchers
require 'eyes_selenium'

def setup
  @eyes = Applitools::Eyes.new
  @eyes.api_key = ENV['APPLITOOLS_API_KEY']
  #caps = Selenium::WebDriver::Remote::Capabilities.chrome
  #caps.version  = '38'
  #caps = Selenium::WebDriver::Remote::Capabilities.firefox
  #caps.version  = '33'
  caps = Selenium::WebDriver::Remote::Capabilities.internet_explorer
  caps.version  = '8'
  caps.platform = 'Windows XP'
  @browser = Selenium::WebDriver.for(
           :remote,
           url: "http://#{ENV['SAUCE_USER']}:#{ENV['SAUCE_KEY']}@ondemand.saucelabs.com:80/wd/hub",
           desired_capabilities: caps)
  @driver = @eyes.open(app_name: 'the-internet', test_name: 'login', driver: @browser)
end

def teardown
  @eyes.close
  @browser.quit
end

def run
  setup
  yield
  teardown
end

run do
  @driver.get 'http://the-internet.herokuapp.com/login'
  @eyes.check_window('Login Page')
  @driver.find_element(id: 'username').send_keys('tomsmith')
  @driver.find_element(id: 'password').send_keys('SuperSecretPassword!')
  @driver.find_element(id: 'login').submit
  @eyes.check_window('Logged In')
  expect(@driver.find_element(css: '.flash.success').displayed?).to eql true
end
danielputerman commented 9 years ago

Thanks! The problem was with the code used to extract the viewport size from IE. Fixed in commit ff65031949ef29ad5e6246d1d1313af2b6bd0739