Rev 1 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |
@core @core_grades @gradereport_user @javascriptFeature: Within the User report, a teacher can search for users.Background:Given the following "courses" exist:| fullname | shortname | category | groupmode || Course 1 | C1 | 0 | 1 || Course 2 | C2 | 0 | 0 |And the following "users" exist:| username | firstname | lastname | email | idnumber | phone1 | phone2 | department | institution | city | country || teacher1 | Teacher | 1 | teacher1@example.com | t1 | 1234567892 | 1234567893 | ABC1 | ABCD | Perth | AU || student1 | Student | 1 | student1@example.com | s1 | 3213078612 | 8974325612 | ABC1 | ABCD | Hanoi | VN || student2 | Dummy | User | student2@example.com | s2 | 4365899871 | 7654789012 | ABC2 | ABCD | Tokyo | JP || student3 | User | Example | student3@example.com | s3 | 3243249087 | 0875421745 | ABC2 | ABCD | Olney | GB || student4 | User | Test | student4@example.com | s4 | 0987532523 | 2149871323 | ABC3 | ABCD | Tokyo | JP || student5 | Turtle | Manatee | student5@example.com | s5 | 1239087780 | 9873623589 | ABC3 | ABCD | Perth | AU |# Note: Add groups etc so we can test that the search ignores those filters as well if we go down the filter dataset path.And the following "course enrolments" exist:| user | course | role || teacher1 | C1 | editingteacher || teacher1 | C2 | editingteacher || student1 | C1 | student || student2 | C1 | student || student3 | C1 | student || student4 | C1 | student || student5 | C1 | student |And the following "activities" exist:| activity | course | idnumber | name || assign | C1 | a1 | Test assignment one |And the following config values are set as admin:| showuseridentity | idnumber,email,city,country,phone1,phone2,department,institution |And I change window size to "large"And I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"Scenario: A teacher can view and trigger the user search# Check the placeholder text (no users are initially shown).Given I should see "Search users"# Confirm the search is currently inactive and results are unfiltered.And I should see "Search for a user to view their report"When I set the field "Search users" to "Turtle"And "View all results (5)" "option_role" should existAnd I confirm "Turtle Manatee" in "user" search within the gradebook widget existsAnd I confirm "User Example" in "user" search within the gradebook widget does not existAnd I click on "Turtle Manatee" "list_item"# Business case: This will trigger a page reload and can not dynamically update the table.And I wait until the page is readyAnd "Turtle Manatee" "heading" should existAnd "Teacher 1" "heading" should not existAnd "Student 1" "heading" should not existAnd "User Example" "heading" should not existAnd "User Test" "heading" should not existAnd "Dummy User" "heading" should not existAnd I set the field "Search users" to "Turt"And "View all results (5)" "option_role" should existAnd I click on "Clear search input" "button" in the ".user-search" "css_element"And "View all results (5)" "option_role" should not be visibleScenario: A teacher can search the user report to find specified users# Case: Standard search.Given I click on "Dummy" in the "user" search widgetAnd "Dummy User" "heading" should existAnd "Teacher 1" "heading" should not existAnd "Student 1" "heading" should not existAnd "User Example" "heading" should not existAnd "User Test" "heading" should not existAnd "Turtle Manatee" "heading" should not exist# Case: No users found.When I set the field "Search users" to "Plagiarism"And I should see "No results for \"Plagiarism\""# Table remains unchanged as the user had no results to select from the dropdown.And "Dummy User" "heading" should existAnd "Teacher 1" "heading" should not existAnd "Student 1" "heading" should not existAnd "User Example" "heading" should not existAnd "User Test" "heading" should not existAnd "Turtle Manatee" "heading" should not exist# Case: Multiple users found and select only one result.Then I set the field "Search users" to "User"And "View all results (5)" "option_role" should existAnd I confirm "Dummy User" in "user" search within the gradebook widget existsAnd I confirm "User Example" in "user" search within the gradebook widget existsAnd I confirm "User Test" in "user" search within the gradebook widget existsAnd I confirm "Turtle Manatee" in "user" search within the gradebook widget does not exist# Check if the matched field names (by lines) includes some identifiable info to help differentiate similar users.And I confirm "User (student2@example.com)" in "user" search within the gradebook widget existsAnd I confirm "User (student3@example.com)" in "user" search within the gradebook widget existsAnd I confirm "User (student4@example.com)" in "user" search within the gradebook widget existsAnd I click on "Dummy User" "list_item"And I wait until the page is readyAnd "Dummy User" "heading" should existAnd "Teacher 1" "heading" should not existAnd "Student 1" "heading" should not existAnd "User Example" "heading" should not existAnd "User Test" "heading" should not existAnd "Turtle Manatee" "heading" should not exist# Business case: When searching with multiple partial matches, show the matches in the dropdown + a "View all results for (Bob)"# Business case cont. When pressing enter with multiple partial matches, behave like when you select the "View all results for (Bob)"# Case: Multiple users found and select all partial matches.And I set the field "Search users" to "User"And "View all results (5)" "option_role" should existAnd I click on "View all results (5)" "option_role"And I wait until the page is readyAnd "Dummy User" "heading" should existAnd "User Example" "heading" should existAnd "User Test" "heading" should existAnd "Student 1" "heading" should existAnd "Turtle Manatee" "heading" should existAnd "Teacher 1" "heading" should not existAnd "Clear" "link" should not exist in the ".user-search" "css_element"And "Dummy User" "heading" should existAnd "User Example" "heading" should existAnd "User Test" "heading" should existAnd "Student 1" "heading" should existAnd "Turtle Manatee" "heading" should existAnd "Teacher 1" "heading" should not exist# Case: No users enrolled.And I am on the "Course 2" "grades > User report > View" pageAnd I set the field "Search users" to "a"And I should see "No results for \"a\""Scenario: A teacher can quickly tell that a search is active on the current tableWhen I click on "Turtle" in the "user" search widget# 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.Then the field "Search users" matches value "Turtle Manatee"And I wait until "View all results (5)" "link" does not exist# Test if we can then further retain the turtle result set and further filter from there.And I set the field "Search users" to "Turtle plagiarism"And I wait until "Turtle Manatee" "list_item" does not existAnd I should see "No results for \"Turtle plagiarism\""Scenario: A teacher can search for values besides the users' nameGiven I set the field "Search users" to "student5@example.com"And "View all results (5)" "option_role" should existAnd "Turtle Manatee" "list_item" should existAnd I set the field "Search users" to "@example.com"And "View all results (5)" "option_role" should exist# Note: All learners match this email & showing emails is current default.And I confirm "Dummy User" in "user" search within the gradebook widget existsAnd I confirm "User Example" in "user" search within the gradebook widget existsAnd I confirm "User Test" in "user" search within the gradebook widget existsAnd I confirm "Student 1" in "user" search within the gradebook widget existsAnd I confirm "Turtle Manatee" in "user" search within the gradebook widget exists# Search on the country field.When I set the field "Search users" to "JP"And "View all results (5)" "option_role" should existAnd I wait until "Turtle Manatee" "list_item" does not existAnd I confirm "Dummy User" in "user" search within the gradebook widget existsAnd I confirm "User Test" in "user" search within the gradebook widget exists# Search on the city field.And I set the field "Search users" to "Hanoi"And I wait until "User Test" "list_item" does not existThen I confirm "Student 1" in "user" search within the gradebook widget exists# Search on the institution field.And I set the field "Search users" to "ABCD"And "Dummy User" "list_item" should existAnd I confirm "User Example" in "user" search within the gradebook widget existsAnd I confirm "User Test" in "user" search within the gradebook widget existsAnd I confirm "Student 1" in "user" search within the gradebook widget existsAnd I confirm "Turtle Manatee" in "user" search within the gradebook widget exists# Search on the department field.And I set the field "Search users" to "ABC3"And I wait until "User Example" "list_item" does not existAnd I confirm "User Test" in "user" search within the gradebook widget existsAnd I confirm "Turtle Manatee" in "user" search within the gradebook widget exists# Search on the phone1 field.And I set the field "Search users" to "4365899871"And I wait until "User Test" "list_item" does not existAnd I confirm "Dummy User" in "user" search within the gradebook widget exists# Search on the phone2 field.And I set the field "Search users" to "2149871323"And I wait until "Dummy User" "list_item" does not existAnd I confirm "User Test" in "user" search within the gradebook widget exists# Search on the institution field then press enter to show the record set.And I set the field "Search users" to "ABC"And "Turtle Manatee" "list_item" should existAnd I confirm "Dummy User" in "user" search within the gradebook widget existsAnd I confirm "User Example" in "user" search within the gradebook widget existsAnd I confirm "User Test" in "user" search within the gradebook widget existsAnd I confirm "Student 1" in "user" search within the gradebook widget existsAnd I press the up keyAnd I press the enter keyAnd I wait until the page is readyAnd "Student 1" "heading" should existAnd "User Example" "heading" should existAnd "User Test" "heading" should existAnd "Dummy User" "heading" should existAnd "Turtle Manatee" "heading" should existAnd "Teacher 1" "heading" should not existScenario: A teacher can only search for fields that he allowed to seeGiven the following "permission overrides" exist:| capability | permission | role | contextlevel | reference || moodle/course:viewhiddenuserfields | Prohibit | editingteacher | System | |And the following config values are set as admin:| hiddenuserfields | email |And I am on the "Course 1" "grades > User report > View" page logged in as "teacher1"When I set the field "Search users" to "User"And "View all results (5)" "option_role" should existAnd I confirm "Dummy User" in "user" search within the gradebook widget existsAnd I confirm "User Example" in "user" search within the gradebook widget existsAnd I confirm "User Test" in "user" search within the gradebook widget exists# Email is not shown in results.And I confirm "User" in "user" search within the gradebook widget existsAnd I confirm "example.com" in "user" search within the gradebook widget does not exist# Email is not searchable.And I set the field "Search users" to "student5@example.com"And "View all results (5)" "option_role" should not existAnd I confirm "No results for \"student5@example.com\"" in "user" search within the gradebook widget exists@accessibilityScenario: A teacher can set focus and search using the input are with a keyboardGiven I set the field "Search users" to "ABC"# Basic tests for the page.And the page should meet accessibility standards with "wcag131, wcag141, wcag412" extra tests# Move onto general keyboard navigation testing.When "Turtle Manatee" "option_role" should existAnd I press the down keyAnd ".active" "css_element" should exist in the "Student 1" "option_role"And I press the up keyAnd ".active" "css_element" should exist in the "View all results (5)" "option_role"And I press the down keyAnd ".active" "css_element" should exist in the "Student 1" "option_role"And I press the escape keyAnd the focused element is "Search users" "field"Then I set the field "Search users" to "Goodmeme"And I press the down keyAnd the focused element is "Search users" "field"And I navigate to "View > User report" in the course gradebookAnd I set the field "Search users" to "ABC"And "Turtle Manatee" "option_role" should existAnd I press the down keyAnd ".active" "css_element" should exist in the "Student 1" "option_role"# Lets check the tabbing order.And I set the field "Search users" to "ABC"And I wait until "Clear search input" "button" existsAnd I click on "Search users" "field"And I press the tab keyAnd the focused element is "Clear search input" "button" in the ".user-search" "css_element"And I press the tab keyAnd ".groupsearchwidget" "css_element" should exist# Ensure we can interact with the input & clear search options with the keyboard.# Space & Enter have the same handling for triggering the two functionalities.And I set the field "Search users" to "User"And I press the down keyAnd I press the enter keyAnd I wait to be redirectedAnd "User Example" "heading" should existAnd "Dummy User" "heading" should not existAnd "Student 1" "heading" should not existAnd "User Test" "heading" should not existAnd "Teacher 1" "heading" should not existAnd "Turtle Manatee" "heading" should not exist