diff --git a/mod/assign/tests/behat/rescale_grades.feature b/mod/assign/tests/behat/rescale_grades.feature index 3b076ddff25..26a16a0229a 100644 --- a/mod/assign/tests/behat/rescale_grades.feature +++ b/mod/assign/tests/behat/rescale_grades.feature @@ -4,8 +4,7 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c As a teacher I need to rescale all grades when updating the max grade - @javascript - Scenario: Update the max grade for an assignment and rescale existing grades + Background: Given the following "courses" exist: | fullname | shortname | category | groupmode | | Course 1 | C1 | 0 | 1 | @@ -26,24 +25,42 @@ Feature: Check that the assignment grade can be rescaled when the max grade is c And I add a "Assignment" to section "1" and I fill the form with: | Assignment name | Test assignment name | | Description | Test assignment description | - When I follow "Test assignment name" - Then I follow "View/grade all submissions" + And I follow "Test assignment name" + And I follow "View/grade all submissions" And I click on "Grade Student 1" "link" in the "Student 1" "table_row" And I set the field "Grade out of 100" to "40" And I press "Save changes" And I press "Continue" And "Student 1" row "Grade" column of "generaltable" table should contain "40.00" - And I follow "Edit settings" + + Scenario: Update the max grade for an assignment without rescaling existing grades + Given I follow "Edit settings" And I expand all fieldsets And I set the field "Maximum points" to "80" - And I press "Save and display" + And I set the field "Rescale existing grades" to "No" + When I press "Save and display" And I follow "View/grade all submissions" - And "Student 1" row "Grade" column of "generaltable" table should contain "40.00" - And I follow "Edit settings" + Then "Student 1" row "Grade" column of "generaltable" table should contain "40.00" + + Scenario: Update the max grade for an assignment rescaling existing grades + Given I follow "Edit settings" + And I expand all fieldsets + And I set the field "Maximum points" to "50" + And I set the field "Rescale existing grades" to "Yes" + When I press "Save and display" + And I follow "View/grade all submissions" + Then "Student 1" row "Grade" column of "generaltable" table should contain "20.00" + + Scenario: A rescale existing grades is not needed when keeping max grade unchanged + Given I follow "Edit settings" And I expand all fieldsets And I set the field "Maximum points" to "100" - And I set the field "Rescale existing grades" to "Yes" - And I press "Save and display" - Then I follow "View/grade all submissions" - And "Student 1" row "Grade" column of "generaltable" table should contain "50.00" - + When I press "Save and display" + Then I should not see "You must choose whether to rescale existing grades or not." + + Scenario: A rescale existing grades must be selected when max grade changes + Given I follow "Edit settings" + And I expand all fieldsets + And I set the field "Maximum points" to "50" + When I press "Save and display" + Then I should see "You must choose whether to rescale existing grades or not."