Merge pull request #6525 from sarithats/change_password_feature_spec
Feature spec for change password on mobile website
This commit is contained in:
commit
907514b43c
3 changed files with 71 additions and 0 deletions
55
features/mobile/change_password.feature
Normal file
55
features/mobile/change_password.feature
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
@javascript @mobile
|
||||||
|
Feature: Change password
|
||||||
|
As a mobile user
|
||||||
|
I want to Change my password
|
||||||
|
|
||||||
|
|
||||||
|
Scenario: Change my password
|
||||||
|
Given I am signed in
|
||||||
|
When I go to the users edit page
|
||||||
|
And I fill out change password section with my password and "newsecret" and "newsecret"
|
||||||
|
And I press "Change password"
|
||||||
|
Then I should see "Password changed"
|
||||||
|
And I should be on the new user session page
|
||||||
|
When I sign in with password "newsecret"
|
||||||
|
Then I should be on the stream page
|
||||||
|
|
||||||
|
Scenario: Attempt to change my password with invalid input
|
||||||
|
Given I am signed in
|
||||||
|
When I go to the edit user page
|
||||||
|
And I fill out change password section with my password and "too" and "short"
|
||||||
|
And I press "Change password"
|
||||||
|
Then I should see "Password is too short"
|
||||||
|
And I should see "Password confirmation doesn't match"
|
||||||
|
|
||||||
|
Scenario: Reset my password
|
||||||
|
Given a user named "Georges Abitbol" with email "forgetful@users.net"
|
||||||
|
And I am on forgot password page
|
||||||
|
When I fill out forgot password form with "forgetful@users.net"
|
||||||
|
And I submit forgot password form
|
||||||
|
Then I should see "You will receive an email with instructions"
|
||||||
|
When I follow the "Change my password" link from the last sent email
|
||||||
|
And I fill out reset password form with "supersecret" and "supersecret"
|
||||||
|
And I submit reset password form
|
||||||
|
Then I should be on the stream page
|
||||||
|
When I sign out manually on the mobile website
|
||||||
|
And I sign in manually as "georges_abitbol" with password "supersecret" on the mobile website
|
||||||
|
Then I should be on the stream page
|
||||||
|
|
||||||
|
Scenario: Attempt to reset password with invalid password
|
||||||
|
Given a user named "Georges Abitbol" with email "forgetful@users.net"
|
||||||
|
And I am on forgot password page
|
||||||
|
When I fill out forgot password form with "forgetful@users.net"
|
||||||
|
And I submit forgot password form
|
||||||
|
And I follow the "Change my password" link from the last sent email
|
||||||
|
And I fill out reset password form with "too" and "short"
|
||||||
|
And I press "Change my password"
|
||||||
|
Then I should be on the user password page
|
||||||
|
And I should see "Password is too short"
|
||||||
|
And I should see "Password confirmation doesn't match"
|
||||||
|
|
||||||
|
Scenario: Attempt to reset password with invalid email
|
||||||
|
Given I am on forgot password page
|
||||||
|
When I fill out forgot password form with "notanemail"
|
||||||
|
And I submit forgot password form
|
||||||
|
Then I should see "No account with this email exists"
|
||||||
|
|
@ -28,6 +28,13 @@ When /^I (?:sign|log) in as "([^"]*)" on the mobile website$/ do |email|
|
||||||
confirm_login_mobile
|
confirm_login_mobile
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I (?:sign|log) in manually as "([^"]*)" with password "([^"]*)" on the mobile website$/ do |username, password|
|
||||||
|
@me = User.find_by_username(username)
|
||||||
|
@me.password ||= password
|
||||||
|
manual_login
|
||||||
|
confirm_login_mobile
|
||||||
|
end
|
||||||
|
|
||||||
When /^I (?:sign|log) in with password "([^"]*)"$/ do |password|
|
When /^I (?:sign|log) in with password "([^"]*)"$/ do |password|
|
||||||
@me.password = password
|
@me.password = password
|
||||||
automatic_login
|
automatic_login
|
||||||
|
|
@ -66,6 +73,10 @@ When /^I (?:log|sign) out manually$/ do
|
||||||
manual_logout
|
manual_logout
|
||||||
end
|
end
|
||||||
|
|
||||||
|
When /^I (?:log|sign) out manually on the mobile website$/ do
|
||||||
|
manual_logout_mobile
|
||||||
|
end
|
||||||
|
|
||||||
Then(/^I should not be able to sign up$/) do
|
Then(/^I should not be able to sign up$/) do
|
||||||
confirm_not_signed_up
|
confirm_not_signed_up
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,11 @@ module UserCukeHelpers
|
||||||
find("#user_menu li:last-child a").click
|
find("#user_menu li:last-child a").click
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def manual_logout_mobile
|
||||||
|
find("#menu-badge").click
|
||||||
|
find("#drawer ul li:last-child a").click
|
||||||
|
end
|
||||||
|
|
||||||
def fill_in_new_user_form
|
def fill_in_new_user_form
|
||||||
@username = "ohai"
|
@username = "ohai"
|
||||||
fill_in('user_username', with: @username)
|
fill_in('user_username', with: @username)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue