1 |
efrain |
1 |
@mod @mod_quiz
|
|
|
2 |
Feature: Edit quiz page - adding things
|
|
|
3 |
In order to build the quiz I want my students to attempt
|
|
|
4 |
As a teacher
|
|
|
5 |
I need to be able to add questions to the quiz.
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| teacher1 | T1 | Teacher1 | teacher1@example.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 the following "activities" exist:
|
|
|
18 |
| activity | name | intro | course | idnumber |
|
|
|
19 |
| quiz | Quiz 1 | Quiz 1 for testing the Add menu | C1 | quiz1 |
|
|
|
20 |
And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
|
|
|
21 |
|
|
|
22 |
@javascript
|
|
|
23 |
Scenario: Add some new question to the quiz using '+ a new question' options of the 'Add' menu.
|
|
|
24 |
When I open the "last" add to quiz menu
|
|
|
25 |
And I follow "a new question"
|
|
|
26 |
And I set the field "item_qtype_essay" to "1"
|
|
|
27 |
And I press "submitbutton"
|
|
|
28 |
Then I should see "Adding an Essay question"
|
|
|
29 |
And I set the field "Question name" to "Essay 01 new"
|
|
|
30 |
And I set the field "Question text" to "Please write 200 words about Essay 01"
|
|
|
31 |
And I press "id_submitbutton"
|
|
|
32 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
33 |
|
|
|
34 |
And I open the "Page 1" add to quiz menu
|
|
|
35 |
And I follow "a new question"
|
|
|
36 |
And I set the field "item_qtype_essay" to "1"
|
|
|
37 |
And I press "submitbutton"
|
|
|
38 |
Then I should see "Adding an Essay question"
|
|
|
39 |
And I set the field "Question name" to "Essay 02 new"
|
|
|
40 |
And I set the field "Question text" to "Please write 200 words about Essay 02"
|
|
|
41 |
And I press "id_submitbutton"
|
|
|
42 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
43 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
44 |
|
|
|
45 |
And I open the "Page 1" add to quiz menu
|
|
|
46 |
And I follow "a new question"
|
|
|
47 |
And I set the field "item_qtype_essay" to "1"
|
|
|
48 |
And I press "submitbutton"
|
|
|
49 |
Then I should see "Adding an Essay question"
|
|
|
50 |
And I set the field "Question name" to "Essay 03 new"
|
|
|
51 |
And I set the field "Question text" to "Please write 300 words about Essay 03"
|
|
|
52 |
And I press "id_submitbutton"
|
|
|
53 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
54 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
55 |
And I should see "Essay 03 new" on quiz page "1"
|
|
|
56 |
|
|
|
57 |
And I open the "Page 1" add to quiz menu
|
|
|
58 |
And I follow "a new question"
|
|
|
59 |
And I set the field "item_qtype_essay" to "1"
|
|
|
60 |
And I press "submitbutton"
|
|
|
61 |
Then I should see "Adding an Essay question"
|
|
|
62 |
And I set the field "Question name" to "Essay 04 new"
|
|
|
63 |
And I set the field "Question text" to "Please write 300 words about Essay 04"
|
|
|
64 |
And I press "id_submitbutton"
|
|
|
65 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
66 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
67 |
And I should see "Essay 03 new" on quiz page "1"
|
|
|
68 |
And I should see "Essay 04 new" on quiz page "1"
|
|
|
69 |
|
|
|
70 |
# Repaginate as two questions per page.
|
|
|
71 |
And I should not see "Page 2"
|
|
|
72 |
When I press "Repaginate"
|
|
|
73 |
Then I should see "Repaginate with"
|
|
|
74 |
And I set the field "menuquestionsperpage" to "2"
|
|
|
75 |
And I click on "Go" "button" in the "Repaginate" "dialogue"
|
|
|
76 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
77 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
78 |
And I should see "Essay 03 new" on quiz page "2"
|
|
|
79 |
And I should see "Essay 04 new" on quiz page "2"
|
|
|
80 |
|
|
|
81 |
# Add a question to page 2.
|
|
|
82 |
When I open the "Page 2" add to quiz menu
|
|
|
83 |
And I choose "a new question" in the open action menu
|
|
|
84 |
And I set the field "item_qtype_essay" to "1"
|
|
|
85 |
And I press "submitbutton"
|
|
|
86 |
Then I should see "Adding an Essay question"
|
|
|
87 |
And I set the field "Question name" to "Essay for page 2"
|
|
|
88 |
And I set the field "Question text" to "Please write 200 words about Essay for page 2"
|
|
|
89 |
And I press "id_submitbutton"
|
|
|
90 |
And I should see "Essay 01 new" on quiz page "1"
|
|
|
91 |
And I should see "Essay 02 new" on quiz page "1"
|
|
|
92 |
And I should see "Essay 03 new" on quiz page "2"
|
|
|
93 |
And I should see "Essay 04 new" on quiz page "2"
|
|
|
94 |
And I should see "Essay for page 2" on quiz page "2"
|
|
|
95 |
|
|
|
96 |
@javascript
|
|
|
97 |
Scenario: Add questions from question bank to the quiz. In order to be able to
|
|
|
98 |
add questions from question bank to the quiz, first we create some new questions
|
|
|
99 |
in various categories and add them to the question bank.
|
|
|
100 |
|
|
|
101 |
# Create a couple of sub categories.
|
|
|
102 |
When I am on the "Course 1" "core_question > course question categories" page
|
|
|
103 |
Then I should see "Add category"
|
|
|
104 |
And I follow "Add category"
|
|
|
105 |
Then I set the field "Parent category" to "Default for C1"
|
|
|
106 |
And I set the field "Name" to "Subcat 1"
|
|
|
107 |
And I set the field "Category info" to "This is sub category 1"
|
|
|
108 |
And I press "id_submitbutton"
|
|
|
109 |
And I should see "Subcat 1"
|
|
|
110 |
|
|
|
111 |
And I follow "Add category"
|
|
|
112 |
Then I set the field "Parent category" to "Default for C1"
|
|
|
113 |
And I set the field "Name" to "Subcat 2"
|
|
|
114 |
And I set the field "Category info" to "This is sub category 2"
|
|
|
115 |
And I press "id_submitbutton"
|
|
|
116 |
And I should see "Subcat 2"
|
|
|
117 |
|
|
|
118 |
And I select "Questions" from the "Question bank tertiary navigation" singleselect
|
|
|
119 |
And I should see "Question bank"
|
|
|
120 |
|
|
|
121 |
# Create the Essay 01 question.
|
|
|
122 |
When I press "Create a new question ..."
|
|
|
123 |
And I set the field "item_qtype_essay" to "1"
|
|
|
124 |
And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
|
|
|
125 |
Then I should see "Adding an Essay question"
|
|
|
126 |
And I set the field "Question name" to "Essay 01"
|
|
|
127 |
And I set the field "Question text" to "Please write 100 words about Essay 01"
|
|
|
128 |
And I press "id_submitbutton"
|
|
|
129 |
Then I should see "Question bank"
|
|
|
130 |
And I should see "Essay 01"
|
|
|
131 |
|
|
|
132 |
# Create the Essay 02 question.
|
|
|
133 |
When I press "Create a new question ..."
|
|
|
134 |
And I set the field "item_qtype_essay" to "1"
|
|
|
135 |
And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
|
|
|
136 |
Then I should see "Adding an Essay question"
|
|
|
137 |
And I set the field "Question name" to "Essay 02"
|
|
|
138 |
And I set the field "Question text" to "Please write 200 words about Essay 02"
|
|
|
139 |
And I press "id_submitbutton"
|
|
|
140 |
Then I should see "Question bank"
|
|
|
141 |
And I should see "Essay 02"
|
|
|
142 |
|
|
|
143 |
# Create the Essay 03 question.
|
|
|
144 |
And I wait until the page is ready
|
|
|
145 |
When I press "Create a new question ..."
|
|
|
146 |
And I set the field "item_qtype_essay" to "1"
|
|
|
147 |
And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
|
|
|
148 |
Then I should see "Adding an Essay question"
|
|
|
149 |
And I set the field "Question name" to "Essay 03"
|
|
|
150 |
And I set the field "Question text" to "Please write 300 words about Essay 03"
|
|
|
151 |
And I press "id_submitbutton"
|
|
|
152 |
Then I should see "Question bank"
|
|
|
153 |
And I should see "Essay 03"
|
|
|
154 |
|
|
|
155 |
# Create the TF 01 question.
|
|
|
156 |
When I press "Create a new question ..."
|
|
|
157 |
And I set the field "item_qtype_truefalse" to "1"
|
|
|
158 |
And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
|
|
|
159 |
Then I should see "Adding a True/False question"
|
|
|
160 |
And I set the field "Question name" to "TF 01"
|
|
|
161 |
And I set the field "Question text" to "The correct answer is true"
|
|
|
162 |
And I set the field "Correct answer" to "True"
|
|
|
163 |
And I press "id_submitbutton"
|
|
|
164 |
Then I should see "Question bank"
|
|
|
165 |
And I should see "TF 01"
|
|
|
166 |
|
|
|
167 |
# Create the TF 02 question.
|
|
|
168 |
When I press "Create a new question ..."
|
|
|
169 |
And I set the field "item_qtype_truefalse" to "1"
|
|
|
170 |
And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
|
|
|
171 |
Then I should see "Adding a True/False question"
|
|
|
172 |
And I set the field "Question name" to "TF 02"
|
|
|
173 |
And I set the field "Question text" to "The correct answer is false"
|
|
|
174 |
And I set the field "Correct answer" to "False"
|
|
|
175 |
And I press "id_submitbutton"
|
|
|
176 |
Then I should see "Question bank"
|
|
|
177 |
And I should see "TF 02"
|
|
|
178 |
|
|
|
179 |
# Add questions from question bank using the Add menu.
|
|
|
180 |
# Add Essay 03 from question bank.
|
|
|
181 |
And I am on the "Quiz 1" "mod_quiz > Edit" page
|
|
|
182 |
And I open the "last" add to quiz menu
|
|
|
183 |
And I follow "from question bank"
|
|
|
184 |
Then the "Add selected questions to the quiz" "button" should be disabled
|
|
|
185 |
And I click on "Select" "checkbox" in the "Essay 03" "table_row"
|
|
|
186 |
Then the "Add selected questions to the quiz" "button" should be enabled
|
|
|
187 |
And I click on "Add to quiz" "link" in the "Essay 03" "table_row"
|
|
|
188 |
And I should see "Essay 03" on quiz page "1"
|
|
|
189 |
|
|
|
190 |
# Add Essay 01 from question bank.
|
|
|
191 |
And I open the "Page 1" add to quiz menu
|
|
|
192 |
And I follow "from question bank"
|
|
|
193 |
And I click on "Add to quiz" "link" in the "Essay 01" "table_row"
|
|
|
194 |
And I should see "Essay 03" on quiz page "1"
|
|
|
195 |
And I should see "Essay 01" on quiz page "1"
|
|
|
196 |
|
|
|
197 |
# Add Esay 02 from question bank.
|
|
|
198 |
And I open the "Page 1" add to quiz menu
|
|
|
199 |
And I follow "from question bank"
|
|
|
200 |
And I click on "Add to quiz" "link" in the "Essay 02" "table_row"
|
|
|
201 |
And I should see "Essay 03" on quiz page "1"
|
|
|
202 |
And I should see "Essay 01" on quiz page "1"
|
|
|
203 |
And I should see "Essay 02" on quiz page "1"
|
|
|
204 |
|
|
|
205 |
# Add a random question.
|
|
|
206 |
And I open the "Page 1" add to quiz menu
|
|
|
207 |
And I follow "a random question"
|
|
|
208 |
And I press "Add random question"
|
|
|
209 |
And I should see "Essay 03" on quiz page "1"
|
|
|
210 |
And I should see "Essay 01" on quiz page "1"
|
|
|
211 |
And I should see "Essay 02" on quiz page "1"
|
|
|
212 |
And I should see "Random" on quiz page "1"
|
|
|
213 |
|
|
|
214 |
# Repaginate as one question per page.
|
|
|
215 |
And I should not see "Page 2"
|
|
|
216 |
When I press "Repaginate"
|
|
|
217 |
Then I should see "Repaginate with"
|
|
|
218 |
And I set the field "menuquestionsperpage" to "1"
|
|
|
219 |
When I click on "Go" "button" in the "Repaginate" "dialogue"
|
|
|
220 |
And I should see "Essay 03" on quiz page "1"
|
|
|
221 |
And I should see "Essay 01" on quiz page "2"
|
|
|
222 |
And I should see "Essay 02" on quiz page "3"
|
|
|
223 |
And I should see "Random" on quiz page "4"
|
|
|
224 |
|
|
|
225 |
# Add a random question to page 4.
|
|
|
226 |
And I open the "Page 4" add to quiz menu
|
|
|
227 |
And I choose "a new question" in the open action menu
|
|
|
228 |
And I set the field "item_qtype_essay" to "1"
|
|
|
229 |
And I press "submitbutton"
|
|
|
230 |
Then I should see "Adding an Essay question"
|
|
|
231 |
And I set the field "Question name" to "Essay for page 4"
|
|
|
232 |
And I set the field "Question text" to "Please write 200 words about Essay for page 4"
|
|
|
233 |
And I press "id_submitbutton"
|
|
|
234 |
And I should see "Essay 03" on quiz page "1"
|
|
|
235 |
And I should see "Essay 01" on quiz page "2"
|
|
|
236 |
And I should see "Essay 02" on quiz page "3"
|
|
|
237 |
And I should see "Random" on quiz page "4"
|
|
|
238 |
And I should see "Essay for page 4" on quiz page "4"
|
|
|
239 |
|
|
|
240 |
@accessibility @javascript
|
|
|
241 |
Scenario: Check the accessibility of the quiz questions page
|
|
|
242 |
Given the following "question categories" exist:
|
|
|
243 |
| contextlevel | reference | name |
|
|
|
244 |
| Course | C1 | Test questions |
|
|
|
245 |
And the following "questions" exist:
|
|
|
246 |
| questioncategory | qtype | name | questiontext |
|
|
|
247 |
| Test questions | truefalse | First question | Answer the first question |
|
|
|
248 |
| Test questions | truefalse | Other question | Answer the first question |
|
|
|
249 |
And quiz "Quiz 1" contains the following questions:
|
|
|
250 |
| question | page |
|
|
|
251 |
| First question | 1 |
|
|
|
252 |
When I reload the page
|
|
|
253 |
Then I should see "First question"
|
|
|
254 |
And the page should meet accessibility standards
|