MDL-60897 qtype_multianswer: Invalid cloze-questions saved to db
[moodle.git] / question / type / multianswer / tests / behat / add.feature
CommitLineData
09fc929e
JMV
1@qtype @qtype_multianswer
2Feature: Test creating a Multianswer (Cloze) question
3 As a teacher
4 In order to test my students
5 I need to be able to create a Cloze question
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | T1 | Teacher1 | teacher1@moodle.com |
11 And the following "courses" exist:
12 | fullname | shortname | category |
13 | Course 1 | C1 | 0 |
14 And the following "course enrolments" exist:
15 | user | course | role |
16 | teacher1 | C1 | editingteacher |
17 And I log in as "teacher1"
18 And I am on "Course 1" course homepage
19 And I navigate to "Question bank" in current page administration
20
21 Scenario: Create a Cloze question
22 When I add a "Embedded answers (Cloze)" question filling the form with:
23 | Question name | multianswer-001 |
24 | Question text | {1:SHORTANSWER:=Berlin} is the capital of Germany. |
25 | General feedback | The capital of Germany is Berlin. |
26 Then I should see "multianswer-001"
27
28 Scenario: Create a broken Cloze question and correct it
29 When I press "Create a new question ..."
30 And I set the field "Embedded answers (Cloze)" to "1"
31 And I press "Add"
32 And I set the field "Question name" to "multianswer-002"
33 And I set the field "Question text" to "Please select the fruits {1:MULTICHOICE:=Apple#Correct}"
34 And I set the field "General feedback" to "Apple are delicious."
35 And I press "id_submitbutton"
36 Then I should see "This type of question requires at least 2 choices"
37 When I set the following fields to these values:
38 | Question text | Please select the fruits {1:MULTICHOICE:=Apple#Correct~Banana#Wrong} |
39 And I press "id_submitbutton"
40 Then I should not see "This type of question requires at least 2 choices"