Proyectos de Subversion Moodle

Rev

Rev 1 | | Comparar con el anterior | Ultima modificación | Ver Log |

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