1 |
efrain |
1 |
@core
|
|
|
2 |
Feature: Change password
|
|
|
3 |
In order to ensure the password change works as expected
|
|
|
4 |
As a user
|
|
|
5 |
I need to test all the way to change my password
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| testuser | Test | User | moodle@example.com |
|
|
|
11 |
|
|
|
12 |
Scenario: A user can change his password manually
|
|
|
13 |
Given I am on site homepage
|
|
|
14 |
And I log in as "testuser"
|
|
|
15 |
And I follow "Preferences" in the user menu
|
|
|
16 |
When I follow "Change password"
|
|
|
17 |
And I set the field "Current password" to "testuser"
|
|
|
18 |
And I set the field "New password" to "NewPassword1*"
|
|
|
19 |
And I set the field "New password (again)" to "NewPassword1*"
|
|
|
20 |
And I click on "Save changes" "button"
|
|
|
21 |
Then I should see "Password has been changed"
|
|
|
22 |
And I click on "Continue" "button"
|
|
|
23 |
And I should see "Preferences" in the "region-main" "region"
|
|
|
24 |
And I log out
|
|
|
25 |
And I follow "Log in"
|
|
|
26 |
And I set the field "Username" to "testuser"
|
|
|
27 |
And I set the field "Password" to "NewPassword1*"
|
|
|
28 |
And I press "Log in"
|
|
|
29 |
Then I should see "You are logged in as Test User" in the "page-footer" "region"
|
|
|
30 |
|
|
|
31 |
Scenario: A user with expired password must change it when log in directly and then be redirected to the home page
|
|
|
32 |
Given I force a password change for user "testuser"
|
|
|
33 |
And I log in as "testuser"
|
|
|
34 |
And I should see "You must change your password to proceed"
|
|
|
35 |
When I set the field "Current password" to "testuser"
|
|
|
36 |
And I set the field "New password" to "NewPassword1*"
|
|
|
37 |
And I set the field "New password (again)" to "NewPassword1*"
|
|
|
38 |
And I click on "Save changes" "button"
|
|
|
39 |
Then I should see "Password has been changed"
|
|
|
40 |
And I click on "Continue" "button"
|
|
|
41 |
And I am on site homepage
|
|
|
42 |
|
|
|
43 |
@javascript
|
|
|
44 |
Scenario: A user with expired password trying to visit a required login page must change and it and then be redirected to this page
|
|
|
45 |
Given I force a password change for user "testuser"
|
|
|
46 |
And the following "courses" exist:
|
|
|
47 |
| fullname | shortname | visible |
|
|
|
48 |
| Course 1 | c1 | 1 |
|
|
|
49 |
And the following "course enrolments" exist:
|
|
|
50 |
| user | course | role |
|
|
|
51 |
| testuser | c1 | student |
|
|
|
52 |
When I follow "Log in"
|
|
|
53 |
And I set the field "Username" to "testuser"
|
|
|
54 |
And I set the field "Password" to "testuser"
|
|
|
55 |
And I press "Log in"
|
|
|
56 |
Then I should see "You must change your password to proceed"
|
|
|
57 |
And I set the field "Current password" to "testuser"
|
|
|
58 |
And I set the field "New password" to "NewPassword1*"
|
|
|
59 |
And I set the field "New password (again)" to "NewPassword1*"
|
|
|
60 |
And I click on "Save changes" "button"
|
|
|
61 |
And I should see "Password has been changed"
|
|
|
62 |
And I click on "Continue" "button"
|
|
|
63 |
And I am on site homepage
|
|
|
64 |
And I should see "Course 1"
|