add cucumber scenarios for new preferences

This commit is contained in:
Reinier Balt 2011-08-18 12:48:59 +02:00
parent 555311b681
commit 40a7cc2d3a
9 changed files with 70 additions and 11 deletions

View file

@ -10,10 +10,33 @@ Feature: Manage preferences
And I have logged in as "testuser" with password "secret"
Scenario: I can change my password
Given this is a pending scenario
When I go to the preferences page
And I set the password and confirmation to "secret123"
When I log out of Tracks
And I go to the login page
And I submit the login form as user "testuser" with password "secret"
Then I should see "Login unsuccessful"
When I submit the login form as user "testuser" with password "secret123"
Then I should see "Login successful"
Scenario: I can leave password field empty and the password will not be changed
When I go to the preferences page
And I set the password and confirmation to ""
When I log out of Tracks
And I go to the login page
And I submit the login form as user "testuser" with password ""
Then I should see "Login unsuccessful"
When I submit the login form as user "testuser" with password "secret"
Then I should see "Login successful"
Scenario: The password and the confirmation need to be the same
When I go to the preferences page
And I set the password to "secret" and confirmation to "wrong"
Then I should see "Password doesn't match confirmation"
Scenario: I can generate a new token
Given this is a pending scenario
Scenario: I can edit preferences
Given this is a pending scenario
When I go to the preferences page
Then I should see "Logout (testuser)"
When I edit my last name to "Tester"
Then I should see "Logout (Tester)"

View file

@ -25,10 +25,14 @@ When /^my session expires$/ do
# use expire_session to force expiry of session
js = '$.ajax({type: "GET", url: "/login/expire_session", dataType: "script", async: false});'
selenium.run_script(js);
# force check of expiry bypassing timeout
js = '$.ajax({type: "GET", url: "/login/check_expiry", dataType: "script", async: false});'
selenium.run_script(js);
sleep(2)
end
When /^I log out of Tracks$/ do
When "I go to the logout page"
end

View file

@ -0,0 +1,15 @@
When /^I edit my last name to "([^"]*)"$/ do |last_name|
fill_in "user[last_name]", :with => last_name
click_button "prefs_submit"
end
When /^I set the password and confirmation to "([^"]*)"$/ do |new_password|
When "I set the password to \"#{new_password}\" and confirmation to \"#{new_password}\""
end
When /^I set the password to "([^"]*)" and confirmation to "([^"]*)"$/ do |new_password, new_password_confirmation|
fill_in "user[password]", :with => new_password
fill_in "user[password_confirmation]", :with => new_password_confirmation
click_button "prefs_submit"
end

View file

@ -2,7 +2,7 @@ Given /^the following user records?$/ do |table|
User.delete_all
table.hashes.each do |hash|
user = Factory(:user, hash)
user.create_preference
user.create_preference({:locale => 'en'})
end
end

View file

@ -55,6 +55,8 @@ module NavigationHelpers
signup_path(options)
when /the login page/
login_path(options)
when /the logout page/
logout_path(options)
when /the notes page/
notes_path(options)
when /the calendar page/