From 5eb65b8a7c7c0e20cfb0ef97f0b32b65ce032da2 Mon Sep 17 00:00:00 2001 From: andelacruz Date: Wed, 23 Jul 2025 20:16:21 +0800 Subject: [PATCH] MDL-85674 mod_grade: Behat test for multiple questions manual grading --- .../grading/tests/behat/grading.feature | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/mod/quiz/report/grading/tests/behat/grading.feature b/mod/quiz/report/grading/tests/behat/grading.feature index 29a1b302d30..eb8bcf78ef6 100644 --- a/mod/quiz/report/grading/tests/behat/grading.feature +++ b/mod/quiz/report/grading/tests/behat/grading.feature @@ -212,3 +212,54 @@ Feature: Basic use of the Manual grading report Then I should see "Grading attempts 1 to 1 of 2" And I press "Save and show next" And I should see "Grading attempts 2 to 2 of 2" + + @javascript + Scenario: Manually grade quiz with multiple questions + Given the following "questions" exist: + | questioncategory | qtype | name | questiontext | defaultmark | + | Test questions | essay | Essay 1 | First question | 20 | + | Test questions | essay | Essay 2 | Second question | 20 | + | Test questions | truefalse | TF1 | Third question | | + And quiz "Quiz 2" contains the following questions: + | question | page | + | Essay 1 | 1 | + | Essay 2 | 2 | + | TF1 | 2 | + And user "student1" has attempted "Quiz 2" with responses: + | slot | response | + | 1 | Answer to Essay 1 | + | 2 | Answer to Essay 2 | + | 3 | True | + And I am on the "Quiz 2 > student1 > Attempt 1" "mod_quiz > Attempt review" page logged in as "teacher1" + And I follow "Make comment or override mark" + And I switch to "commentquestion" window + And I set the field "Mark" to "15" + And I press "Save" and switch to main window + When I am on the "Quiz 2" "mod_quiz > Manual grading report" page + And I click on "Also show questions that have been graded automatically" "link" + # Confirm that Essay 1 is already graded. + Then "Essay 1" row "To grade" column of "questionstograde" table should contain "0" + And "Essay 1" row "Already graded" column of "questionstograde" table should contain "1" + And "Essay 1" row "Automatically graded" column of "questionstograde" table should contain "0" + # Confirm that Essay 2 is not yet graded. + And "Essay 2" row "To grade" column of "questionstograde" table should contain "1" + And "Essay 2" row "Already graded" column of "questionstograde" table should contain "0" + And "Essay 2" row "Automatically graded" column of "questionstograde" table should contain "0" + # Confirm that TF1 is automatically graded. + And "TF1" row "To grade" column of "questionstograde" table should contain "0" + And "TF1" row "Already graded" column of "questionstograde" table should contain "0" + And "TF1" row "Automatically graded" column of "questionstograde" table should contain "1" + # Grade the not yet graded Essay 2. + And I click on "Grade" "link" in the "2" "table_row" + And I set the field "Mark" to "20" + And I press "Save and show next" + And I am on the "Quiz 2" "mod_quiz > Manual grading report" page + # Update the already graded Essay 1. + And I click on "grade all" "link" in the "1" "table_row" + And I set the field "Mark" to "5" + And I press "Save and show next" + # Confirm that each question is graded for the corresponding student. + And I am on the "Quiz 2" "mod_quiz > Grades report" page + And "S1 Student1" row "Q. 1" column of "generaltable" table should contain "12.50" + And "S1 Student1" row "Q. 2" column of "generaltable" table should contain "50.00" + And "S1 Student1" row "Q. 3" column of "generaltable" table should contain "-"