-
Notifications
You must be signed in to change notification settings - Fork 115
Cucumber Rails
Tag your Cucumber features with @selenium and they'll run on Sauce. It's ( almost ) that easy! (NB: These docs are in addition to the Cucumber & Capybara docs)
The Rails integration gem for Cucumber has the potential to interfere with the current (2.3.1) version of sauce/cucumber. If you are using cucumber/rails, setting up your environment like this will ensure you get the expected behaviour.
group :test do
gem "cucumber-rails", :require => false
gem "sauce-cucumber", :require => false
end
You must require the sauce-cucumber gem after the cucumber-rails gem, otherwise Capybara integration will not function correctly.
# features/support/env.rb
require "capybara/rails"
require "sauce/cucumber"
By default, tagging tests with @javascript will run them against the Capybara.javascript_driver. We set this to :sauce, so they will run against Sauce Labs OnDemand infrastructure.
To allow you to run these tests locally, set the Capybara.javascript_driver to :selenium after you require the sauce-cucumber gem:
Capybara.javascript_driver = :selenium
Now, any test tagged with @selenium will run on Sauce Labs. Any tagged with @javascript will run locally.