Merge pull request #3486 from devendram/cukes-refactor
Refactored cucumber features, steps, and support helpers for change pass...
This commit is contained in:
commit
6494b14fb2
4 changed files with 60 additions and 11 deletions
|
|
@ -4,9 +4,7 @@ Feature: Change password
|
||||||
Scenario: Change my password
|
Scenario: Change my password
|
||||||
Given I am signed in
|
Given I am signed in
|
||||||
When I go to the users edit page
|
When I go to the users edit page
|
||||||
And I put in my password in "user_current_password"
|
And I fill out change password section with my password and "newsecret" and "newsecret"
|
||||||
And I fill in "user_password" with "newsecret"
|
|
||||||
And I fill in "user_password_confirmation" with "newsecret"
|
|
||||||
And I press "Change password"
|
And I press "Change password"
|
||||||
Then I should see "Password changed"
|
Then I should see "Password changed"
|
||||||
Then I should be on the new user session page
|
Then I should be on the new user session page
|
||||||
|
|
@ -15,13 +13,12 @@ Feature: Change password
|
||||||
|
|
||||||
Scenario: Reset my password
|
Scenario: Reset my password
|
||||||
Given a user with email "forgetful@users.net"
|
Given a user with email "forgetful@users.net"
|
||||||
Given I am on the new user password page
|
Given I am on forgot password page
|
||||||
And I fill in "Email" with "Forgetful@users.net"
|
When I fill out forgot password form with "Forgetful@users.net"
|
||||||
And I press "Send me reset password instructions"
|
And I submit forgot password form
|
||||||
Then I should see "You will receive an email with instructions"
|
Then I should see "You will receive an email with instructions"
|
||||||
And I follow the "Change my password" link from the last sent email
|
When I follow the "Change my password" link from the last sent email
|
||||||
Then I should see "Change my password"
|
Then I should see "Change my password"
|
||||||
And I fill in "Password" with "supersecret"
|
When I fill out reset password form with "supersecret" and "supersecret"
|
||||||
And I fill in "Password confirmation" with "supersecret"
|
And I submit reset password form
|
||||||
And I press "Change my password"
|
|
||||||
Then I should be on the stream page
|
Then I should be on the stream page
|
||||||
|
|
@ -36,6 +36,26 @@ When /^I put in my password in "([^"]*)"$/ do |field|
|
||||||
step %(I fill in "#{field}" with "#{@me.password}")
|
step %(I fill in "#{field}" with "#{@me.password}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I fill out change password section with my password and "([^"]*)" and "([^"]*)"$/ do |new_pass, confirm_pass|
|
||||||
|
fill_change_password_section(@me.password, new_pass, confirm_pass)
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I fill out forgot password form with "([^"]*)"$/ do |email|
|
||||||
|
fill_forgot_password_form(email)
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I submit forgot password form$/ do
|
||||||
|
submit_forgot_password_form
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I fill out reset password form with "([^"]*)" and "([^"]*)"$/ do |new_pass,confirm_pass|
|
||||||
|
fill_reset_password_form(new_pass, confirm_pass)
|
||||||
|
end
|
||||||
|
|
||||||
|
When /^I submit reset password form$/ do
|
||||||
|
submit_reset_password_form
|
||||||
|
end
|
||||||
|
|
||||||
When /^I (?:log|sign) out$/ do
|
When /^I (?:log|sign) out$/ do
|
||||||
logout
|
logout
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,8 @@ module NavigationHelpers
|
||||||
person_path(@me.person, :ex => true)
|
person_path(@me.person, :ex => true)
|
||||||
when /^the new stream$/
|
when /^the new stream$/
|
||||||
stream_path(:ex => true)
|
stream_path(:ex => true)
|
||||||
|
when /^forgot password page$/
|
||||||
|
new_user_password_path
|
||||||
when /^"(\/.*)"/
|
when /^"(\/.*)"/
|
||||||
$1
|
$1
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,40 @@ module UserCukeHelpers
|
||||||
$browser.delete_all_visible_cookies if $browser
|
$browser.delete_all_visible_cookies if $browser
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# go to user menu, expand it, and click logout
|
||||||
def manual_logout
|
def manual_logout
|
||||||
find("#user_menu li:first-child a").click
|
find("#user_menu li:first-child a").click
|
||||||
find("#user_menu li:last-child a").click
|
find("#user_menu li:last-child a").click
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# fill change password section on the user edit page
|
||||||
|
def fill_change_password_section(cur_pass, new_pass, confirm_pass)
|
||||||
|
fill_in 'user_current_password', :with => cur_pass
|
||||||
|
fill_in 'user_password', :with => new_pass
|
||||||
|
fill_in 'user_password_confirmation', :with => confirm_pass
|
||||||
|
end
|
||||||
|
|
||||||
|
# fill forgot password form to get reset password link
|
||||||
|
def fill_forgot_password_form(email)
|
||||||
|
fill_in 'user_email', :with => email
|
||||||
|
end
|
||||||
|
|
||||||
|
# submit forgot password form to get reset password link
|
||||||
|
def submit_forgot_password_form
|
||||||
|
find("#new_user input.button").click
|
||||||
|
end
|
||||||
|
|
||||||
|
# fill the reset password form
|
||||||
|
def fill_reset_password_form(new_pass, confirm_pass)
|
||||||
|
fill_in 'user_password', :with => new_pass
|
||||||
|
fill_in 'user_password_confirmation', :with => confirm_pass
|
||||||
|
end
|
||||||
|
|
||||||
|
# submit reset password form
|
||||||
|
def submit_reset_password_form
|
||||||
|
find(".button").click
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
World(UserCukeHelpers)
|
World(UserCukeHelpers)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue