Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_grades @gradereport_user @javascript
2
Feature: Within the User report, a teacher can search for users.
3
  Background:
4
    Given the following "courses" exist:
5
      | fullname | shortname | category | groupmode |
6
      | Course 1 | C1        | 0        | 1         |
7
      | Course 2 | C2        | 0        | 0         |
8
    And the following "users" exist:
9
      | username | firstname  | lastname | email                | idnumber | phone1     | phone2     | department | institution | city    | country  |
10
      | teacher1 | Teacher   | 1        | teacher1@example.com | t1       | 1234567892 | 1234567893 | ABC1       | ABCD        | Perth   | AU       |
11
      | student1 | Student   | 1        | student1@example.com | s1       | 3213078612 | 8974325612 | ABC1       | ABCD        | Hanoi   | VN       |
12
      | student2 | Dummy     | User     | student2@example.com | s2       | 4365899871 | 7654789012 | ABC2       | ABCD        | Tokyo   | JP       |
13
      | student3 | User      | Example  | student3@example.com | s3       | 3243249087 | 0875421745 | ABC2       | ABCD        | Olney   | GB       |
14
      | student4 | User      | Test     | student4@example.com | s4       | 0987532523 | 2149871323 | ABC3       | ABCD        | Tokyo   | JP       |
15
      | student5 | Turtle    | Manatee  | student5@example.com | s5       | 1239087780 | 9873623589 | ABC3       | ABCD        | Perth   | AU       |
16
    # Note: Add groups etc so we can test that the search ignores those filters as well if we go down the filter dataset path.
17
    And the following "course enrolments" exist:
18
      | user     | course | role           |
19
      | teacher1 | C1     | editingteacher |
20
      | teacher1 | C2     | editingteacher |
21
      | student1 | C1     | student        |
22
      | student2 | C1     | student        |
23
      | student3 | C1     | student        |
24
      | student4 | C1     | student        |
25
      | student5 | C1     | student        |
26
    And the following "activities" exist:
27
      | activity | course | idnumber | name                |
28
      | assign   | C1     | a1       | Test assignment one |
29
    And the following config values are set as admin:
30
      | showuseridentity | idnumber,email,city,country,phone1,phone2,department,institution |
31
    And I change window size to "large"
32
    And I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
33
 
34
  Scenario: A teacher can view and trigger the user search
35
    # Check the placeholder text (no users are initially shown).
36
    Given I should see "Search users"
37
    # Confirm the search is currently inactive and results are unfiltered.
38
    And I should see "Search for a user to view their report"
39
    When I set the field "Search users" to "Turtle"
40
    And "View all results (5)" "option_role" should exist
41
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
42
    And I confirm "User Example" in "user" search within the gradebook widget does not exist
43
    And I click on "Turtle Manatee" "list_item"
44
    # Business case: This will trigger a page reload and can not dynamically update the table.
45
    And I wait until the page is ready
46
    And "Turtle Manatee" "heading" should exist
47
    And "Teacher 1" "heading" should not exist
48
    And "Student 1" "heading" should not exist
49
    And "User Example" "heading" should not exist
50
    And "User Test" "heading" should not exist
51
    And "Dummy User" "heading" should not exist
52
    And I set the field "Search users" to "Turt"
53
    And "View all results (5)" "option_role" should exist
54
    And I click on "Clear search input" "button" in the ".user-search" "css_element"
55
    And "View all results (5)" "option_role" should not be visible
56
 
57
  Scenario: A teacher can search the user report to find specified users
58
    # Case: Standard search.
59
    Given I click on "Dummy" in the "user" search widget
60
    And "Dummy User" "heading" should exist
61
    And "Teacher 1" "heading" should not exist
62
    And "Student 1" "heading" should not exist
63
    And "User Example" "heading" should not exist
64
    And "User Test" "heading" should not exist
65
    And "Turtle Manatee" "heading" should not exist
66
 
67
    # Case: No users found.
68
    When I set the field "Search users" to "Plagiarism"
69
    And I should see "No results for \"Plagiarism\""
70
    # Table remains unchanged as the user had no results to select from the dropdown.
71
    And "Dummy User" "heading" should exist
72
    And "Teacher 1" "heading" should not exist
73
    And "Student 1" "heading" should not exist
74
    And "User Example" "heading" should not exist
75
    And "User Test" "heading" should not exist
76
    And "Turtle Manatee" "heading" should not exist
77
    # Case: Multiple users found and select only one result.
78
    Then I set the field "Search users" to "User"
79
    And "View all results (5)" "option_role" should exist
80
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
81
    And I confirm "User Example" in "user" search within the gradebook widget exists
82
    And I confirm "User Test" in "user" search within the gradebook widget exists
83
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget does not exist
84
    # Check if the matched field names (by lines) includes some identifiable info to help differentiate similar users.
85
    And I confirm "User (student2@example.com)" in "user" search within the gradebook widget exists
86
    And I confirm "User (student3@example.com)" in "user" search within the gradebook widget exists
87
    And I confirm "User (student4@example.com)" in "user" search within the gradebook widget exists
88
    And I click on "Dummy User" "list_item"
89
    And I wait until the page is ready
90
    And "Dummy User" "heading" should exist
91
    And "Teacher 1" "heading" should not exist
92
    And "Student 1" "heading" should not exist
93
    And "User Example" "heading" should not exist
94
    And "User Test" "heading" should not exist
95
    And "Turtle Manatee" "heading" should not exist
96
 
97
    # Business case: When searching with multiple partial matches, show the matches in the dropdown + a "View all results for (Bob)"
98
    # Business case cont. When pressing enter with multiple partial matches, behave like when you select the "View all results for (Bob)"
99
    # Case: Multiple users found and select all partial matches.
100
    And I set the field "Search users" to "User"
101
    And "View all results (5)" "option_role" should exist
102
    And I click on "View all results (5)" "option_role"
103
    And I wait until the page is ready
104
    And "Dummy User" "heading" should exist
105
    And "User Example" "heading" should exist
106
    And "User Test" "heading" should exist
107
    And "Student 1" "heading" should exist
108
    And "Turtle Manatee" "heading" should exist
109
    And "Teacher 1" "heading" should not exist
110
    And "Clear" "link" should not exist in the ".user-search" "css_element"
111
    And "Dummy User" "heading" should exist
112
    And "User Example" "heading" should exist
113
    And "User Test" "heading" should exist
114
    And "Student 1" "heading" should exist
115
    And "Turtle Manatee" "heading" should exist
116
    And "Teacher 1" "heading" should not exist
117
 
118
    # Case: No users enrolled.
119
    And I am on the "Course 2" "grades > User report > View" page
120
    And I set the field "Search users" to "a"
121
    And I should see "No results for \"a\""
122
 
123
  Scenario: A teacher can quickly tell that a search is active on the current table
124
    When I click on "Turtle" in the "user" search widget
125
    # The search input should contain the name of the user we have selected, so that it is clear that the result pertains to a specific user.
126
    Then the field "Search users" matches value "Turtle Manatee"
127
    And I wait until "View all results (5)" "link" does not exist
128
    # Test if we can then further retain the turtle result set and further filter from there.
129
    And I set the field "Search users" to "Turtle plagiarism"
130
    And I wait until "Turtle Manatee" "list_item" does not exist
131
    And I should see "No results for \"Turtle plagiarism\""
132
 
133
  Scenario: A teacher can search for values besides the users' name
134
    Given I set the field "Search users" to "student5@example.com"
135
    And "View all results (5)" "option_role" should exist
136
    And "Turtle Manatee" "list_item" should exist
137
    And I set the field "Search users" to "@example.com"
138
    And "View all results (5)" "option_role" should exist
139
    # Note: All learners match this email & showing emails is current default.
140
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
141
    And I confirm "User Example" in "user" search within the gradebook widget exists
142
    And I confirm "User Test" in "user" search within the gradebook widget exists
143
    And I confirm "Student 1" in "user" search within the gradebook widget exists
144
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
145
 
146
    # Search on the country field.
147
    When I set the field "Search users" to "JP"
148
    And "View all results (5)" "option_role" should exist
149
    And I wait until "Turtle Manatee" "list_item" does not exist
150
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
151
    And I confirm "User Test" in "user" search within the gradebook widget exists
152
 
153
    # Search on the city field.
154
    And I set the field "Search users" to "Hanoi"
155
    And I wait until "User Test" "list_item" does not exist
156
    Then I confirm "Student 1" in "user" search within the gradebook widget exists
157
 
158
    # Search on the institution field.
159
    And I set the field "Search users" to "ABCD"
160
    And "Dummy User" "list_item" should exist
161
    And I confirm "User Example" in "user" search within the gradebook widget exists
162
    And I confirm "User Test" in "user" search within the gradebook widget exists
163
    And I confirm "Student 1" in "user" search within the gradebook widget exists
164
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
165
 
166
      # Search on the department field.
167
    And I set the field "Search users" to "ABC3"
168
    And I wait until "User Example" "list_item" does not exist
169
    And I confirm "User Test" in "user" search within the gradebook widget exists
170
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
171
 
172
    # Search on the phone1 field.
173
    And I set the field "Search users" to "4365899871"
174
    And I wait until "User Test" "list_item" does not exist
175
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
176
 
177
    # Search on the phone2 field.
178
    And I set the field "Search users" to "2149871323"
179
    And I wait until "Dummy User" "list_item" does not exist
180
    And I confirm "User Test" in "user" search within the gradebook widget exists
181
 
182
    # Search on the institution field then press enter to show the record set.
183
    And I set the field "Search users" to "ABC"
184
    And "Turtle Manatee" "list_item" should exist
185
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
186
    And I confirm "User Example" in "user" search within the gradebook widget exists
187
    And I confirm "User Test" in "user" search within the gradebook widget exists
188
    And I confirm "Student 1" in "user" search within the gradebook widget exists
189
    And I press the up key
190
    And I press the enter key
191
    And I wait until the page is ready
192
    And "Student 1" "heading" should exist
193
    And "User Example" "heading" should exist
194
    And "User Test" "heading" should exist
195
    And "Dummy User" "heading" should exist
196
    And "Turtle Manatee" "heading" should exist
197
    And "Teacher 1" "heading" should not exist
198
 
11 efrain 199
  Scenario: A teacher can only search for fields that he allowed to see
200
    Given the following "permission overrides" exist:
201
      | capability                         | permission | role             | contextlevel | reference |
202
      | moodle/course:viewhiddenuserfields | Prohibit   | editingteacher   | System       |           |
203
    And the following config values are set as admin:
204
      | hiddenuserfields | email |
205
    And I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"
206
    When I set the field "Search users" to "User"
207
    And "View all results (5)" "option_role" should exist
208
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
209
    And I confirm "User Example" in "user" search within the gradebook widget exists
210
    And I confirm "User Test" in "user" search within the gradebook widget exists
211
    # Email is not shown in results.
212
    And I confirm "User" in "user" search within the gradebook widget exists
213
    And I confirm "example.com" in "user" search within the gradebook widget does not exist
214
    # Email is not searchable.
215
    And I set the field "Search users" to "student5@example.com"
216
    And "View all results (5)" "option_role" should not exist
217
    And I confirm "No results for \"student5@example.com\"" in "user" search within the gradebook widget exists
218
 
1 efrain 219
  @accessibility
220
  Scenario: A teacher can set focus and search using the input are with a keyboard
221
    Given I set the field "Search users" to "ABC"
222
    # Basic tests for the page.
223
    And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
224
    # Move onto general keyboard navigation testing.
225
    When "Turtle Manatee" "option_role" should exist
226
    And I press the down key
227
    And ".active" "css_element" should exist in the "Student 1" "option_role"
228
    And I press the up key
229
    And ".active" "css_element" should exist in the "View all results (5)" "option_role"
230
    And I press the down key
231
    And ".active" "css_element" should exist in the "Student 1" "option_role"
232
    And I press the escape key
233
    And the focused element is "Search users" "field"
234
    Then I set the field "Search users" to "Goodmeme"
235
    And I press the down key
236
    And the focused element is "Search users" "field"
237
 
238
    And I navigate to "View > User report" in the course gradebook
239
    And I set the field "Search users" to "ABC"
240
    And "Turtle Manatee" "option_role" should exist
241
    And I press the down key
242
    And ".active" "css_element" should exist in the "Student 1" "option_role"
243
 
244
    # Lets check the tabbing order.
245
    And I set the field "Search users" to "ABC"
246
    And I wait until "Clear search input" "button" exists
247
    And I click on "Search users" "field"
248
    And I press the tab key
249
    And the focused element is "Clear search input" "button" in the ".user-search" "css_element"
250
    And I press the tab key
251
    And ".groupsearchwidget" "css_element" should exist
252
    # Ensure we can interact with the input & clear search options with the keyboard.
253
    # Space & Enter have the same handling for triggering the two functionalities.
254
    And I set the field "Search users" to "User"
255
    And I press the down key
256
    And I press the enter key
257
    And I wait to be redirected
258
    And "User Example" "heading" should exist
259
    And "Dummy User" "heading" should not exist
260
    And "Student 1" "heading" should not exist
261
    And "User Test" "heading" should not exist
262
    And "Teacher 1" "heading" should not exist
263
    And "Turtle Manatee" "heading" should not exist