From 60e74092cd175371f87f4dca8a6caa7374cb2e07 Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Tue, 8 Aug 2023 17:36:36 +0800 Subject: [PATCH] MDL-78941 mod_quiz: Behat coverage for student flagging quiz questions --- mod/quiz/tests/behat/flag_questions.feature | 72 +++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 mod/quiz/tests/behat/flag_questions.feature diff --git a/mod/quiz/tests/behat/flag_questions.feature b/mod/quiz/tests/behat/flag_questions.feature new file mode 100644 index 00000000000..29a415d41c0 --- /dev/null +++ b/mod/quiz/tests/behat/flag_questions.feature @@ -0,0 +1,72 @@ +@mod @mod_quiz +Feature: Flag quiz questions + As a student + In order to flag a quiz questions + All review options for immediately after the attempt are ticked + + Background: + Given the following "users" exist: + | username | firstname | lastname | email | + | student1 | Student | 1 | student1@email.com | + | teacher1 | Teacher | 1 | teacher1@email.com | + And the following "courses" exist: + | fullname | shortname | + | Course 1 | C1 | + And the following "course enrolments" exist: + | user | course | role | + | student1 | C1 | student | + | teacher1 | C1 | teacher | + And the following "question categories" exist: + | contextlevel | reference | name | + | Course | C1 | Test questions | + And the following "questions" exist: + | questioncategory | qtype | name | questiontext | + | Test questions | truefalse | TF1 | First question | + | Test questions | truefalse | TF2 | Second question | + | Test questions | truefalse | TF3 | Third question | + And the following "activity" exists: + | activity | quiz | + | name | Quiz 1 | + | course | C1 | + | attemptimmediately | 1 | + | correctnessimmediately | 1 | + | maxmarksimmediately | 1 | + | marksimmediately | 1 | + | specificfeedbackimmediately | 1 | + | generalfeedbackimmediately | 1 | + | rightanswerimmediately | 1 | + | overallfeedbackimmediately | 1 | + And quiz "Quiz 1" contains the following questions: + | question | page | + | TF1 | 1 | + | TF2 | 2 | + | TF3 | 3 | + + @javascript + Scenario: Flag a quiz during and after quiz attempt + Given I am on the "Quiz 1" "quiz activity" page logged in as student1 + And I press "Attempt quiz" + # flag question 1 + When I press "Flag question" + # Confirm question 1 is flagged in navigation + Then "Question 1 This page Flagged" "link" should exist + # Confirm that link in question 1 is changed to Remove flag + And I should see "Remove flag" in the "First question" "question" + # Answer questions + And I click on "True" "radio" in the "First question" "question" + And I press "Next page" + And I click on "True" "radio" in the "Second question" "question" + And I press "Next page" + And I click on "True" "radio" in the "Third question" "question" + And I follow "Finish attempt ..." + And I press "Submit all and finish" + And I click on "Submit all and finish" "button" in the "Submit all your answers and finish?" "dialogue" + # Confirm only flagged question is flagged + And I should see "Remove flag" in the "First question" "question" + And I should see "Flag question" in the "Second question" "question" + And I should see "Flag question" in the "Third question" "question" + And I click on "Flagged" "button" in the "Second question" "question" + And I am on the "Quiz 1" "mod_quiz > Grades report" page logged in as teacher1 + And "Flagged" "icon" should exist in the "Student 1" "table_row" + And I am on the "Quiz 1" "mod_quiz > Responses report" page + And "Flagged" "icon" should exist in the "Student 1" "table_row"