In the cucumber, I did this in two stages:
In /features/support/env.rb put the following line:
Capybara.javascript_driver = :webkit
Then, in the cucumber function, immediately before the specific script, add @javascript just before the script - for example:
@javascript Scenario: Successful sign in - with no flash message if using current firefox When I'm using a current version of Firefox When I visit the practitioner home page with "jane.doe@example.com" token Then I should be signed in as practitioner "Jane Doe" And I should be on the practitioner activities welcome page And I should not see a flash message warning me I have an unsupported browser
This tells the cucumber to use the javascript driver when it runs this particular script.
Here's how I did it with Capybara Webkit - I'm sure the other drivers are similar.
Kevin bedell
source share