Skip to content

Instantly share code, notes, and snippets.

@jmaicher
Created December 4, 2010 20:33
Show Gist options
  • Save jmaicher/728462 to your computer and use it in GitHub Desktop.
Save jmaicher/728462 to your computer and use it in GitHub Desktop.
Confirm Alerts using Cucumber with Selenium
# create the following step to confirm the next alert
When /^(?:|I )follow "([^"]*)" and I confirm the next alert$/ do |link|
page.evaluate_script('window.confirm = function() { return true; }')
When "I follow \"#{link}\""
end
# you can use it like this
Scenario: Delete user account
Given I am on the dashboard site
When I follow "Edit user account"
When I follow "Delete user account" and I confirm the next alert
Then I should be signed out
When I try to sign in as the user
Then I should see a signin form error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment