Skip to content

Commit

Permalink
Merge branch 'MDL-75081' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Feb 7, 2024
2 parents bd54499 + 8ea7f73 commit 9e7777c
Show file tree
Hide file tree
Showing 10 changed files with 141 additions and 195 deletions.
6 changes: 3 additions & 3 deletions admin/tool/behat/tests/behat/tabs.feature
Expand Up @@ -27,8 +27,8 @@ Feature: Confirm that we can open multiple browser tabs
# Switch between all the tabs and confirm their different contents.
Then I should see "You're not enrolled in any course"
And I switch to "CourseViewer2" tab
And I should see "Course 3" in the "h1" "css_element"
And "Course 3" "heading" should exist
And I switch to "CourseViewer1" tab
And I should see "Course 2" in the "h1" "css_element"
And "Course 2" "heading" should exist
And I switch to the main tab
And I should see "Course 1" in the "h1" "css_element"
And "Course 1" "heading" should exist
Expand Up @@ -79,29 +79,29 @@ Feature: Within the grader report, test that we can search for users
Given I click on "Dummy" in the "user" search widget
And the following should exist in the "user-grades" table:
| -1- |
| Turtle Manatee |
| Dummy User |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
| Student 1 |
| User Example |
| User Test |
| Dummy User |
| Turtle Manatee |

# 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 the following should exist in the "user-grades" table:
| -1- |
| Turtle Manatee |
| Dummy User |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
| Student 1 |
| User Example |
| User Test |
| Dummy User |
| Turtle Manatee |

# Case: Multiple users found and select only one result.
Then I set the field "Search users" to "User"
Expand Down Expand Up @@ -220,17 +220,18 @@ Feature: Within the grader report, test that we can search for users
And I confirm "User Example" in "user" search within the gradebook widget exists
And I confirm "User Test" in "user" search within the gradebook widget exists
And I confirm "Student 1" in "user" search within the gradebook widget exists
And I press the down key
And I press the enter key
And I wait until the page is ready
And I wait "1" seconds
And the following should exist in the "user-grades" table:
| -1- |
| Student 1 |
And the following should not exist in the "user-grades" table:
| -1- |
| User Example |
| User Test |
| Dummy User |
| Turtle Manatee |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |

@accessibility
Expand Down Expand Up @@ -396,7 +397,7 @@ Feature: Within the grader report, test that we can search for users
And the following should exist in the "user-grades" table:
| -1- |
| Student test31 |
And the following should exist in the "user-grades" table:
And the following should not exist in the "user-grades" table:
| -1- |
| Student test32 |
And I click on "Clear" "link" in the ".user-search" "css_element"
Expand Down
97 changes: 34 additions & 63 deletions grade/report/singleview/tests/behat/usersearch.feature
Expand Up @@ -33,35 +33,21 @@ Feature: Within the singleview report, a teacher can search for users.
And I click on "Users" "link" in the ".page-toggler" "css_element"

Scenario: A teacher can view and trigger the user search
# Check the placeholder text
# 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 the following should exist in the "user-grades" table:
| -1- |
| Turtle Manatee |
| Student 1 |
| User Example |
| User Test |
| Dummy User |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
And I should see "Search for a user to view all their grades"
When I set the field "Search users" to "Turtle"
And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
And I confirm "User Example" in "user" search within the gradebook widget does not exist
And 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 ready
Then the following should exist in the "user-grades" table:
| -1- |
| Turtle Manatee |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
| Student 1 |
| User Example |
| User Test |
| Dummy User |
And "Turtle Manatee" "heading" should exist
And "Teacher 1" "heading" should not exist
And "Student 1" "heading" should not exist
And "User Example" "heading" should not exist
And "User Test" "heading" should not exist
And "Dummy User" "heading" should not exist
And I set the field "Search users" to "Turt"
And I wait until "Turtle Manatee" "option_role" exists
And I click on "Clear search input" "button" in the ".user-search" "css_element"
Expand All @@ -70,31 +56,23 @@ Feature: Within the singleview report, a teacher can search for users.
Scenario: A teacher can search the single view report to find specified users
# Case: Standard search.
Given I click on "Dummy" in the "user" search widget
And the following should exist in the "user-grades" table:
| -1- |
| Turtle Manatee |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
| Student 1 |
| User Example |
| User Test |
| Dummy User |
And "Dummy User" "heading" should exist
And "Teacher 1" "heading" should not exist
And "Student 1" "heading" should not exist
And "User Example" "heading" should not exist
And "User Test" "heading" should not exist
And "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 the following should exist in the "user-grades" table:
| -1- |
| Turtle Manatee |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
| Student 1 |
| User Example |
| User Test |
| Dummy User |
And "Dummy User" "heading" should exist
And "Teacher 1" "heading" should not exist
And "Student 1" "heading" should not exist
And "User Example" "heading" should not exist
And "User Test" "heading" should not exist
And "Turtle Manatee" "heading" should not exist

# Case: Multiple users found and select only one result.
Then I set the field "Search users" to "User"
Expand All @@ -109,16 +87,12 @@ Feature: Within the singleview report, a teacher can search for users.
And I confirm "User (student4@example.com)" in "user" search within the gradebook widget exists
And I click on "Dummy User" "list_item"
And I wait until the page is ready
And the following should exist in the "user-grades" table:
| -1- |
| Dummy User |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
| Student 1 |
| User Example |
| User Test |
| Turtle Manatee |
And "Dummy User" "heading" should exist
And "Teacher 1" "heading" should not exist
And "Student 1" "heading" should not exist
And "User Example" "heading" should not exist
And "User Test" "heading" should not exist
And "Turtle Manatee" "heading" should not exist

# Case: No users enrolled.
And I am on the "Course 2" "grades > Single view > View" page
Expand Down Expand Up @@ -187,23 +161,20 @@ Feature: Within the singleview report, a teacher can search for users.

# Search on the institution field then press enter to show the record set.
And I set the field "Search users" to "ABC"
And I wait until "Turtle Manatee" "list_item" exists
And "Turtle Manatee" "list_item" should exist
And I confirm "Dummy User" in "user" search within the gradebook widget exists
And I confirm "User Example" in "user" search within the gradebook widget exists
And I confirm "User Test" in "user" search within the gradebook widget exists
And I confirm "Student 1" in "user" search within the gradebook widget exists
And I press the down key
And I press the enter key
And I wait until the page is ready
And the following should exist in the "user-grades" table:
| -1- |
| Student 1 |
| User Example |
| User Test |
| Dummy User |
| Turtle Manatee |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
And "Student 1" "heading" should exist
And "User Example" "heading" should not exist
And "User Test" "heading" should not exist
And "Dummy User" "heading" should not exist
And "Turtle Manatee" "heading" should not exist
And "Teacher 1" "heading" should not exist

@accessibility
Scenario: A teacher can set focus and search using the input are with a keyboard
Expand Down
12 changes: 6 additions & 6 deletions grade/report/user/tests/behat/user_report_navigation.feature
Expand Up @@ -27,36 +27,36 @@ Feature: Teacher can navigate to the previous or next user report.

Scenario: A teacher can navigate to the next user report
Given I click on "Student 1" in the "user" search widget
And I should see "Student 1" in the ".user-heading" "css_element"
And "Student 1" "heading" should exist
And ".previous" "css_element" should not exist in the ".user-navigation" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".next" "css_element"
When I click on "Student 2" "link" in the ".next" "css_element"
Then I should see "Student 2" in the ".user-heading" "css_element"
And "Student 2" "heading" should exist
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 1" in the ".previous" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 3" in the ".next" "css_element"
And I click on "Student 3" "link" in the ".next" "css_element"
And I should see "Student 3" in the ".user-heading" "css_element"
And "Student 3" "heading" should exist
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".previous" "css_element"
And ".next" "css_element" should not exist in the ".user-navigation" "css_element"

Scenario: A teacher can navigate to the previous user report
Given I click on "Student 3" in the "user" search widget
And I should see "Student 3" in the ".user-heading" "css_element"
And "Student 3" "heading" should exist
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".previous" "css_element"
And ".next" "css_element" should not exist in the ".user-navigation" "css_element"
When I click on "Student 2" "link" in the ".previous" "css_element"
Then I should see "Student 2" in the ".user-heading" "css_element"
And "Student 2" "heading" should exist
And ".previous" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 1" in the ".previous" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 3" in the ".next" "css_element"
And I click on "Student 1" "link" in the ".previous" "css_element"
And I should see "Student 1" in the ".user-heading" "css_element"
And "Student 1" "heading" should exist
And ".previous" "css_element" should not exist in the ".user-navigation" "css_element"
And ".next" "css_element" should exist in the ".user-navigation" "css_element"
And I should see "Student 2" in the ".next" "css_element"

0 comments on commit 9e7777c

Please sign in to comment.