2 Feature: Deleting users
3 In order to manage a Moodle site
5 I need to be able to delete users
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | user1 | User | One | one@example.com |
11 | user2 | User | Two | two@example.com |
12 | user3 | User | Three | three@example.com |
13 | user4 | User | Four | four@example.com |
14 And the following "courses" exist:
15 | fullname | shortname |
17 And the following "course enrolments" exist:
18 | user | course | role |
19 | user1 | C1 | student |
20 | user2 | C1 | student |
21 | user3 | C1 | student |
22 | user4 | C1 | student |
23 And the following config values are set as admin:
27 Scenario: Deleting one user at a time
28 When I log in as "admin"
29 And I navigate to "Users > Accounts > Bulk user actions" in site administration
30 And the "Available" select box should contain "User Four"
31 And I set the field "Available" to "User Four"
32 And I press "Add to selection"
33 And I set the field "id_action" to "Delete"
35 And I should see "Are you absolutely sure you want to completely delete the user User Four, including their enrolments, activity and other user data?"
37 And I should see "Changes saved"
38 And I press "Continue"
39 Then the "Available" select box should not contain "User Four"
40 And the "Available" select box should contain "User One"
43 Scenario: Deleting more than one user at a time
44 When I log in as "admin"
45 And I navigate to "Users > Accounts > Bulk user actions" in site administration
46 And I set the field "Available" to "User Four"
47 And I press "Add to selection"
48 And I set the field "Available" to "User Three"
49 And I press "Add to selection"
50 And I set the field "id_action" to "Delete"
52 And I should see "Are you absolutely sure you want to completely delete the user User Four, User Three, including their enrolments, activity and other user data?"
54 And I should see "Changes saved"
55 And I press "Continue"
56 Then the "Available" select box should not contain "User Four"
57 And the "Available" select box should not contain "User Three"
58 And the "Available" select box should contain "User One"
61 Scenario: Deleting users from bulk actions in the user list
62 When I log in as "admin"
63 And I navigate to "Users > Accounts > Browse list of users" in site administration
64 And I click on "User Four" "checkbox"
65 And I click on "User Three" "checkbox"
66 And I set the field "Bulk user actions" to "Delete"
67 And I should see "Are you absolutely sure you want to completely delete the user User Four, User Three, including their enrolments, activity and other user data?"
69 And I should see "Changes saved"
70 And I press "Continue"
71 And I should see "Browse list of users"
72 And I should not see "User Four"
73 And I should not see "User Three"
74 And I should see "User One"
76 @javascript @core_message
77 Scenario: Deleting users who have unread messages sent or received
78 When I log in as "user1"
79 And I send "Message 1 from user1 to user2" message to "User Two" user
81 And I log in as "user3"
82 And I send "Message 2 from user3 to user4" message to "User Four" user
84 And I log in as "admin"
85 And I navigate to "Users > Accounts > Bulk user actions" in site administration
86 And I set the field "Available" to "User One"
87 And I press "Add to selection"
88 And I set the field "Available" to "User Four"
89 And I press "Add to selection"
90 And I set the field "id_action" to "Delete"
93 Then I should see "Changes saved"
94 And I navigate to "Users > Accounts > Bulk user actions" in site administration
95 And I set the field "Available" to "User Two"
96 And I press "Add to selection"
97 And I set the field "Available" to "User Three"
98 And I press "Add to selection"
99 And I set the field "id_action" to "Delete"
102 And I should see "Changes saved"
103 And I press "Continue"
104 And the "Available" select box should not contain "User Four"
105 And the "Available" select box should not contain "User Three"
106 And the "Available" select box should not contain "User One"
107 And the "Available" select box should not contain "User Two"
110 Scenario: Deleting a bulked user
111 When I log in as "admin"
112 And I navigate to "Users > Accounts > Bulk user actions" in site administration
113 And I set the field "Available" to "User Two"
114 And I press "Add to selection"
115 And I set the field "Available" to "User One"
116 And I press "Add to selection"
117 Then I should see "User One"
118 And I navigate to "Users > Accounts > Browse list of users" in site administration
119 And I press "Delete" action in the "User One" report row
120 And I click on "Delete" "button" in the "Delete user" "dialogue"
121 And I navigate to "Users > Accounts > Bulk user actions" in site administration
122 Then I should not see "User One"