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

Cucumber/capybara/sauce failing on CircleCI #260

Open dankohn opened 10 years ago

dankohn commented 10 years ago

My Cucumber/Capybara/Sauce setup works fine on OS X but it is failing on CircleCI. Specifically, CircleCI can successfully create a tunnel, but then simply hangs when trying to start a cucumber session:

ubuntu@box111:~/chewy$ bundle exec cucumber features/ --format pretty

Here is features/support/sauce_helper.rb:

require "capybara/rails"
require "sauce/cucumber"

Sauce.config do |config|
  config[:start_tunnel] = false
  config[:browsers] = [
    ["Windows 8.1", "googlechrome", "36"],
    ["Windows 8.1", "firefox", "31"],
    ["Windows 7", "Internet Explorer", "8"],
  ]
  config[:name] = "#{`basename $(git rev-parse --show-toplevel)`}"
  config[:build] = "#{`git rev-parse --short HEAD`}"
  config[:tags] = [ ENV['CI'] ? "CI" : `whoami`, "#{`git rev-parse --abbrev-ref HEAD`}" ]
end

Capybara.server_port = 9887

Capybara.default_driver = :sauce
Capybara.javascript_driver = :sauce

And here is my circle.yml:

dependencies:
  post:
    - wget https://saucelabs.com/downloads/sc-latest-linux.tar.gz
    - tar -xzf sc-latest-linux.tar.gz
test:
  override:
    - ./bin/sc -u $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY -f ~/sc_ready:
        background: true
        pwd: sc-*-linux
    # Wait for tunnel to be ready
    - while [ ! -e ~/sc_ready ]; do sleep 1; done
    - bundle exec cucumber features/ --format pretty

As part of debugging, I ssh'ed into a CircleCI virtual machine, ran bundle exec rails server -p 9887 and was able to connect to the server via a Sauce interactive browser session. So, I know the Sauce Connect tunneling is working correctly.

My suspicion is that the problem is in the sauce_ruby gem, because bundle exec rspec also hangs when I have gem 'sauce', '3.4.9' in my Gemfile but works correctly when I remove it (and I'm not even using sauce for any RSpec tests). However, everything works fine on my OS X machine, making this painful to debug.

darend commented 9 years ago

This may help you, it worked for us: https://github.com/saucelabs/sauce_ruby/issues/231