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 @javascript @gradereport @gradereport_grader
2
Feature: Within the grader report, test that we can search for users
3
  In order to find specific users in the course gradebook
4
  As a teacher
5
  I need to be able to see the search input and trigger the search somehow
6
 
7
  Background:
8
    Given the following "courses" exist:
9
      | fullname | shortname | category | groupmode |
10
      | Course 1 | C1        | 0        | 1         |
11
    And the following "users" exist:
12
      | username | firstname | lastname | email                | idnumber | phone1     | phone2     | department | institution | city    | country  |
13
      | teacher1 | Teacher   | 1        | teacher1@example.com | t1       | 1234567892 | 1234567893 | ABC1       | ABCD        | Perth   | AU       |
14
      | student1 | Student   | 1        | student1@example.com | s1       | 3213078612 | 8974325612 | ABC1       | ABCD        | Hanoi   | VN       |
15
      | student2 | Dummy     | User     | student2@example.com | s2       | 4365899871 | 7654789012 | ABC2       | ABCD        | Tokyo   | JP       |
16
      | student3 | User      | Example  | student3@example.com | s3       | 3243249087 | 0875421745 | ABC2       | ABCD        | Olney   | GB       |
17
      | student4 | User      | Test     | student4@example.com | s4       | 0987532523 | 2149871323 | ABC3       | ABCD        | Tokyo   | JP       |
18
      | student5 | Turtle    | Manatee  | student5@example.com | s5       | 1239087780 | 9873623589 | ABC3       | ABCD        | Perth   | AU       |
19
    And the following "course enrolments" exist:
20
      | user     | course | role           |
21
      | teacher1 | C1     | editingteacher |
22
      | student1 | C1     | student        |
23
      | student2 | C1     | student        |
24
      | student3 | C1     | student        |
25
      | student4 | C1     | student        |
26
      | student5 | C1     | student        |
27
    And the following "groups" exist:
28
      | name          | course | idnumber |
29
      | Default group | C1     | dg       |
30
    And the following "group members" exist:
31
      | user     | group |
32
      | student5 | dg    |
33
    And the following "activities" exist:
34
      | activity | course | idnumber | name                |
35
      | assign   | C1     | a1       | Test assignment one |
36
    And the following config values are set as admin:
37
      | showuseridentity | idnumber,email,city,country,phone1,phone2,department,institution |
38
    And I am on the "Course 1" "grades > Grader report > View" page logged in as "teacher1"
39
    And I change window size to "large"
40
 
41
  Scenario: A teacher can view and trigger the user search
42
    # Check the placeholder text
43
    Given I should see "Search users"
44
    # Confirm the search is currently inactive and results are unfiltered.
45
    And the following should exist in the "user-grades" table:
46
      | -1-                |
47
      | Turtle Manatee     |
48
      | Student 1          |
49
      | User Example       |
50
      | User Test          |
51
      | Dummy User         |
52
    And the following should not exist in the "user-grades" table:
53
      | -1-                |
54
      | Teacher 1          |
55
    When I set the field "Search users" to "Turtle"
56
    And I wait until "View all results (1)" "option_role" exists
57
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
58
    And I confirm "User Example" in "user" search within the gradebook widget does not exist
59
    And I click on "Turtle Manatee" "list_item"
60
    # Business case: This will trigger a page reload and can not dynamically update the table.
61
    And I wait until the page is ready
62
    Then the following should exist in the "user-grades" table:
63
      | -1-                |
64
      | Turtle Manatee     |
65
    And the following should not exist in the "user-grades" table:
66
      | -1-                |
67
      | Teacher 1          |
68
      | Student 1          |
69
      | User Example       |
70
      | User Test          |
71
      | Dummy User         |
72
    And I set the field "Search users" to "Turt"
73
    And I wait until "View all results (1)" "option_role" exists
74
    And I click on "Clear search input" "button" in the ".user-search" "css_element"
75
    And "View all results (1)" "option_role" should not be visible
76
 
77
  Scenario: A teacher can search the grader report to find specified users
78
    # Case: Standard search.
79
    Given I click on "Dummy" in the "user" search widget
80
    And the following should exist in the "user-grades" table:
81
      | -1-                |
82
      | Dummy User         |
83
    And the following should not exist in the "user-grades" table:
84
      | -1-                |
85
      | Teacher 1          |
86
      | Student 1          |
87
      | User Example       |
88
      | User Test          |
89
      | Turtle Manatee     |
90
 
91
    # Case: No users found.
92
    When I set the field "Search users" to "Plagiarism"
93
    And I should see "No results for \"Plagiarism\""
94
    # Table remains unchanged as the user had no results to select from the dropdown.
95
    And the following should exist in the "user-grades" table:
96
      | -1-                |
97
      | Dummy User         |
98
    And the following should not exist in the "user-grades" table:
99
      | -1-                |
100
      | Teacher 1          |
101
      | Student 1          |
102
      | User Example       |
103
      | User Test          |
104
      | Turtle Manatee     |
105
 
106
    # Case: Multiple users found and select only one result.
107
    Then I set the field "Search users" to "User"
108
    And I wait until "View all results (3)" "option_role" exists
109
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
110
    And I confirm "User Example" in "user" search within the gradebook widget exists
111
    And I confirm "User Test" in "user" search within the gradebook widget exists
112
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget does not exist
113
    # Check if the matched field names (by lines) includes some identifiable info to help differentiate similar users.
114
    And I confirm "User (student2@example.com)" in "user" search within the gradebook widget exists
115
    And I confirm "User (student3@example.com)" in "user" search within the gradebook widget exists
116
    And I confirm "User (student4@example.com)" in "user" search within the gradebook widget exists
117
    And I click on "Dummy User" "list_item"
118
    And I wait until the page is ready
119
    And the following should exist in the "user-grades" table:
120
      | -1-                |
121
      | Dummy User         |
122
    And the following should not exist in the "user-grades" table:
123
      | -1-                |
124
      | Teacher 1          |
125
      | Student 1          |
126
      | User Example       |
127
      | User Test          |
128
      | Turtle Manatee     |
129
 
130
    # Business case: When searching with multiple partial matches, show the matches in the dropdown + a "View all results for (Bob)"
131
    # Business case cont. When pressing enter with multiple partial matches, behave like when you select the "View all results for (Bob)"
132
    # Case: Multiple users found and select all partial matches.
133
    And I set the field "Search users" to "User"
134
    And I wait until "View all results (3)" "option_role" exists
135
    # Dont need to check if all users are in the dropdown, we checked that earlier in this test.
136
    And I click on "View all results (3)" "option_role"
137
    And I wait until the page is ready
138
    And the following should exist in the "user-grades" table:
139
      | -1-                |
140
      | Dummy User         |
141
      | User Example       |
142
      | User Test          |
143
    And the following should not exist in the "user-grades" table:
144
      | -1-                |
145
      | Teacher 1          |
146
      | Student 1          |
147
      | Turtle Manatee     |
148
    And I click on "Clear" "link" in the ".user-search" "css_element"
149
    And I wait until the page is ready
150
    And the following should exist in the "user-grades" table:
151
      | -1-                |
152
      | Turtle Manatee     |
153
      | Student 1          |
154
      | User Example       |
155
      | User Test          |
156
      | Dummy User         |
157
 
158
  Scenario: A teacher can quickly tell that a search is active on the current table
159
    When I click on "Turtle" in the "user" search widget
160
    # 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.
161
    Then the field "Search users" matches value "Turtle Manatee"
162
    # Test if we can then further retain the turtle result set and further filter from there.
163
    And I set the field "Search users" to "Turtle plagiarism"
164
    And "Turtle Manatee" "list_item" should not be visible
165
    And I should see "No results for \"Turtle plagiarism\""
166
 
167
  Scenario: A teacher can search for values besides the users' name
168
    Given I set the field "Search users" to "student5@example.com"
169
    And I wait until "View all results (1)" "option_role" exists
170
    And "Turtle Manatee" "list_item" should exist
171
    And I set the field "Search users" to "@example.com"
172
    And I wait until "View all results (5)" "option_role" exists
173
    # Note: All learners match this email & showing emails is current default.
174
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
175
    And I confirm "User Example" in "user" search within the gradebook widget exists
176
    And I confirm "User Test" in "user" search within the gradebook widget exists
177
    And I confirm "Student 1" in "user" search within the gradebook widget exists
178
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
179
 
180
    # Search on the country field.
181
    When I set the field "Search users" to "JP"
182
    And I wait until "Turtle Manatee" "list_item" does not exist
183
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
184
    And I confirm "User Test" in "user" search within the gradebook widget exists
185
 
186
    # Search on the city field.
187
    And I set the field "Search users" to "Hanoi"
188
    And I wait until "User Test" "list_item" does not exist
189
    Then I confirm "Student 1" in "user" search within the gradebook widget exists
190
 
191
    # Search on the institution field.
192
    And I set the field "Search users" to "ABCD"
193
    And I wait until "Dummy User" "list_item" exists
194
    And I confirm "User Example" in "user" search within the gradebook widget exists
195
    And I confirm "User Test" in "user" search within the gradebook widget exists
196
    And I confirm "Student 1" in "user" search within the gradebook widget exists
197
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
198
 
199
      # Search on the department field.
200
    And I set the field "Search users" to "ABC3"
201
    And I wait until "User Example" "list_item" does not exist
202
    And I confirm "User Test" in "user" search within the gradebook widget exists
203
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
204
 
205
    # Search on the phone1 field.
206
    And I set the field "Search users" to "4365899871"
207
    And I wait until "User Test" "list_item" does not exist
208
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
209
 
210
    # Search on the phone2 field.
211
    And I set the field "Search users" to "2149871323"
212
    And I wait until "Dummy User" "list_item" does not exist
213
    And I confirm "User Test" in "user" search within the gradebook widget exists
214
 
215
    # Search on the institution field then press enter to show the record set.
216
    And I set the field "Search users" to "ABC"
217
    And I wait until "Turtle Manatee" "list_item" exists
218
    And I confirm "Dummy User" in "user" search within the gradebook widget exists
219
    And I confirm "User Example" in "user" search within the gradebook widget exists
220
    And I confirm "User Test" in "user" search within the gradebook widget exists
221
    And I confirm "Student 1" in "user" search within the gradebook widget exists
222
    And I press the down key
223
    And I press the enter key
224
    And I wait "1" seconds
225
    And the following should exist in the "user-grades" table:
226
      | -1-                |
227
      | Student 1          |
228
    And the following should not exist in the "user-grades" table:
229
      | -1-                |
230
      | User Example       |
231
      | User Test          |
232
      | Dummy User         |
233
      | Turtle Manatee     |
234
      | Teacher 1          |
235
 
236
  @accessibility
237
  Scenario: A teacher can set focus and search using the input are with a keyboard
238
    Given I set the field "Search users" to "ABC"
239
    And the focused element is "Search users" "field"
240
    And I wait until "Turtle Manatee" "option_role" exists
241
    # Basic tests for the page.
242
    When the page should meet accessibility standards
243
    And the page should meet "wcag131, wcag141, wcag412" accessibility standards
244
    And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
245
    And I press the down key
246
    And ".active" "css_element" should exist in the "Student 1" "option_role"
247
    And I press the up key
248
    And ".active" "css_element" should exist in the "View all results (5)" "option_role"
249
    And I press the down key
250
    And ".active" "css_element" should exist in the "Student 1" "option_role"
251
    And I press the escape key
252
    And the focused element is "Search users" "field"
253
    Then I set the field "Search users" to "Goodmeme"
254
    And I press the down key
255
    And the focused element is "Search users" "field"
256
 
257
    And I navigate to "View > Grader report" in the course gradebook
258
    And I set the field "Search users" to "ABC"
259
    And I wait until "Turtle Manatee" "option_role" exists
260
    And I press the down key
261
    And ".active" "css_element" should exist in the "Student 1" "option_role"
262
 
263
    # Lets check the tabbing order.
264
    And I set the field "Search users" to "ABC"
265
    And I click on "Search users" "field"
266
    And I wait until "Turtle Manatee" "option_role" exists
267
    And I press the tab key
268
    And the focused element is "Clear search input" "button"
269
    And I press the tab key
270
    And ".groupsearchwidget" "css_element" should exist
271
    # Ensure we can interact with the input & clear search options with the keyboard.
272
    # Space & Enter have the same handling for triggering the two functionalities.
273
    And I set the field "Search users" to "User"
274
    And I press the up key
275
    And I press the enter key
276
    And I wait to be redirected
11 efrain 277
    # Sometimes with behat we get unattached nodes causing spurious failures.
278
    And I wait "1" seconds
1 efrain 279
    And the following should exist in the "user-grades" table:
280
      | -1-                |
281
      | Dummy User         |
282
      | User Example       |
283
      | User Test          |
284
    And the following should not exist in the "user-grades" table:
285
      | -1-                |
286
      | Teacher 1          |
287
      | Student 1          |
288
      | Turtle Manatee     |
11 efrain 289
    And I set the field "Search users" to "ABC"
290
    And I wait until "Turtle Manatee" "option_role" exists
291
    And I press the tab key
292
    And the focused element is "Clear search input" "button"
293
    And I press the enter key
294
    And I wait until the page is ready
295
    And I confirm "Turtle Manatee" in "user" search within the gradebook widget does not exist
1 efrain 296
 
297
  Scenario: Once a teacher searches, it'll apply the currently set filters and inform the teacher as such
298
    # Set up a basic filtering case.
299
    Given I click on "Filter by name" "combobox"
300
    And I select "U" in the "First name" "core_grades > initials bar"
301
    And I select "E" in the "Last name" "core_grades > initials bar"
302
    And I press "Apply"
303
    And I wait until the page is ready
304
    And the following should exist in the "user-grades" table:
305
      | -1-                |
306
      | User Example       |
307
    And the following should not exist in the "user-grades" table:
308
      | -1-                |
309
      | Teacher 1          |
310
      | Student 1          |
311
      | User Test          |
312
      | Dummy User         |
313
      | Turtle Manatee     |
314
 
315
    # Begin the search checking if we are adhering the filters.
316
    When I set the field "Search users" to "Turtle"
317
    Then I confirm "Turtle Manatee" in "user" search within the gradebook widget does not exist
318
 
319
  Scenario: A teacher can reset the search and filters all at once
320
    Given I set the field "Search users" to "Turtle"
321
    And I click on "Turtle Manatee" "option_role"
322
    And I wait until the page is ready
323
    And the following should exist in the "user-grades" table:
324
      | -1-                |
325
      | Turtle Manatee     |
326
    And I click on "Filter by name" "combobox"
327
    And I select "T" in the "First name" "core_grades > initials bar"
328
    And I select "M" in the "Last name" "core_grades > initials bar"
329
    And the following should exist in the "user-grades" table:
330
      | -1-                |
331
      | Turtle Manatee     |
332
    And I click on "Default group" in the "group" search widget
333
    And the following should exist in the "user-grades" table:
334
      | -1-                |
335
      | Turtle Manatee     |
336
    And I wait until the page is ready
337
    When I click on "Clear all" "link" in the ".tertiary-navigation" "css_element"
338
    And I wait until the page is ready
339
    Then the field "Search users" matches value ""
340
 
341
  Scenario: As a teacher I can dynamically find users whilst ignoring pagination
342
    Given "42" "users" exist with the following data:
343
      | username  | students[count]             |
344
      | firstname | Student                     |
345
      | lastname  | s[count]                    |
346
      | email     | students[count]@example.com |
347
    And "42" "course enrolments" exist with the following data:
348
      | user   | students[count] |
349
      | course | C1              |
350
      | role   |student          |
351
    And I reload the page
352
    And the field "perpage" matches value "20"
353
    When I set the field "Search users" to "42"
354
    # One of the users' phone numbers also matches.
355
    And I wait until "View all results (2)" "option_role" exists
356
    Then I confirm "Student s42" in "user" search within the gradebook widget exists
357
 
358
  Scenario: As a teacher I save grades using search and pagination
359
    Given "42" "users" exist with the following data:
360
      | username  | students[count]             |
361
      | firstname | Student                     |
362
      | lastname  | test[count]                 |
363
      | email     | students[count]@example.com |
364
    And "42" "course enrolments" exist with the following data:
365
      | user   | students[count] |
366
      | course | C1              |
367
      | role   |student          |
368
    And I reload the page
369
    And I turn editing mode on
370
    And the field "perpage" matches value "20"
371
    And I click on user profile field menu "fullname"
372
    And I choose "Ascending" in the open action menu
373
    And I wait until the page is ready
374
    # Search for a single user on second page and save grades.
375
    When I set the field "Search users" to "test32"
376
    And I wait until "View all results (1)" "option_role" exists
377
    And I click on "Student test32" "option_role"
378
    And I wait until the page is ready
379
    And I give the grade "80.00" to the user "Student test32" for the grade item "Test assignment one"
380
    And I press "Save changes"
381
    And I wait until the page is ready
382
    Then the field "Search users" matches value "Student test32"
383
    And the following should exist in the "user-grades" table:
384
      | -1-                   |
385
      | Student test32        |
386
    And I set the field "Search users" to "test3"
387
    And I click on "Student test31" "option_role"
388
    And I wait until the page is ready
389
    And I give the grade "70.00" to the user "Student test31" for the grade item "Test assignment one"
390
    And I press "Save changes"
391
    And I wait until the page is ready
392
    Then the field "Search users" matches value "Student test31"
393
    And the following should exist in the "user-grades" table:
394
      | -1-                   |
395
      | Student test31        |
396
    And the following should not exist in the "user-grades" table:
397
      | -1-                   |
398
      | Student test32        |
399
    And I click on "Clear" "link" in the ".user-search" "css_element"
400
    And I wait until the page is ready
401
    And the following should not exist in the "user-grades" table:
402
      | -1-                   |
403
      | Student test32        |
404
    And I click on "2" "link" in the ".stickyfooter .pagination" "css_element"
405
    And I wait until the page is ready
406
    And the following should exist in the "user-grades" table:
407
      | -1-                   |
408
      | Student test31        |
409
      | Student test32        |
410
    # Set grade for a single user on second page without search and save grades.
411
    And I give the grade "70.00" to the user "Student test31" for the grade item "Test assignment one"
412
    And I press "Save changes"
413
    And I wait until the page is ready
414
    # We are still on second page.
415
    And the following should exist in the "user-grades" table:
416
      | -1-                   |
417
      | Student test31        |
418
      | Student test32        |
419
    # Search for multiple users on second page and save grades.
420
    And I set the field "Search users" to "test3"
421
    And I wait until "View all results (11)" "option_role" exists
422
    And I click on "View all results (11)" "option_role"
423
    And I wait until the page is ready
424
    And I give the grade "10.00" to the user "Student test32" for the grade item "Test assignment one"
425
    And I give the grade "20.00" to the user "Student test30" for the grade item "Test assignment one"
426
    And I give the grade "30.00" to the user "Student test31" for the grade item "Test assignment one"
427
    And I give the grade "40.00" to the user "Student test3" for the grade item "Test assignment one"
428
    And I press "Save changes"
429
    And I wait until the page is ready
430
    Then the field "Search users" matches value "test3"
431
    And the following should exist in the "user-grades" table:
432
      | -1-                   |
433
      | Student test3         |
434
      | Student test30        |
435
      | Student test31        |
436
      | Student test32        |
437
    And the following should not exist in the "user-grades" table:
438
      | -1-                   |
439
      | Student test1         |
440
      | Student test2         |
441
      | Student test4         |