/
authenticate_users.feature
152 lines (135 loc) · 5.3 KB
/
authenticate_users.feature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
@users
@admin
Feature: User Authentication
Scenario: Forgot password
Given I have no users
And the following activated user exists
| login | password |
| sam | secret |
And all emails have been delivered
When I am on the home page
And I fill in "User name" with "sam"
And I fill in "Password" with "test"
And I press "Log In"
Then I should see "The password or user name you entered doesn't match our records"
And I should see "Forgot your password or user name?"
When I follow "Reset password"
Then I should see "Please tell us the user name or email address you used when you signed up for your Archive account"
When I fill in "reset_password_for" with "sam"
And I press "Reset Password"
Then 1 email should be delivered
And the email should contain "the following generated password has been created for you"
And the email should contain "sam"
And the email should not contain "translation missing"
# old password should still work
When I am on the homepage
And I fill in "User name" with "sam"
And I fill in "Password" with "secret"
And I press "Log In"
Then I should see "Hi, sam"
# password from email should also work
When I am logged out
And I fill in "User name" with "sam"
And I fill in "sam"'s temporary password
And I press "Log In"
Then I should see "Hi, sam"
And I should see "Change My Password"
# and I should be able to change the password
When I fill in "New password" with "newpass"
And I fill in "Confirm new password" with "newpass"
And I press "Change Password"
Then I should see "Your password has been changed"
# old password should no longer work
When I am logged out
When I am on the homepage
And I fill in "User name" with "sam"
And I fill in "Password" with "secret"
And I press "Log In"
Then I should not see "Hi, sam"
# generated password should no longer work
When I am logged out
When I am on the homepage
And I fill in "User name" with "sam"
And I fill in "sam"'s temporary password
And I press "Log In"
Then I should not see "Hi, sam"
# new password should work
When I am logged out
When I am on the homepage
And I fill in "User name" with "sam"
And I fill in "Password" with "newpass"
And I press "Log In"
Then I should see "Hi, sam"
Scenario: invalid user
Given I have loaded the fixtures
When I am on the home page
And I follow "Forgot password?"
When I fill in "reset_password_for" with "testuser"
And I press "Reset Password"
Then I should see "Check your email"
And 1 email should be delivered
# password from email should work
When I fill in "User name" with "testuser"
And I fill in "testuser"'s temporary password
And I press "Log In"
Then I should see "Hi, testuser"
And I should see "Change My Password"
# and I should be able to change the password
When I fill in "New password" with "newpas"
And I fill in "Confirm new password" with "newpas"
And I press "Change Password"
Then I should see "Your password has been changed"
# new password should work
When I am logged out
When I am on the homepage
And I fill in "User name" with "testuser"
And I fill in "Password" with "newpas"
And I press "Log In"
Then I should see "Hi, testuser"
Scenario: Wrong username
Given I have no users
And the following activated user exists
| login | password |
| sam | secret |
And all emails have been delivered
When I am on the home page
And I fill in "User name" with "sammy"
And I fill in "Password" with "test"
And I press "Log In"
Then I should see "The password or user name you entered doesn't match our records."
Scenario: Wrong username
Given I have no users
And the following activated user exists
| login | password |
| sam | secret |
And all emails have been delivered
When I am on the home page
And I fill in "User name" with "sam"
And I fill in "Password" with "tester"
And I press "Log In"
Then I should see "The password or user name you entered doesn't match our records. Please try again or follow the 'Forgot password?' link below."
Scenario: Logged out
Given I have no users
And a user exists with login: "sam"
When I am on sam's user page
Then I should see "Log In"
And I should not see "Log Out"
And I should not see "Preferences"
# TODO make this an actual test - it's been 4 years...
Scenario Outline: Show or hide preferences link
Given I have no users
And the following activated users exist
| login | password |
| sam | secret |
| dean | secret |
And I am logged in as "<login>" with password "secret"
When I am on <user>'s user page
Then I should <action>
Examples:
| login | user | action |
| sam | sam | not see "Log In" |
| sam | sam | see "Log Out" |
| sam | sam | see "Preferences" within "#dashboard" |
| sam | dean | see "Log Out" |
| sam | dean | not see "Preferences" within "#dashboard" |
| sam | dean | not see "Log In" |