Skip to content

Instantly share code, notes, and snippets.

@thomasbrus
Created October 25, 2011 20:40
Show Gist options
  • Save thomasbrus/4132b186811c0fa0386a to your computer and use it in GitHub Desktop.
Save thomasbrus/4132b186811c0fa0386a to your computer and use it in GitHub Desktop.
#
# TODO test for password expirying
#
@javascript
Feature: Recover password
In order to not having to contact my manager when I forgot my password
As an employee
I want to be able to reset the password myself
Background:
Given an employee exists with username "dummy" and email "dummy@example.com" and extern_id "123"
@username_as_login @reset_password
Scenario: Resetting password using username
Given I reset my password using "dummy" as login
Then "dummy@example.com" should receive an email with password reset instructions
When I follow the link in the email
Then I should see "Please enter a new password"
When I change my password using "743539" as password
Then I should see "Your password has been updated"
When I follow "You can now login"
Then I should be on the login page
@email_as_login @reset_password
Scenario: Resetting password using email
Given I reset my password using "dummy@example.com" as login
Then "dummy@example.com" should receive an email with password reset instructions
When I follow the link in the email
Then I should see "Please enter a new password"
When I change my password using "743539" as password
Then I should see "Your password has been updated"
When I follow "You can now login"
Then I should be on the login page
@supported_email_as_login @reset_password
Scenario Outline: Requesting a password reset using a supported email account
Given the following employees exist:
| username | email | extern_id |
| dummy_gmail_com | dummy@gmail.com | 124 |
| dummy_live_com | dummy@live.com | 125 |
| dummy_live_nl | dummy@live.nl | 126 |
| dummy_hotmail_com | dummy@hotmail.com | 127 |
| dummy_yahoo_com | dummy@yahoo.com | 128 |
Given I reset my password using "<email>" as login
Then I should see a link titled "Open <provider>" that goes to "http://<hostname>"
And "<email>" should receive an email with password reset instructions
@gmail
Examples: Receive password reset instructions using Gmail
| provider | email | hostname |
| Gmail | dummy@gmail.com | mail.google.com |
@windowslive
Examples: Receive password reset instructions using Windows Live
| provider | email | hostname |
| Windows Live | dummy@live.com | mail.live.com |
| Windows Live | dummy@live.nl | mail.live.com |
| Windows Live | dummy@hotmail.com | mail.live.com |
@yahoo
Examples: Receive password reset instructions using Yahoo
| provider | email | hostname |
| Yahoo | dummy@yahoo.com | mail.yahoo.com |
@errors @reset_password
Scenario: Requesting a password reset using wrong login
Given I request a password reset using "hocus-pocus" as login
Then I should see "User not found or no email set"
@errors @reset_password
Scenario: Requesting a password reset without filling out the form
Given I request a password reset using "" as login
Then I should see "Please fill in your email or username"
@errors @change_password
Scenario: Setting a new password without filling out the form
Given I have reached the change password form
When I press "Save"
Then I should see "Please enter your password twice"
@errors @change_password
Scenario: Setting a new password without filling in the same repeat password
Given I have reached the change password form
When I change my password using "743539" and "582031" as passwords
When I press "Save"
Then I should see "Passwords don't match"
@errors @change_password @validation_key
Scenario: Changing the password when the key is expired
Given I reset my password using "dummy" as login
Then "dummy@example.com" should receive an email with password reset instructions
When the validation key is expired
And I follow the link in the email
Then I should see "Validation key has expired or does not exist"
@errors @change_password @validation_key
Scenario: Changing the password when the key does not exist
Given I reset my password using "dummy" as login
Then "dummy@example.com" should receive an email with password reset instructions
When the validation key does not exist
And I follow the link in the email
Then I should see "Validation key has expired or does not exist"
@errors @io @unreachable
Scenario: Setting a new password when iO is unreachable
Given I have reached the change password form
When I change my password while iO is unavailable
Then I should see "iO is currently unavailable"
@errors @io @invalid_password
Scenario: Setting a new password that is not valid
Given I have reached the change password form
When I change my password to something invalid
Then I should see "Password is invalid"
@errors @io @employee_not_found
Scenario: Setting a new password when the employee cannot be found
Given I have reached the change password form
When I change my password but the employee cannot be found
Then I should see "Employee not found"
@errors @io @unauthorized
Scenario: Setting a new password when not authorized
Given I have reached the change password form
When I change my password but I am not authorized
Then I should see "Not authorized to change password"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment