1 |
efrain |
1 |
@core @core_grades @gradereport_singleview @javascript
|
|
|
2 |
Feature: Within the singleview 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 > Single view > View" page logged in as "teacher1"
|
|
|
33 |
And I click on "Users" "link" in the ".page-toggler" "css_element"
|
|
|
34 |
|
|
|
35 |
Scenario: A teacher can view and trigger the user search
|
|
|
36 |
# Check the placeholder text (no users are initially shown).
|
|
|
37 |
Given I should see "Search users"
|
|
|
38 |
And I should see "Search for a user to view all their grades"
|
|
|
39 |
When I set the field "Search users" to "Turtle"
|
|
|
40 |
And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
|
|
|
41 |
And I confirm "User Example" in "user" search within the gradebook widget does not exist
|
|
|
42 |
And I click on "Turtle Manatee" "list_item"
|
|
|
43 |
# Business case: This will trigger a page reload and can not dynamically update the table.
|
|
|
44 |
And I wait until the page is ready
|
|
|
45 |
And "Turtle Manatee" "heading" should exist
|
|
|
46 |
And "Teacher 1" "heading" should not exist
|
|
|
47 |
And "Student 1" "heading" should not exist
|
|
|
48 |
And "User Example" "heading" should not exist
|
|
|
49 |
And "User Test" "heading" should not exist
|
|
|
50 |
And "Dummy User" "heading" should not exist
|
|
|
51 |
And I set the field "Search users" to "Turt"
|
|
|
52 |
And I wait until "Turtle Manatee" "option_role" exists
|
|
|
53 |
And I click on "Clear search input" "button" in the ".user-search" "css_element"
|
|
|
54 |
And "Turtle Manatee" "option_role" should not be visible
|
|
|
55 |
|
|
|
56 |
Scenario: A teacher can search the single view report to find specified users
|
|
|
57 |
# Case: Standard search.
|
|
|
58 |
Given I click on "Dummy" in the "user" search widget
|
|
|
59 |
And "Dummy User" "heading" should exist
|
|
|
60 |
And "Teacher 1" "heading" should not exist
|
|
|
61 |
And "Student 1" "heading" should not exist
|
|
|
62 |
And "User Example" "heading" should not exist
|
|
|
63 |
And "User Test" "heading" should not exist
|
|
|
64 |
And "Turtle Manatee" "heading" should not exist
|
|
|
65 |
|
|
|
66 |
# Case: No users found.
|
|
|
67 |
When I set the field "Search users" to "Plagiarism"
|
|
|
68 |
And I should see "No results for \"Plagiarism\""
|
|
|
69 |
# Table remains unchanged as the user had no results to select from the dropdown.
|
|
|
70 |
And "Dummy User" "heading" should exist
|
|
|
71 |
And "Teacher 1" "heading" should not exist
|
|
|
72 |
And "Student 1" "heading" should not exist
|
|
|
73 |
And "User Example" "heading" should not exist
|
|
|
74 |
And "User Test" "heading" should not exist
|
|
|
75 |
And "Turtle Manatee" "heading" should not exist
|
|
|
76 |
|
|
|
77 |
# Case: Multiple users found and select only one result.
|
|
|
78 |
Then I set the field "Search users" to "User"
|
|
|
79 |
And I wait until "Dummy User" "option_role" exists
|
|
|
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 |
# Case: No users enrolled.
|
|
|
98 |
And I am on the "Course 2" "grades > Single view > View" page
|
|
|
99 |
And I click on "Users" "link" in the ".page-toggler" "css_element"
|
|
|
100 |
And I set the field "Search users" to "a"
|
|
|
101 |
And I wait until "No results for \"a\"" "text" exists
|
|
|
102 |
|
|
|
103 |
Scenario: A teacher can quickly tell that a search is active on the current table
|
|
|
104 |
Given I click on "Turtle" in the "user" search widget
|
|
|
105 |
And I wait until the page is ready
|
|
|
106 |
# The search input remains in the field on reload this is in keeping with other search implementations.
|
|
|
107 |
When the field "Search users" matches value "Turtle Manatee"
|
|
|
108 |
# The users get preloaded for accessibility reasons.
|
|
|
109 |
And "Turtle Manatee" "option_role" should exist
|
|
|
110 |
# Test if we can then further retain the turtle result set and further filter from there.
|
|
|
111 |
Then I set the field "Search users" to "Turtle plagiarism"
|
|
|
112 |
And I wait until "Turtle Manatee" "option_role" does not exist
|
|
|
113 |
And I should see "No results for \"Turtle plagiarism\""
|
|
|
114 |
|
|
|
115 |
Scenario: A teacher can search for values besides the users' name
|
|
|
116 |
Given I set the field "Search users" to "student5@example.com"
|
|
|
117 |
And I wait until "Turtle Manatee" "list_item" exists
|
|
|
118 |
And I set the field "Search users" to "@example.com"
|
|
|
119 |
And I wait until "Dummy User" "list_item" exists
|
|
|
120 |
# Note: All learners match this email & showing emails is current default.
|
|
|
121 |
And I confirm "Dummy User" in "user" search within the gradebook widget exists
|
|
|
122 |
And I confirm "User Example" in "user" search within the gradebook widget exists
|
|
|
123 |
And I confirm "User Test" in "user" search within the gradebook widget exists
|
|
|
124 |
And I confirm "Student 1" in "user" search within the gradebook widget exists
|
|
|
125 |
And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
|
|
|
126 |
|
|
|
127 |
# Search on the country field.
|
|
|
128 |
When I set the field "Search users" to "JP"
|
|
|
129 |
And I wait until "Dummy User" "list_item" exists
|
|
|
130 |
And I wait until "Turtle Manatee" "list_item" does not exist
|
|
|
131 |
And I confirm "Dummy User" in "user" search within the gradebook widget exists
|
|
|
132 |
And I confirm "User Test" in "user" search within the gradebook widget exists
|
|
|
133 |
|
|
|
134 |
# Search on the city field.
|
|
|
135 |
And I set the field "Search users" to "Hanoi"
|
|
|
136 |
And I wait until "User Test" "list_item" does not exist
|
|
|
137 |
Then I confirm "Student 1" in "user" search within the gradebook widget exists
|
|
|
138 |
|
|
|
139 |
# Search on the institution field.
|
|
|
140 |
And I set the field "Search users" to "ABCD"
|
|
|
141 |
And I wait until "Dummy User" "list_item" exists
|
|
|
142 |
And I confirm "User Example" in "user" search within the gradebook widget exists
|
|
|
143 |
And I confirm "User Test" in "user" search within the gradebook widget exists
|
|
|
144 |
And I confirm "Student 1" in "user" search within the gradebook widget exists
|
|
|
145 |
And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
|
|
|
146 |
|
|
|
147 |
# Search on the department field.
|
|
|
148 |
And I set the field "Search users" to "ABC3"
|
|
|
149 |
And I wait until "User Example" "list_item" does not exist
|
|
|
150 |
And I confirm "User Test" in "user" search within the gradebook widget exists
|
|
|
151 |
And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
|
|
|
152 |
|
|
|
153 |
# Search on the phone1 field.
|
|
|
154 |
And I set the field "Search users" to "4365899871"
|
|
|
155 |
And I wait until "User Test" "list_item" does not exist
|
|
|
156 |
And I confirm "Dummy User" in "user" search within the gradebook widget exists
|
|
|
157 |
|
|
|
158 |
# Search on the phone2 field.
|
|
|
159 |
And I set the field "Search users" to "2149871323"
|
|
|
160 |
And I wait until "Dummy User" "list_item" does not exist
|
|
|
161 |
And I confirm "User Test" in "user" search within the gradebook widget exists
|
|
|
162 |
|
|
|
163 |
# Search on the institution field then press enter to show the record set.
|
|
|
164 |
And I set the field "Search users" to "ABC"
|
|
|
165 |
And "Turtle Manatee" "list_item" should exist
|
|
|
166 |
And I confirm "Dummy User" in "user" search within the gradebook widget exists
|
|
|
167 |
And I confirm "User Example" in "user" search within the gradebook widget exists
|
|
|
168 |
And I confirm "User Test" in "user" search within the gradebook widget exists
|
|
|
169 |
And I confirm "Student 1" in "user" search within the gradebook widget exists
|
|
|
170 |
And I press the down key
|
|
|
171 |
And I press the enter key
|
|
|
172 |
And I wait until the page is ready
|
|
|
173 |
And "Student 1" "heading" should exist
|
|
|
174 |
And "User Example" "heading" should not exist
|
|
|
175 |
And "User Test" "heading" should not exist
|
|
|
176 |
And "Dummy User" "heading" should not exist
|
|
|
177 |
And "Turtle Manatee" "heading" should not exist
|
|
|
178 |
And "Teacher 1" "heading" should not exist
|
|
|
179 |
|
|
|
180 |
@accessibility
|
|
|
181 |
Scenario: A teacher can set focus and search using the input are with a keyboard
|
|
|
182 |
Given I set the field "Search users" to "ABC"
|
|
|
183 |
# Basic tests for the page.
|
|
|
184 |
And the page should meet accessibility standards
|
|
|
185 |
And the page should meet "wcag131, wcag141, wcag412" accessibility standards
|
|
|
186 |
And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests
|
|
|
187 |
# Move onto general keyboard navigation testing.
|
|
|
188 |
When I wait until "Turtle Manatee" "option_role" exists
|
|
|
189 |
And I press the down key
|
|
|
190 |
And ".active" "css_element" should exist in the "Student 1" "option_role"
|
|
|
191 |
And I press the up key
|
|
|
192 |
And ".active" "css_element" should exist in the "Dummy User" "option_role"
|
|
|
193 |
And I press the down key
|
|
|
194 |
And ".active" "css_element" should exist in the "Student 1" "option_role"
|
|
|
195 |
And I press the escape key
|
|
|
196 |
And the focused element is "Search users" "field"
|
|
|
197 |
Then I set the field "Search users" to "Goodmeme"
|
|
|
198 |
And I press the down key
|
|
|
199 |
And the focused element is "Search users" "field"
|
|
|
200 |
|
|
|
201 |
And I navigate to "View > Single view" in the course gradebook
|
|
|
202 |
And I click on "Users" "link" in the ".page-toggler" "css_element"
|
|
|
203 |
And I set the field "Search users" to "ABC"
|
|
|
204 |
And I wait until "Turtle Manatee" "option_role" exists
|
|
|
205 |
And I press the down key
|
|
|
206 |
And ".active" "css_element" should exist in the "Student 1" "option_role"
|
|
|
207 |
|
|
|
208 |
# Lets check the tabbing order.
|
|
|
209 |
And I set the field "Search users" to "ABC"
|
|
|
210 |
And I wait until "Turtle Manatee" "option_role" exists
|
|
|
211 |
And I press the tab key
|
|
|
212 |
And the focused element is "Clear search input" "button" in the ".user-search" "css_element"
|
|
|
213 |
And I press the tab key
|
|
|
214 |
And the focused element is not "Search users" "field"
|
|
|
215 |
# Ensure we can interact with the clear search with the keyboard.
|
|
|
216 |
# Sometimes with behat we get unattached nodes causing spurious failures.
|
|
|
217 |
And I set the field "Search users" to "ABC"
|
|
|
218 |
And I wait "1" seconds
|
|
|
219 |
And I press the tab key
|
|
|
220 |
And the focused element is "Clear search input" "button" in the ".user-search" "css_element"
|
|
|
221 |
And I press the enter key
|
|
|
222 |
And I confirm "Turtle Manatee" in "user" search within the gradebook widget does not exist
|