From 8cbd95be5b418cd4c6b0f3b2294657f4ee1d184c Mon Sep 17 00:00:00 2001 From: Tony Butler Date: Tue, 15 Jun 2021 18:21:44 +0100 Subject: [PATCH] MDL-71694 assignfeedback_comments: Behat test for feedback preservation Including efficiency improvements from https://github.com/davosmith --- ...erve_changes_on_validation_failure.feature | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 mod/assign/feedback/comments/tests/behat/preserve_changes_on_validation_failure.feature diff --git a/mod/assign/feedback/comments/tests/behat/preserve_changes_on_validation_failure.feature b/mod/assign/feedback/comments/tests/behat/preserve_changes_on_validation_failure.feature new file mode 100644 index 00000000000..037b63235a4 --- /dev/null +++ b/mod/assign/feedback/comments/tests/behat/preserve_changes_on_validation_failure.feature @@ -0,0 +1,35 @@ +@mod @mod_assign @assignfeedback @assignfeedback_comments +Feature: Check that any changes to assignment feedback comments are not lost + if the grading form validation fails due to an invalid grade. + In order to ensure that the feedback changes are not lost + As a teacher + I need to grade a student and ensure that all feedback changes are preserved + + @javascript + Scenario: Update the grade and feedback for an assignment + Given the following "courses" exist: + | fullname | shortname | + | Course 1 | C1 | + And the following "users" exist: + | username | firstname | lastname | email | + | teacher1 | Teacher | 1 | teacher1@example.com | + | student1 | Student | 1 | student1@example.com | + And the following "course enrolments" exist: + | user | course | role | + | teacher1 | C1 | editingteacher | + | student1 | C1 | student | + And the following "activities" exist: + | activity | name | course | idnumber | assignfeedback_comments_enabled | + | assign | Test assignment name | C1 | ASSIGN01 | 1 | + And I log in as "teacher1" + And I am on "Course 1" course homepage + And I follow "Test assignment name" + And I navigate to "View all submissions" in current page administration + And I click on "Grade" "link" in the "Student 1" "table_row" + When I set the following fields to these values: + | Grade out of 100 | 101 | + | Feedback comments | Feedback from teacher. | + And I press "Save changes" + Then I should see "Grade must be less than or equal to 100." + And the following fields match these values: + | Feedback comments | Feedback from teacher. |