sauce-archives / sauce_ruby

This is the Ruby client adapter for testing with Sauce Labs, a Selenium-based browser testing service (saucelabs.com).
Apache License 2.0
98 stars 115 forks source link

Jenkins parallel features undefined method browser #332

Closed drewbailey closed 9 years ago

drewbailey commented 9 years ago

Hi we are running into an issue trying to run

bundle exec rake sauce:features test_files='features/integration.feature' 

and are running into the follow error. I couldn't find where exactly browser should be coming from.

undefined local variable or method `browser' for Sauce::Capybara::Cucumber:Module (NameError)
  /var/lib/jenkins/.rvm/gems/ruby-2.1.2@sauce-labs/gems/sauce-cucumber-3.5.1/lib/sauce/cucumber.rb:118:in `block in around_hook'
  /var/lib/jenkins/.rvm/gems/ruby-2.1.2@sauce-labs/gems/sauce-3.5.6/lib/sauce/test_base.rb:17:in `block in test_each'
  /var/lib/jenkins/.rvm/gems/ruby-2.1.2@sauce-labs/gems/sauce-3.5.6/lib/sauce/test_base.rb:6:in `each'
  /var/lib/jenkins/.rvm/gems/ruby-2.1.2@sauce-labs/gems/sauce-3.5.6/lib/sauce/test_base.rb:6:in `test_each'
  /var/lib/jenkins/.rvm/gems/ruby-2.1.2@sauce-labs/gems/sauce-cucumber-3.5.1/lib/sauce/cucumber.rb:96:in `around_hook'
  /var/lib/jenkins/.rvm/gems/ruby-2.1.2@sauce-labs/gems/sauce-cucumber-3.5.1/lib/sauce/cucumber.rb:163:in `Around'

Any help would be greatly appreciated.

drewbailey commented 9 years ago

Corresponding sauce_helper.rb file

require 'sauce'
require 'sauce/cucumber'
require 'sauce/capybara'

Sauce.config do |config|
  config[:application_host] = "https://#{ENV['STACK_URL']}"
  config[:start_tunnel] = ENV['START_TUNNEL']
  config[:start_local_application] = false
  config[:browsers] = [
    ['Windows 8', 'Chrome', nil],
    ['Windows 7', 'Firefox', '20'],
    ['OS X 10.10', 'chrome', '39.0'],
    ['Windows 7', 'Internet Explorer', '9'],
    ['iPhone Simulator', 'iphone'],
    ['Windows 8.1', 'Internet Explorer', '11'],
    ['Windows 8.1', 'Internet Explorer', '11']
  ]

  config[:sauce_connect_4_executable] = ENV['SAUCE_CONNECT_LOC']
end
drewbailey commented 9 years ago

After a little more digging it only happens when ENV['JENKINS_SERVER_COOKIE'] is defined. It is worth noting this works locally, and our jenkins has the on demand plugin installed but we are not using it for any of our job configuration.