From a79c0618216e84d02a5f40851485b265d8607e44 Mon Sep 17 00:00:00 2001 From: Angelia Dela Cruz Date: Wed, 13 Dec 2023 12:32:19 +0800 Subject: [PATCH] MDL-80402 mod_quiz: Behat for interactive quiz question dependency --- .../behat/attempt_require_previous.feature | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/mod/quiz/tests/behat/attempt_require_previous.feature b/mod/quiz/tests/behat/attempt_require_previous.feature index 80d3863cabe..cf715db3482 100644 --- a/mod/quiz/tests/behat/attempt_require_previous.feature +++ b/mod/quiz/tests/behat/attempt_require_previous.feature @@ -21,14 +21,14 @@ Feature: Attempt a quiz where some questions require that the previous question | Course | C1 | Test questions | @javascript - Scenario: A question that requires the previous one is initally blocked + Scenario Outline: A question that requires the previous one is initially blocked Given the following "questions" exist: | questioncategory | qtype | name | questiontext | | Test questions | truefalse | TF1 | First question | | Test questions | truefalse | TF2 | Second question | And the following "activities" exist: | activity | name | intro | course | idnumber | preferredbehaviour | - | quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback | + | quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | | And quiz "Quiz 1" contains the following questions: | question | page | requireprevious | | TF1 | 1 | 0 | @@ -40,7 +40,6 @@ Feature: Attempt a quiz where some questions require that the previous question Then I should see "First question" And I should see "This question cannot be attempted until the previous question has been completed." And I should not see "Second question" - And I log out And I am on the "Quiz 1 > student > Attempt 1" "mod_quiz > Attempt review" page logged in as "teacher" And I should see "First question" And I should see "This question cannot be attempted until the previous question has been completed." @@ -48,15 +47,20 @@ Feature: Attempt a quiz where some questions require that the previous question And "Question 1" "link" should exist And "Question 2" "link" should not exist + Examples: + | quizbehaviour | + | immediatefeedback | + | interactive | + @javascript - Scenario: A question is shown as blocked when previewing a quiz + Scenario Outline: A question is shown as blocked when previewing a quiz Given the following "questions" exist: | questioncategory | qtype | name | questiontext | | Test questions | truefalse | TF1 | First question | | Test questions | truefalse | TF2 | Second question | And the following "activities" exist: | activity | name | intro | course | idnumber | preferredbehaviour | - | quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback | + | quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | | And quiz "Quiz 1" contains the following questions: | question | page | requireprevious | | TF1 | 1 | 0 | @@ -69,15 +73,20 @@ Feature: Attempt a quiz where some questions require that the previous question And I should see "This question cannot be attempted until the previous question has been completed." And I should not see "Second question" + Examples: + | quizbehaviour | + | immediatefeedback | + | interactive | + @javascript - Scenario: A question requires the previous one becomes available when the first one is answered + Scenario Outline: A question requires the previous one becomes available when the first one is answered Given the following "questions" exist: | questioncategory | qtype | name | questiontext | | Test questions | truefalse | TF1 | First question | | Test questions | truefalse | TF2 | Second question | And the following "activities" exist: | activity | name | intro | course | idnumber | preferredbehaviour | - | quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | immediatefeedback | + | quiz | Quiz 1 | Quiz 1 description | C1 | quiz1 | | And quiz "Quiz 1" contains the following questions: | question | page | requireprevious | | TF1 | 1 | 0 | @@ -94,6 +103,11 @@ Feature: Attempt a quiz where some questions require that the previous question And "Question 1" "link" should exist And "Question 2" "link" should exist + Examples: + | quizbehaviour | + | immediatefeedback | + | interactive | + @javascript Scenario: After quiz submitted, all questions show on the review page Given the following "questions" exist: