MDL-75081 grade: fix rogue gradebook scenarios containing invalid steps.

Various re-factors over recent releases appear to have led to quite a
drift between actual functionality and what these scenarios assert for
imagined functionality. Page elements and content are referenced that
don't exist in multiple places.
This commit is contained in:
Paul Holden
2024-02-06 17:31:46 +00:00
parent 662c5e1d31
commit 8ea7f73898
6 changed files with 102 additions and 175 deletions
@@ -79,14 +79,14 @@ 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"
@@ -94,14 +94,14 @@ Feature: Within the grader report, test that we can search for users
# 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"
@@ -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
@@ -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"
@@ -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"
@@ -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"
@@ -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
@@ -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
@@ -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"
@@ -32,19 +32,10 @@ Feature: Within the User report, a teacher can search for users.
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
# 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 their report"
When I set the field "Search users" to "Turtle"
And "View all results (5)" "option_role" should exist
And I confirm "Turtle Manatee" in "user" search within the gradebook widget exists
@@ -52,16 +43,12 @@ Feature: Within the User report, a teacher can search for users.
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 "View all results (5)" "option_role" should exist
And I click on "Clear search input" "button" in the ".user-search" "css_element"
@@ -70,32 +57,23 @@ Feature: Within the User report, a teacher can search for users.
Scenario: A teacher can search the user 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"
And "View all results (5)" "option_role" should exist
@@ -109,16 +87,12 @@ Feature: Within the User 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
# 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)"
@@ -127,25 +101,20 @@ Feature: Within the User report, a teacher can search for users.
And "View all results (5)" "option_role" should exist
And I click on "View all results (5)" "option_role"
And I wait until the page is ready
And the following should exist in the "user-grades" table:
| -1- |
| Dummy User |
| User Example |
| User Test |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
| Student 1 |
| Turtle Manatee |
And "Dummy User" "heading" should exist
And "User Example" "heading" should exist
And "User Test" "heading" should exist
And "Student 1" "heading" should exist
And "Turtle Manatee" "heading" should exist
And "Teacher 1" "heading" should not exist
And I click on "Clear" "link" in the ".user-search" "css_element"
And I wait until the page is ready
And the following should exist in the "user-grades" table:
| -1- |
| Turtle Manatee |
| Student 1 |
| User Example |
| User Test |
| Dummy User |
And "Dummy User" "heading" should exist
And "User Example" "heading" should exist
And "User Test" "heading" should exist
And "Student 1" "heading" should exist
And "Turtle Manatee" "heading" should exist
And "Teacher 1" "heading" should not exist
# Case: No users enrolled.
And I am on the "Course 2" "grades > User report > View" page
@@ -220,16 +189,12 @@ Feature: Within the User report, a teacher can search for users.
And I confirm "Student 1" in "user" search within the gradebook widget exists
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 exist
And "User Test" "heading" should exist
And "Dummy User" "heading" should exist
And "Turtle Manatee" "heading" should exist
And "Teacher 1" "heading" should not exist
@accessibility
Scenario: A teacher can set focus and search using the input are with a keyboard
@@ -274,18 +239,15 @@ Feature: Within the User report, a teacher can search for users.
# 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 key
And I press the enter key
And I wait to be redirected
And the following should exist in the "user-grades" table:
| -1- |
| Dummy User |
| User Example |
| User Test |
And the following should not exist in the "user-grades" table:
| -1- |
| Teacher 1 |
| Student 1 |
| Turtle Manatee |
And "User Example" "heading" should exist
And "Dummy User" "heading" should not exist
And "Student 1" "heading" should not exist
And "User Test" "heading" should not exist
And "Teacher 1" "heading" should not exist
And "Turtle Manatee" "heading" should not exist
# Sometimes with behat we get unattached nodes causing spurious failures.
And I wait "1" seconds
And I set the field "Search users" to "ABC"
@@ -62,6 +62,7 @@ Feature: Regrading grades does not unnecessarily mark some as overriden
And I set the field "Grade out of 100" to "70"
And I press "Save changes"
When I am on the "Course 1" "grades > Grader report > View" page
And I turn editing mode off
Then the following should exist in the "gradereport-grader-table" table:
| | | |
| First name / Last name | Assignment 1 | Course total |
@@ -52,7 +52,7 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And the following should not exist in the "user-grades" table:
And the following should not exist in the "setup-grades" table:
| Test assignment two |
| Manual grade |
| Category 1 total |
@@ -139,8 +139,6 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Category 1 |
| Test assignment two |
| Manual grade |
| Category 1 total |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Collapse" "link" should exist in the "Category 1" "table_row"
# Collapse the grade category 'Category 1'.
@@ -166,8 +164,6 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Category 1 |
| Test assignment two |
| Manual grade |
| Category 1 total |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Collapse" "link" should exist in the "Category 1" "table_row"
# Collapse again the grade category 'Category 1'.
@@ -182,8 +178,6 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Category 1 |
| Test assignment two |
| Manual grade |
| Category 1 total |
| Course total |
# Expand the grade category 'Course'. 'Category 1' should be still collapsed.
And I click on "Expand" "link" in the "Course" "table_row"
And the following should exist in the "setup-grades" table:
@@ -191,7 +185,6 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Course |
| Test assignment one |
| Category 1 |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And the following should not exist in the "setup-grades" table:
@@ -229,7 +222,6 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade
| Course |
| Test assignment one |
| Category 1 |
| Course total |
And "Collapse" "link" should exist in the "Course" "table_row"
And "Expand" "link" should exist in the "Category 1" "table_row"
And the following should not exist in the "setup-grades" table: