[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
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 log in as "teacher1" 21 And I follow "Course 1" 22 And I follow "Quiz 1" 23 And I navigate to "Edit quiz" node in "Quiz administration" 24 Then I should see "Editing quiz: Quiz 1" 25 26 @javascript 27 Scenario: Add some new question to the quiz using '+ a new question' options of the 'Add' menu. 28 And I open the "last" add to quiz menu 29 And I follow "a new question" 30 And I set the field "qtype_qtype_essay" to "1" 31 And I press "submitbutton" 32 Then I should see "Adding an Essay question" 33 And I set the field "Question name" to "Essay 01 new" 34 And I set the field "Question text" to "Please write 200 words about Essay 01" 35 And I press "id_submitbutton" 36 Then I should see "Editing quiz: Quiz 1" 37 And I should see "Essay 01 new" on quiz page "1" 38 39 And I open the "Page 1" add to quiz menu 40 And I follow "a new question" 41 And I set the field "qtype_qtype_essay" to "1" 42 And I press "submitbutton" 43 Then I should see "Adding an Essay question" 44 And I set the field "Question name" to "Essay 02 new" 45 And I set the field "Question text" to "Please write 200 words about Essay 02" 46 And I press "id_submitbutton" 47 Then I should see "Editing quiz: Quiz 1" 48 And I should see "Essay 01 new" on quiz page "1" 49 And I should see "Essay 02 new" on quiz page "1" 50 51 And I open the "Page 1" add to quiz menu 52 And I follow "a new question" 53 And I set the field "qtype_qtype_essay" to "1" 54 And I press "submitbutton" 55 Then I should see "Adding an Essay question" 56 And I set the field "Question name" to "Essay 03 new" 57 And I set the field "Question text" to "Please write 300 words about Essay 03" 58 And I press "id_submitbutton" 59 Then I should see "Editing quiz: Quiz 1" 60 And I should see "Essay 01 new" on quiz page "1" 61 And I should see "Essay 02 new" on quiz page "1" 62 And I should see "Essay 03 new" on quiz page "1" 63 64 And I open the "Page 1" add to quiz menu 65 And I follow "a new question" 66 And I set the field "qtype_qtype_essay" to "1" 67 And I press "submitbutton" 68 Then I should see "Adding an Essay question" 69 And I set the field "Question name" to "Essay 04 new" 70 And I set the field "Question text" to "Please write 300 words about Essay 04" 71 And I press "id_submitbutton" 72 Then I should see "Editing quiz: Quiz 1" 73 And I should see "Essay 01 new" on quiz page "1" 74 And I should see "Essay 02 new" on quiz page "1" 75 And I should see "Essay 03 new" on quiz page "1" 76 And I should see "Essay 04 new" on quiz page "1" 77 78 # Repaginate as two questions per page. 79 And I should not see "Page 2" 80 When I press "Repaginate" 81 Then I should see "Repaginate with" 82 And I set the field "menuquestionsperpage" to "2" 83 When I press "Go" 84 And I should see "Essay 01 new" on quiz page "1" 85 And I should see "Essay 02 new" on quiz page "1" 86 And I should see "Essay 03 new" on quiz page "2" 87 And I should see "Essay 04 new" on quiz page "2" 88 89 # Add a question to page 2. 90 When I open the "Page 2" add to quiz menu 91 And I follow "a new question" in the open menu 92 And I set the field "qtype_qtype_essay" to "1" 93 And I press "submitbutton" 94 Then I should see "Adding an Essay question" 95 When I set the field "Question name" to "Essay for page 2" 96 And I set the field "Question text" to "Please write 200 words about Essay for page 2" 97 And I press "id_submitbutton" 98 Then I should see "Editing quiz: Quiz 1" 99 And I should see "Essay 01 new" on quiz page "1" 100 And I should see "Essay 02 new" on quiz page "1" 101 And I should see "Essay 03 new" on quiz page "2" 102 And I should see "Essay 04 new" on quiz page "2" 103 And I should see "Essay for page 2" on quiz page "2" 104 105 @javascript 106 Scenario: Add questions from question bank to the quiz. In order to be able to 107 add questions from question bank to the quiz, first we create some new questions 108 in various categories and add them to the question bank. 109 110 # Create a couple of sub categories. 111 And I follow "Course 1" 112 And I navigate to "Categories" node in "Course administration > Question bank" 113 Then I should see "Add category" 114 Then I set the field "Parent category" to "Default for C1" 115 And I set the field "Name" to "Subcat 1" 116 And I set the field "Category info" to "This is sub category 1" 117 Then I press "id_submitbutton" 118 And I should see "Subcat 1" 119 120 Then I set the field "Parent category" to "Default for C1" 121 And I set the field "Name" to "Subcat 2" 122 And I set the field "Category info" to "This is sub category 2" 123 Then I press "id_submitbutton" 124 And I should see "Subcat 2" 125 126 And I navigate to "Questions" node in "Course administration > Question bank" 127 Then I should see "Question bank" 128 And I should see "Select a category" 129 130 # Create the Essay 01 question. 131 When I press "Create a new question ..." 132 And I set the field "qtype_qtype_essay" to "1" 133 And I press "Add" 134 Then I should see "Adding an Essay question" 135 And I set the field "Question name" to "Essay 01" 136 And I set the field "Question text" to "Please write 100 words about Essay 01" 137 And I press "id_submitbutton" 138 Then I should see "Question bank" 139 And I should see "Essay 01" 140 141 # Create the Essay 02 question. 142 And I should see "Select a category" 143 And I set the field "Select a category:" to "Subcat 1" 144 When I press "Create a new question ..." 145 And I set the field "qtype_qtype_essay" to "1" 146 And I press "Add" 147 Then I should see "Adding an Essay question" 148 And I set the field "Question name" to "Essay 02" 149 And I set the field "Question text" to "Please write 200 words about Essay 02" 150 And I press "id_submitbutton" 151 Then I should see "Question bank" 152 And I should see "Essay 02" 153 154 # Create the Essay 03 question. 155 And I set the field "Select a category" to "Default for C1" 156 And I wait until the page is ready 157 When I press "Create a new question ..." 158 And I set the field "qtype_qtype_essay" to "1" 159 And I press "Add" 160 Then I should see "Adding an Essay question" 161 And I set the field "Question name" to "Essay 03" 162 And I set the field "Question text" to "Please write 300 words about Essay 03" 163 And I press "id_submitbutton" 164 Then I should see "Question bank" 165 And I should see "Essay 03" 166 167 # Create the TF 01 question. 168 When I press "Create a new question ..." 169 And I set the field "qtype_qtype_truefalse" to "1" 170 And I press "Add" 171 Then I should see "Adding a True/False question" 172 And I set the field "Question name" to "TF 01" 173 And I set the field "Question text" to "The correct answer is true" 174 And I set the field "Correct answer" to "True" 175 And I press "id_submitbutton" 176 Then I should see "Question bank" 177 And I should see "TF 01" 178 179 # Create the TF 02 question. 180 When I press "Create a new question ..." 181 And I set the field "qtype_qtype_truefalse" to "1" 182 And I press "Add" 183 Then I should see "Adding a True/False question" 184 And I set the field "Question name" to "TF 02" 185 And I set the field "Question text" to "The correct answer is false" 186 And I set the field "Correct answer" to "False" 187 And I press "id_submitbutton" 188 Then I should see "Question bank" 189 And I should see "TF 02" 190 191 # Add questions from question bank using the Add menu. 192 # Add Essay 03 from question bank. 193 And I follow "Course 1" 194 And I follow "Quiz 1" 195 And I follow "Edit quiz" 196 And I open the "last" add to quiz menu 197 And I follow "from question bank" 198 And I click on "Add to quiz" "link" in the "Essay 03" "table_row" 199 Then I should see "Editing quiz: Quiz 1" 200 And I should see "Essay 03" on quiz page "1" 201 202 # Add Essay 01 from question bank. 203 And I open the "Page 1" add to quiz menu 204 And I follow "from question bank" 205 And I click on "Add to quiz" "link" in the "Essay 01" "table_row" 206 Then I should see "Editing quiz: Quiz 1" 207 And I should see "Essay 03" on quiz page "1" 208 And I should see "Essay 01" on quiz page "1" 209 210 # Add Esay 02 from question bank. 211 And I open the "Page 1" add to quiz menu 212 And I follow "from question bank" 213 And I should see "Select a category" 214 And I set the field "Select a category" to "Subcat 1" 215 And I click on "Add to quiz" "link" in the "Essay 02" "table_row" 216 Then I should see "Editing quiz: Quiz 1" 217 And I should see "Essay 03" on quiz page "1" 218 And I should see "Essay 01" on quiz page "1" 219 And I should see "Essay 02" on quiz page "1" 220 221 # Add a random question. 222 And I open the "Page 1" add to quiz menu 223 And I follow "a random question" 224 And I press "Add random question" 225 Then I should see "Editing quiz: Quiz 1" 226 And I should see "Essay 03" on quiz page "1" 227 And I should see "Essay 01" on quiz page "1" 228 And I should see "Essay 02" on quiz page "1" 229 And I should see "Random" on quiz page "1" 230 231 # Repaginate as one question per page. 232 And I should not see "Page 2" 233 When I press "Repaginate" 234 Then I should see "Repaginate with" 235 And I set the field "menuquestionsperpage" to "1" 236 When I press "Go" 237 And I should see "Essay 03" on quiz page "1" 238 And I should see "Essay 01" on quiz page "2" 239 And I should see "Essay 02" on quiz page "3" 240 And I should see "Random" on quiz page "4" 241 242 # Add a random question to page 4. 243 And I open the "Page 4" add to quiz menu 244 And I follow "a new question" in the open menu 245 And I set the field "qtype_qtype_essay" to "1" 246 And I press "submitbutton" 247 Then I should see "Adding an Essay question" 248 And I set the field "Question name" to "Essay for page 4" 249 And I set the field "Question text" to "Please write 200 words about Essay for page 4" 250 And I press "id_submitbutton" 251 Then I should see "Editing quiz: Quiz 1" 252 And I should see "Essay 03" on quiz page "1" 253 And I should see "Essay 01" on quiz page "2" 254 And I should see "Essay 02" on quiz page "3" 255 And I should see "Random" on quiz page "4" 256 And I should see "Essay for page 4" on quiz page "4"
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |