From 2185c4d355e93d8cf507a7d68d35e8984576a8d0 Mon Sep 17 00:00:00 2001 From: Mathew May Date: Tue, 14 Mar 2023 12:03:07 +0800 Subject: [PATCH] fixup! MDL-77032 grade: Update behat tests --- .../behat/toggle_grade_categories.feature | 140 +++++++++++------- 1 file changed, 85 insertions(+), 55 deletions(-) diff --git a/grade/tests/behat/toggle_grade_categories.feature b/grade/tests/behat/toggle_grade_categories.feature index b6f39cd5750..95b2a26fc45 100644 --- a/grade/tests/behat/toggle_grade_categories.feature +++ b/grade/tests/behat/toggle_grade_categories.feature @@ -34,74 +34,97 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade Scenario: A teacher can collapse and expand grade categories in the Gradebook setup page Given I navigate to "Setup > Gradebook setup" in the course gradebook And I wait until the page is ready - And I should see "Course" in the "setup-grades" "table" + And the following should exist in the "setup-grades" table: + | -1- | + | Course | + | Test assignment one | + | Category 1 | + | Test assignment two | + | Manual grade | + | Category 1 total | + | Course total | And "Collapse" "link" should exist in the "Course" "table_row" - And I should see "Test assignment one" in the "setup-grades" "table" - And I should see "Category 1" in the "setup-grades" "table" And "Collapse" "link" should exist in the "Category 1" "table_row" - And I should see "Test assignment two" in the "setup-grades" "table" - And I should see "Manual grade" in the "setup-grades" "table" - And I should see "Category 1 total" in the "setup-grades" "table" - And I should see "Course total" in the "setup-grades" "table" # Collapse the grade category 'Category 1'. When I click on "Collapse" "link" in the "Category 1" "table_row" - Then I should see "Course" in the "setup-grades" "table" + Then the following should exist in the "setup-grades" table: + | -1- | + | Course | And "Collapse" "link" should exist in the "Course" "table_row" - And I should see "Test assignment one" in the "setup-grades" "table" - And I should see "Category 1" in the "setup-grades" "table" + And the following should exist in the "setup-grades" table: + | -1- | + | Test assignment one | + | Category 1 | And "Expand" "link" should exist in the "Category 1" "table_row" - And I should not see "Test assignment two" in the "setup-grades" "table" - And I should not see "Manual grade" in the "setup-grades" "table" - And I should not see "Category 1 total" in the "setup-grades" "table" + And the following should not exist in the "setup-grades" table: + | -1- | + | Test assignment two | + | Manual grade | + | Category 1 total | And I should see "Course total" in the "setup-grades" "table" # Expand the grade category 'Category 1'. And I click on "Expand" "link" in the "Category 1" "table_row" And I should see "Course" in the "setup-grades" "table" And "Collapse" "link" should exist in the "Course" "table_row" - And I should see "Test assignment one" in the "setup-grades" "table" - And I should see "Category 1" in the "setup-grades" "table" + And the following should exist in the "setup-grades" table: + | -1- | + | Course | + | Test assignment one | + | Category 1 | And "Collapse" "link" should exist in the "Category 1" "table_row" - And I should see "Test assignment two" in the "setup-grades" "table" - And I should see "Manual grade" in the "setup-grades" "table" - And I should see "Category 1 total" in the "setup-grades" "table" - And I should see "Course total" in the "setup-grades" "table" + And the following should exist in the "setup-grades" table: + | -1- | + | Test assignment two | + | Manual grade | + | Category 1 total | + | Course total | # Collapse again the grade category 'Category 1'. And I click on "Collapse" "link" in the "Category 1" "table_row" # Collapse the grade category 'Course'. And I click on "Collapse" "link" in the "Course" "table_row" And I should see "Course" in the "setup-grades" "table" And "Expand" "link" should exist in the "Course" "table_row" - And I should not see "Test assignment one" in the "setup-grades" "table" - And I should not see "Category 1" in the "setup-grades" "table" - And I should not see "Test assignment two" in the "setup-grades" "table" - And I should not see "Manual grade" in the "setup-grades" "table" - And I should not see "Category 1 total" in the "setup-grades" "table" - And I should not see "Course total" in the "setup-grades" "table" + And the following should not exist in the "setup-grades" table: + | -1- | + | Test assignment one | + | 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 I should see "Course" in the "setup-grades" "table" And "Collapse" "link" should exist in the "Course" "table_row" - And I should see "Test assignment one" in the "setup-grades" "table" - And I should see "Category 1" in the "setup-grades" "table" + And the following should exist in the "setup-grades" table: + | -1- | + | Test assignment one | + | Category 1 | And "Expand" "link" should exist in the "Category 1" "table_row" - And I should not see "Test assignment two" in the "setup-grades" "table" - And I should not see "Manual grade" in the "setup-grades" "table" - And I should not see "Category 1 total" in the "setup-grades" "table" + And the following should not exist in the "setup-grades" table: + | -1- | + | Test assignment two | + | Manual grade | + | Category 1 total | And I should see "Course total" in the "setup-grades" "table" Scenario: A teacher can see the aggregated max grade for a grade category even when the category is collapsed Given I navigate to "Setup > Gradebook setup" in the course gradebook And I wait until the page is ready - And "Course" row "Max grade" column of "setup-grades" table should contain "" - And "Course total" row "Max grade" column of "setup-grades" table should contain "240.00" - And "Category 1" row "Max grade" column of "setup-grades" table should contain "" - And "Category 1 total" row "Max grade" column of "setup-grades" table should contain "140.00" + And the following should exist in the "setup-grades" table: + | -1- | -3- | + | Course | | + | Category 1 | | + | Category 1 total | 140.00 | + | Course total | 240.00 | # Collapse the grade category 'Category 1'. The aggregated max grade should now be displayed within the 'Category 1' row. When I click on "Collapse" "link" in the "Category 1" "table_row" - Then "Category 1" row "Max grade" column of "setup-grades" table should contain "140.00" And I should not see "Category 1 total" in the "setup-grades" "table" - And "Course" row "Max grade" column of "setup-grades" table should contain "" - And "Course total" row "Max grade" column of "setup-grades" table should contain "240.00" + And the following should exist in the "setup-grades" table: + | -1- | -3- | + | Course | | + | Category 1 | 140.00 | + | Course total | 240.00 | # Collapse the grade category 'Course'. The aggregated max grade should now be displayed within the 'Course' row. And I click on "Collapse" "link" in the "Course" "table_row" And "Course" row "Max grade" column of "setup-grades" table should contain "240.00" @@ -146,10 +169,12 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade And I click on "Collapse" "link" in the "Course" "table_row" And I should see "Course" in the "setup-grades" "table" And "Expand" "link" should exist in the "Course" "table_row" - And I should not see "Test assignment one" in the "setup-grades" "table" - And I should not see "Category 1" in the "setup-grades" "table" - And I should not see "Test assignment two" in the "setup-grades" "table" - And I should not see "Manual grade" in the "setup-grades" "table" + And the following should not exist in the "setup-grades" table: + | -1- | + | Test assignment one | + | Category 1 | + | Test assignment two | + | Manual grade | # Expand the grade category 'Course'. 'Category 1' should be still collapsed. And I click on "Expand" "link" in the "Course" "table_row" And I should see "Course" in the "setup-grades" "table" @@ -174,9 +199,11 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade And I should see "Test assignment one" in the "setup-grades" "table" And I should see "Category 1" in the "setup-grades" "table" And "Expand" "link" should exist in the "Category 1" "table_row" - And I should not see "Test assignment two" in the "setup-grades" "table" - And I should not see "Manual grade" in the "setup-grades" "table" - And I should not see "Category 1 total" in the "setup-grades" "table" + And the following should not exist in the "setup-grades" table: + | -1- | + | Test assignment two | + | Manual grade | + | Category 1 total | And I should see "Course total" in the "setup-grades" "table" Scenario: Previously collapsed categories are still shown as collapsed when a teacher is moving grade items in Gradebook setup @@ -205,27 +232,30 @@ Feature: Teachers can toggle the visibility of the grade categories in the Grade And I am on "Course" course homepage When I navigate to "Setup > Gradebook setup" in the course gradebook And I wait until the page is ready - Then I should see "Course" in the "setup-grades" "table" + And the following should exist in the "setup-grades" table: + | -1- | + | Course | + | Test assignment one | + | Category 1 | + | Test assignment two | + | Manual grade | + | Category 1 total | + | Course total | And "Collapse" "link" should exist in the "Course" "table_row" - And I should see "Test assignment one" in the "setup-grades" "table" - And I should see "Category 1" in the "setup-grades" "table" And "Collapse" "link" should exist in the "Category 1" "table_row" - And I should see "Test assignment two" in the "setup-grades" "table" - And I should see "Manual grade" in the "setup-grades" "table" - And I should see "Category 1 total" in the "setup-grades" "table" - And I should see "Course total" in the "setup-grades" "table" # Log in as teacher1 and confirm that the category 'Category 1' is still collapsed. And I log in as "teacher1" And I am on "Course" course homepage And I navigate to "Setup > Gradebook setup" in the course gradebook And I wait until the page is ready - And I wait until the page is ready And I should see "Course" in the "setup-grades" "table" And "Collapse" "link" should exist in the "Course" "table_row" And I should see "Test assignment one" in the "setup-grades" "table" And I should see "Category 1" in the "setup-grades" "table" And "Expand" "link" should exist in the "Category 1" "table_row" - And I should not see "Test assignment two" in the "setup-grades" "table" - And I should not see "Manual grade" in the "setup-grades" "table" - And I should not see "Category 1 total" in the "setup-grades" "table" + And the following should not exist in the "setup-grades" table: + | -1- | + | Test assignment two | + | Manual grade | + | Category 1 total | And I should see "Course total" in the "setup-grades" "table" -- 2.39.2