Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_feedback
2
Feature: Testing multichoice questions in feedback
3
  In order to create feedbacks
4
  As a teacher
5
  I need to be able to create different types of multichoice questions
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname |
10
      | teacher1 | Teacher   | 1        |
11
      | student1 | Student   | 1        |
12
      | student2 | Student   | 2        |
13
    And the following "courses" exist:
14
      | fullname | shortname |
15
      | Course 1 | C1        |
16
    And the following "course enrolments" exist:
17
      | user     | course | role           |
18
      | teacher1 | C1     | editingteacher |
19
      | student1 | C1     | student        |
20
      | student2 | C1     | student        |
21
    And the following "activities" exist:
22
      | activity   | name                | course | idnumber    |
23
      | feedback   | Learning experience | C1     | feedback0   |
24
    And I am on the "Learning experience" "feedback activity" page logged in as teacher1
25
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
26
 
27
  @javascript
28
  Scenario: Non-rated single-answer multiple choice questions in feedback
29
    When I add a "Multiple choice" question to the feedback with:
30
      | Question         | this is a multiple choice 1 |
31
      | Label            | multichoice1                |
32
      | Multiple choice type | Multiple choice - single answer |
33
      | Multiple choice values | option a\noption b\noption c  |
34
    And I add a "Text and media area" question to the feedback with:
35
      | Contents | this is the first page of the feedback |
36
    And I select "Add a page break" from the "typ" singleselect
37
    And I add a "Multiple choice" question to the feedback with:
38
      | Question         | this is a multiple choice 2 |
39
      | Label            | multichoice2                |
40
      | Multiple choice type | Multiple choice - single answer |
41
      | Multiple choice values | option d\noption e\noption f  |
42
      | Required | 1 |
43
    And I add a "Text and media area" question to the feedback with:
44
      | Contents | this is the second page of the feedback |
45
    And I select "Add a page break" from the "typ" singleselect
46
    And I add a "Multiple choice" question to the feedback with:
47
      | Question         | this is a multiple choice 3 |
48
      | Label            | multichoice3                |
49
      | Multiple choice type | Multiple choice - single answer |
50
      | Multiple choice values | option g\noption h\noption i  |
51
      | Hide the "Not selected" option | Yes                   |
52
      | Dependence item                | multichoice2          |
53
      | Dependence value               | option d              |
54
    And I add a "Text and media area" question to the feedback with:
55
      | Contents | this is the third page of the feedback |
56
    And I log out
57
    And I am on the "Learning experience" "feedback activity" page logged in as student1
58
    And I follow "Answer the questions"
59
    # Examine the first page, select nothing, go to the next page
60
    Then the following fields match these values:
61
      | Not selected | 1 |
62
      | option a     | 0 |
63
      | option b     | 0 |
64
      | option c     | 0 |
65
    And "Previous page" "button" should not exist
66
    And "Submit your answers" "button" should not exist
67
    And I should see "this is the first page of the feedback"
68
    And I should not see "this is the second page of the feedback"
69
    And I should not see "this is the third page of the feedback"
70
    And I press "Next page"
71
    # Examine the second page, select nothing, try to go to the next page
72
    And I should see "Not selected"
73
    And the following fields match these values:
74
      | Not selected | 1 |
75
      | option d     | 0 |
76
      | option e     | 0 |
77
      | option f     | 0 |
78
    And "Previous page" "button" should exist
79
    And "Submit your answers" "button" should not exist
80
    And I should not see "this is the first page of the feedback"
81
    And I should see "this is the second page of the feedback"
82
    And I should not see "this is the third page of the feedback"
83
    And I press "Next page"
84
    # We are still on the second page because the field is required
85
    And I should see "Required" in the "form" "css_element"
86
    And I should see "this is the second page of the feedback"
87
    And I set the field "option e" to "1"
88
    And the following fields match these values:
89
      | Not selected | 0 |
90
      | option d     | 0 |
91
      | option e     | 1 |
92
      | option f     | 0 |
93
    And I press "Next page"
94
    # Now we are on the third page, element is not shown because of wrong dependency.
95
    And I should see "this is the third page of the feedback"
96
    And I should not see "this is a multiple choice 3"
97
    # Go back, check that values are preserved and change the option to enable dependency.
98
    And I press "Previous page"
99
    And the following fields match these values:
100
      | Not selected | 0 |
101
      | option d     | 0 |
102
      | option e     | 1 |
103
      | option f     | 0 |
104
    And I set the field "option d" to "1"
105
    And I press "Next page"
106
    # Now third page contains all items.
107
    And I should see "this is a multiple choice 3"
108
    And I should see "this is the third page of the feedback"
109
    And I should not see "Not selected"
110
    And the following fields match these values:
111
      | option g     | 0 |
112
      | option h     | 0 |
113
      | option i     | 0 |
114
    And "Previous page" "button" should exist
115
    And "Next page" "button" should not exist
116
    And "Submit your answers" "button" should exist
117
    And I set the field "option i" to "1"
118
    And I press "Submit your answers"
119
    And I log out
120
    # Student 2 tries to trick - he answers the third question and then
121
    # goes back and changes dependency question. Analysis should not show this answer!
122
    And I am on the "Learning experience" "feedback activity" page logged in as student2
123
    And I follow "Answer the questions"
124
    And I set the field "option a" to "1"
125
    And I press "Next page"
126
    And I set the field "option d" to "1"
127
    And I press "Next page"
128
    And I set the field "option g" to "1"
129
    And I press "Previous page"
130
    And I set the field "option f" to "1"
131
    And I press "Next page"
132
    And I press "Submit your answers"
133
    And I log out
134
    # Login as teacher and check analysis
135
    And I am on the "Learning experience" "feedback activity" page logged in as teacher1
136
    And I navigate to "Analysis" in current page administration
137
    And I should see "Submitted answers: 2"
138
    And I should see "Questions: 3"
139
    And I show chart data for the "multichoice1" feedback
140
    And I should see "1 (50.00 %)" in the "option a" "table_row"
141
    And I should not see "%" in the "option b" "table_row"
142
    And I should not see "%" in the "option c" "table_row"
143
    And I show chart data for the "multichoice2" feedback
144
    And I should see "1 (50.00 %)" in the "option d" "table_row"
145
    And I should not see "%" in the "option e" "table_row"
146
    And I should see "1 (50.00 %)" in the "option f" "table_row"
147
    And I show chart data for the "multichoice3" feedback
148
    And I should not see "%" in the "option g" "table_row"
149
    And I should not see "%" in the "option h" "table_row"
150
    And I should see "1 (100.00 %)" in the "option i" "table_row"
151
    # Change the settings so we don't analyse empty submits
152
    And I am on the "Learning experience" "feedback activity" page
153
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
154
    And I open the action menu in "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
155
    And I choose "Edit question" in the open action menu
156
    And I set the field "Omit empty submits in analysis" to "Yes"
157
    And I press "Save changes to question"
158
    And I am on the "Learning experience" "feedback activity" page
159
    And I navigate to "Analysis" in current page administration
160
    And I show chart data for the "multichoice1" feedback
161
    And I should see "1 (100.00 %)" in the "option a" "table_row"
162
    And I should not see "%" in the "option b" "table_row"
163
    And I should not see "%" in the "option c" "table_row"
164
    And I log out
165
 
166
  @javascript
167
  Scenario: Non-rated multiple-answers multiple choice questions in feedback
168
    # Create a feedback with three pages, required and dependent questions.
169
    When I add a "Multiple choice" question to the feedback with:
170
      | Question         | this is a multiple choice 1 |
171
      | Label            | multichoice1                |
172
      | Multiple choice type | Multiple choice - multiple answers |
173
      | Multiple choice values | option a\noption b\noption c  |
174
    And I add a "Text and media area" question to the feedback with:
175
      | Contents | this is the first page of the feedback |
176
    And I select "Add a page break" from the "typ" singleselect
177
    And I add a "Multiple choice" question to the feedback with:
178
      | Question         | this is a multiple choice 2 |
179
      | Label            | multichoice2                |
180
      | Multiple choice type | Multiple choice - multiple answers |
181
      | Multiple choice values | option d\noption e\noption f  |
182
      | Required | 1 |
183
    And I add a "Text and media area" question to the feedback with:
184
      | Contents | this is the second page of the feedback |
185
    And I select "Add a page break" from the "typ" singleselect
186
    And I add a "Multiple choice" question to the feedback with:
187
      | Question         | this is a multiple choice 3 |
188
      | Label            | multichoice3                |
189
      | Multiple choice type | Multiple choice - multiple answers |
190
      | Multiple choice values | option g\noption h\noption i  |
191
      | Dependence item                | multichoice2          |
192
      | Dependence value               | option d              |
193
    And I add a "Text and media area" question to the feedback with:
194
      | Contents | this is the third page of the feedback |
195
    And I log out
196
    # Login as the first student.
197
    And I am on the "Learning experience" "feedback activity" page logged in as student1
198
    And I follow "Answer the questions"
199
    # Examine the first page, select nothing, go to the next page
200
    And I should not see "Not selected"
201
    And the following fields match these values:
202
      | option a     | 0 |
203
      | option b     | 0 |
204
      | option c     | 0 |
205
    And "Previous page" "button" should not exist
206
    And "Submit your answers" "button" should not exist
207
    And I should see "this is the first page of the feedback"
208
    And I should not see "this is the second page of the feedback"
209
    And I should not see "this is the third page of the feedback"
210
    And I press "Next page"
211
    # Examine the second page, select nothing, try to go to the next page
212
    Then I should not see "Not selected"
213
    And the following fields match these values:
214
      | option d     | 0 |
215
      | option e     | 0 |
216
      | option f     | 0 |
217
    And "Previous page" "button" should exist
218
    And "Submit your answers" "button" should not exist
219
    And I should not see "this is the first page of the feedback"
220
    And I should see "this is the second page of the feedback"
221
    And I should not see "this is the third page of the feedback"
222
    And I press "Next page"
223
    # We are still on the second page because the field is required
224
    And I should see "Required" in the "form" "css_element"
225
    And I should see "this is the second page of the feedback"
226
    And I set the field "option e" to "1"
227
    And I set the field "option f" to "1"
228
    And the following fields match these values:
229
      | option d     | 0 |
230
      | option e     | 1 |
231
      | option f     | 1 |
232
    And I press "Next page"
233
    # Now we are on the third page, element is not shown because of wrong dependency.
234
    And I should see "this is the third page of the feedback"
235
    And I should not see "this is a multiple choice 3"
236
    # Go back, check that values are preserved and change the option to enable dependency.
237
    And I press "Previous page"
238
    And the following fields match these values:
239
      | option d     | 0 |
240
      | option e     | 1 |
241
      | option f     | 1 |
242
    And I set the field "option d" to "1"
243
    And I set the field "option e" to "0"
244
    And I press "Next page"
245
    # Now third page contains all items.
246
    And I should see "this is a multiple choice 3"
247
    And I should see "this is the third page of the feedback"
248
    And the following fields match these values:
249
      | option g     | 0 |
250
      | option h     | 0 |
251
      | option i     | 0 |
252
    And "Previous page" "button" should exist
253
    And "Next page" "button" should not exist
254
    And "Submit your answers" "button" should exist
255
    And I set the field "option i" to "1"
256
    And I press "Submit your answers"
257
    And I log out
258
    # Student 2 tries to trick - he answers the third question and then
259
    # goes back and changes dependency question. Analysis should not show this answer!
260
    And I am on the "Learning experience" "feedback activity" page logged in as student2
261
    And I follow "Answer the questions"
262
    And I set the field "option a" to "1"
263
    And I set the field "option b" to "1"
264
    And I press "Next page"
265
    And I set the field "option d" to "1"
266
    And I press "Next page"
267
    And I set the field "option g" to "1"
268
    And I press "Previous page"
269
    And I set the field "option d" to "0"
270
    And I set the field "option f" to "1"
271
    And I press "Next page"
272
    And I press "Submit your answers"
273
    And I log out
274
    # Login as teacher and check analysis
275
    And I am on the "Learning experience" "feedback activity" page logged in as teacher1
276
    And I navigate to "Analysis" in current page administration
277
    And I should see "Submitted answers: 2"
278
    And I should see "Questions: 3"
279
    And I show chart data for the "multichoice1" feedback
280
    And I should see "1 (50.00 %)" in the "option a" "table_row"
281
    And I should see "1 (50.00 %)" in the "option b" "table_row"
282
    And I should not see "%" in the "option c" "table_row"
283
    And I show chart data for the "multichoice2" feedback
284
    And I should see "1 (50.00 %)" in the "option d" "table_row"
285
    And I should not see "%" in the "option e" "table_row"
286
    And I should see "2 (100.00 %)" in the "option f" "table_row"
287
    And I show chart data for the "multichoice3" feedback
288
    And I should not see "%" in the "option g" "table_row"
289
    And I should not see "%" in the "option h" "table_row"
290
    And I should see "1 (100.00 %)" in the "option i" "table_row"
291
    # Change the settings so we don't analyse empty submits
292
    And I am on the "Learning experience" "feedback activity" page
293
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
294
    And I open the action menu in "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
295
    And I choose "Edit question" in the open action menu
296
    And I set the field "Omit empty submits in analysis" to "Yes"
297
    And I press "Save changes to question"
298
    And I am on the "Learning experience" "feedback activity" page
299
    And I navigate to "Analysis" in current page administration
300
    And I show chart data for the "multichoice1" feedback
301
    And I should see "1 (100.00 %)" in the "option a" "table_row"
302
    And I should see "1 (100.00 %)" in the "option b" "table_row"
303
    And I should not see "%" in the "option c" "table_row"
304
    And I log out
305
 
306
  @javascript
307
  Scenario: Non-rated single-answer dropdown multiple choice questions in feedback
308
    When I add a "Multiple choice" question to the feedback with:
309
      | Question         | this is a multiple choice 1 |
310
      | Label            | multichoice1                |
311
      | Multiple choice type | Multiple choice - single answer allowed (drop-down menu) |
312
      | Multiple choice values | option a\noption b\noption c  |
313
    And I add a "Text and media area" question to the feedback with:
314
      | Contents | this is the first page of the feedback |
315
    And I select "Add a page break" from the "typ" singleselect
316
    And I add a "Multiple choice" question to the feedback with:
317
      | Question         | this is a multiple choice 2 |
318
      | Label            | multichoice2                |
319
      | Multiple choice type | Multiple choice - single answer allowed (drop-down menu) |
320
      | Multiple choice values | option d\noption e\noption f  |
321
      | Required | 1 |
322
    And I add a "Text and media area" question to the feedback with:
323
      | Contents | this is the second page of the feedback |
324
    And I select "Add a page break" from the "typ" singleselect
325
    And I add a "Multiple choice" question to the feedback with:
326
      | Question         | this is a multiple choice 3 |
327
      | Label            | multichoice3                |
328
      | Multiple choice type | Multiple choice - single answer allowed (drop-down menu) |
329
      | Multiple choice values | option g\noption h\noption i  |
330
      | Dependence item                | multichoice2          |
331
      | Dependence value               | option d              |
332
    And I add a "Text and media area" question to the feedback with:
333
      | Contents | this is the third page of the feedback |
334
    And I log out
335
    And I am on the "Learning experience" "feedback activity" page logged in as student1
336
    And I follow "Answer the questions"
337
    # Examine the first page, select nothing, go to the next page
338
    Then the following fields match these values:
339
      | this is a multiple choice 1 | 0 |
340
    And "Previous page" "button" should not exist
341
    And "Submit your answers" "button" should not exist
342
    And I should see "this is the first page of the feedback"
343
    And I should not see "this is the second page of the feedback"
344
    And I should not see "this is the third page of the feedback"
345
    And I press "Next page"
346
    # Examine the second page, select nothing, try to go to the next page
347
    And the following fields match these values:
348
      | this is a multiple choice 2 | 0 |
349
    And "Previous page" "button" should exist
350
    And "Submit your answers" "button" should not exist
351
    And I should not see "this is the first page of the feedback"
352
    And I should see "this is the second page of the feedback"
353
    And I should not see "this is the third page of the feedback"
354
    And I press "Next page"
355
    # We are still on the second page because the field is required
356
    And I should see "Required" in the "form" "css_element"
357
    And I should see "this is the second page of the feedback"
358
    And I set the field "this is a multiple choice 2" to "option e"
359
    And I press "Next page"
360
    # Now we are on the third page, element is not shown because of wrong dependency.
361
    And I should see "this is the third page of the feedback"
362
    And I should not see "this is a multiple choice 3"
363
    # Go back, check that values are preserved and change the option to enable dependency.
364
    And I press "Previous page"
365
    And the following fields match these values:
366
      | this is a multiple choice 2 | option e |
367
    And I set the field "this is a multiple choice 2" to "option d"
368
    And I press "Next page"
369
    # Now third page contains all items.
370
    And I should see "this is the third page of the feedback"
371
    And the following fields match these values:
372
      | this is a multiple choice 3 | 0 |
373
    And "Previous page" "button" should exist
374
    And "Next page" "button" should not exist
375
    And "Submit your answers" "button" should exist
376
    And I set the field "this is a multiple choice 3" to "option i"
377
    And I press "Submit your answers"
378
    And I log out
379
    # Student 2 tries to trick - he answers the third question and then
380
    # goes back and changes dependency question. Analysis should not show this answer!
381
    And I am on the "Learning experience" "feedback activity" page logged in as student2
382
    And I follow "Answer the questions"
383
    And I set the field "this is a multiple choice 1" to "option a"
384
    And I press "Next page"
385
    And I set the field "this is a multiple choice 2" to "option d"
386
    And I press "Next page"
387
    And I set the field "this is a multiple choice 3" to "option g"
388
    And I press "Previous page"
389
    And I set the field "this is a multiple choice 2" to "option f"
390
    And I press "Next page"
391
    And I press "Submit your answers"
392
    And I log out
393
    # Login as teacher and check analysis
394
    And I am on the "Learning experience" "feedback activity" page logged in as teacher1
395
    And I navigate to "Analysis" in current page administration
396
    And I should see "Submitted answers: 2"
397
    And I should see "Questions: 3"
398
    And I show chart data for the "multichoice1" feedback
399
    And I should see "1 (50.00 %)" in the "option a" "table_row"
400
    And I should not see "%" in the "option b" "table_row"
401
    And I should not see "%" in the "option c" "table_row"
402
    And I show chart data for the "multichoice2" feedback
403
    And I should see "1 (50.00 %)" in the "option d" "table_row"
404
    And I should not see "%" in the "option e" "table_row"
405
    And I should see "1 (50.00 %)" in the "option f" "table_row"
406
    And I show chart data for the "multichoice3" feedback
407
    And I should not see "%" in the "option g" "table_row"
408
    And I should not see "%" in the "option h" "table_row"
409
    And I should see "1 (100.00 %)" in the "option i" "table_row"
410
    # Change the settings so we don't analyse empty submits
411
    And I am on the "Learning experience" "feedback activity" page
412
    And I click on "Edit questions" "link" in the "[role=main]" "css_element"
413
    And I open the action menu in "//div[contains(@class, 'feedback_itemlist') and contains(.,'multichoice1')]" "xpath_element"
414
    And I choose "Edit question" in the open action menu
415
    And I set the field "Omit empty submits in analysis" to "Yes"
416
    And I press "Save changes to question"
417
    And I am on the "Learning experience" "feedback activity" page
418
    And I navigate to "Analysis" in current page administration
419
    And I show chart data for the "multichoice1" feedback
420
    And I should see "1 (100.00 %)" in the "option a" "table_row"
421
    And I should not see "%" in the "option b" "table_row"
422
    And I should not see "%" in the "option c" "table_row"