In the documentation provided by Capybara, you can change the default_driver on a specific test group:
describe 'some stuff which requires js', :js => true do
it 'will use the default js driver'
it 'will switch to one specific driver', :driver => :selenium
end
What if I wanted to do this for a specific cucumber test group? How would I add those parameters?
When /^I do something$/ do
fill_in "a_text_box", :with => "stuff"
fill_in "another_text_box", :with => "another_thing"
end
Thanks!
In cucumber, I’ve done this in two steps:
In
/features/support/env.rb, place the following line:Then in the cucumber feature, just before the specific scenario, add
@javascriptjust before the scenario — like this:This tells cucumber to use the
javascriptdriver when it runs that particular scenario.This is how I’ve done this using Capybara Webkit — I’m sure other drivers are similar.