Created
June 2, 2010 21:06
-
-
Save abachman/422998 to your computer and use it in GitHub Desktop.
Accomodating rails' default javascript-driven "delete" link behavior in Cucumber.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# web_steps.rb | |
When /^I am going to confirm all js popups on this page$/ do | |
# hackish, but not unreasonable. | |
page.evaluate_script("window.alert = function(msg) { return true; }") | |
page.evaluate_script("window.confirm = function(msg) { return true; }") | |
end | |
# some_feature.feature | |
# note that "I am going to confirm..." has to be called after arriving on | |
# a page and before pressing links that use confirm (delete, in most cases) | |
@javascript | |
Scenario: Admin user should be able to delete an existing category | |
Given I am an admin user with the login "admin" and the password "password" | |
And there is a active study | |
And a category exists with name: "Behavioral", category_type: "treatment" | |
And I login as "admin" authenticating with "password" | |
When I follow "Categories" within "#treatment_lists_categories_link" | |
And I am going to confirm all js popups on this page | |
And I follow "Delete Behavioral" | |
Then I should be on the admin categories page | |
And I should not see "Behavioral" within "#content_panel" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment