Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_quiz
2
Feature: Edit quiz page - remove multiple questions
3
  In order to change the layout of a quiz I built efficiently
4
  As a teacher
5
  I need to be able to delete many questions questions.
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 "question categories" exist:
18
      | contextlevel | reference | name           |
19
      | Course       | C1        | Test questions |
20
    And the following "activities" exist:
21
      | activity   | name   | course | idnumber |
22
      | quiz       | Quiz 1 | C1     | quiz1    |
23
    And I log in as "teacher1"
24
 
25
  @javascript
26
  Scenario: Delete selected question using select multiple items feature.
27
    Given the following "questions" exist:
28
      | questioncategory | qtype       | name       | questiontext        |
29
      | Test questions   | description | Info       | Some instructions   |
30
      | Test questions   | truefalse   | Question A | This is question 01 |
31
      | Test questions   | truefalse   | Question B | This is question 02 |
32
      | Test questions   | truefalse   | Question C | This is question 03 |
33
    And quiz "Quiz 1" contains the following questions:
34
      | question   | page |
35
      | Info       | 1    |
36
      | Question A | 1    |
37
      | Question B | 1    |
38
      | Question C | 2    |
39
    And I am on the "Quiz 1" "mod_quiz > Edit" page
40
 
41
    # Confirm the starting point.
42
    Then I should see "Question A" on quiz page "1"
43
    And I should see "Question B" on quiz page "1"
44
    And I should see "Question C" on quiz page "2"
45
    And I should see "Total of marks: 3.00"
46
    And I should see "Questions: 4"
47
    And I should see "This quiz is open"
48
 
49
    # Delete last question in last page. Page contains multiple questions. No reordering.
50
    When I click on "Select multiple items" "button"
51
    Then I click on "selectquestion-3" "checkbox"
52
    And I click on "Delete selected" "button"
53
    And I click on "Yes" "button" in the "Confirm" "dialogue"
54
 
55
    Then I should see "Info" on quiz page "1"
56
    And I should see "Question A" on quiz page "1"
57
    And I should not see "Question B" on quiz page "1"
58
    And I should see "Question C" on quiz page "2"
59
    And I should see "Total of marks: 2.00"
60
    And I should see "Questions: 3"
61
 
62
  @javascript
63
  Scenario: Delete first selected question using select multiple items feature.
64
    Given the following "questions" exist:
65
      | questioncategory | qtype     | name       | questiontext        |
66
      | Test questions   | truefalse | Question A | This is question 01 |
67
      | Test questions   | truefalse | Question B | This is question 02 |
68
      | Test questions   | truefalse | Question C | This is question 03 |
69
    And quiz "Quiz 1" contains the following questions:
70
      | question   | page |
71
      | Question A | 1    |
72
      | Question B | 2    |
73
      | Question C | 2    |
74
    And I am on the "Quiz 1" "mod_quiz > Edit" page
75
 
76
  # Confirm the starting point.
77
    Then I should see "Question A" on quiz page "1"
78
    And I should see "Question B" on quiz page "2"
79
    And I should see "Question C" on quiz page "2"
80
    And I should see "Total of marks: 3.00"
81
    And I should see "Questions: 3"
82
    And I should see "This quiz is open"
83
 
84
  # Delete first question in first page. Page contains multiple questions. No reordering.
85
    When I click on "Select multiple items" "button"
86
    Then I click on "selectquestion-1" "checkbox"
87
    And I click on "Delete selected" "button"
88
    And I click on "Yes" "button" in the "Confirm" "dialogue"
89
 
90
    Then I should not see "Question A" on quiz page "1"
91
    And I should see "Question B" on quiz page "1"
92
    And I should see "Question C" on quiz page "1"
93
    And I should see "Total of marks: 2.00"
94
    And I should see "Questions: 2"
95
 
96
  @javascript
97
  Scenario: Can delete the last question in a quiz.
98
    Given the following "questions" exist:
99
      | questioncategory | qtype     | name       | questiontext        |
100
      | Test questions   | truefalse | Question A | This is question 01 |
101
    And quiz "Quiz 1" contains the following questions:
102
      | question   | page |
103
      | Question A | 1    |
104
    And I am on the "Quiz 1" "mod_quiz > Edit" page
105
    When I click on "Select multiple items" "button"
106
    And I click on "selectquestion-1" "checkbox"
107
    And I click on "Delete selected" "button"
108
    And I click on "Yes" "button" in the "Confirm" "dialogue"
109
    Then I should see "Questions: 0"
110
 
111
  @javascript
112
  Scenario: Delete all questions by checking select all.
113
    Given the following "questions" exist:
114
      | questioncategory | qtype     | name       | questiontext        |
115
      | Test questions   | truefalse | Question A | This is question 01 |
116
      | Test questions   | truefalse | Question B | This is question 02 |
117
      | Test questions   | truefalse | Question C | This is question 03 |
118
    And quiz "Quiz 1" contains the following questions:
119
      | question   | page |
120
      | Question A | 1    |
121
      | Question B | 1    |
122
      | Question C | 2    |
123
    And I am on the "Quiz 1" "mod_quiz > Edit" page
124
 
125
    # Confirm the starting point.
126
    Then I should see "Question A" on quiz page "1"
127
    And I should see "Question B" on quiz page "1"
128
    And I should see "Question C" on quiz page "2"
129
    And I should see "Total of marks: 3.00"
130
    And I should see "Questions: 3"
131
    And I should see "This quiz is open"
132
 
133
    # Delete all questions in page. Page contains multiple questions
134
    When I click on "Select multiple items" "button"
135
    Then I press "Select all"
136
    And I click on "Delete selected" "button"
137
    And I click on "Yes" "button" in the "Confirm" "dialogue"
138
 
139
    Then I should not see "Question A" on quiz page "1"
140
    And I should not see "Question B" on quiz page "1"
141
    And I should not see "Question C" on quiz page "2"
142
    And I should see "Total of marks: 0.00"
143
    And I should see "Questions: 0"
144
 
145
  @javascript
146
  Scenario: Deselect all questions by checking deselect all.
147
    Given the following "questions" exist:
148
      | questioncategory | qtype     | name       | questiontext        |
149
      | Test questions   | truefalse | Question A | This is question 01 |
150
      | Test questions   | truefalse | Question B | This is question 02 |
151
      | Test questions   | truefalse | Question C | This is question 03 |
152
    And quiz "Quiz 1" contains the following questions:
153
      | question   | page |
154
      | Question A | 1    |
155
      | Question B | 1    |
156
      | Question C | 2    |
157
    And I am on the "Quiz 1" "mod_quiz > Edit" page
158
 
159
  # Confirm the starting point.
160
    Then I should see "Question A" on quiz page "1"
161
    And I should see "Question B" on quiz page "1"
162
    And I should see "Question C" on quiz page "2"
163
 
164
  # Delete last question in last page. Page contains multiple questions
165
    When I click on "Select multiple items" "button"
166
    And I press "Select all"
167
    Then the field "selectquestion-3" matches value "1"
168
 
169
    When I press "Deselect all"
170
    Then the field "selectquestion-3" matches value "0"
171
 
172
  @javascript
173
  Scenario: Delete multiple questions from sections
174
    Given the following "questions" exist:
175
      | questioncategory | qtype       | name       | questiontext    |
176
      | Test questions   | truefalse   | Question A | First question  |
177
      | Test questions   | truefalse   | Question B | Second question |
178
      | Test questions   | truefalse   | Question C | Third question  |
179
      | Test questions   | truefalse   | Question D | Fourth question |
180
      | Test questions   | truefalse   | Question E | Fifth question  |
181
      | Test questions   | truefalse   | Question F | Sixth question  |
182
    And quiz "Quiz 1" contains the following questions:
183
      | question   | page |
184
      | Question A | 1    |
185
      | Question B | 2    |
186
      | Question C | 3    |
187
      | Question D | 4    |
188
      | Question E | 5    |
189
      | Question F | 6    |
190
    And quiz "Quiz 1" contains the following sections:
191
      | heading   | firstslot | shuffle |
192
      | Section 1 | 1         | 0       |
193
      | Section 2 | 2         | 0       |
194
      | Section 3 | 4         | 0       |
195
    And I am on the "Quiz 1" "mod_quiz > Edit" page
196
 
197
    When I click on "Select multiple items" "button"
198
    And I click on "selectquestion-3" "checkbox"
199
    And I click on "selectquestion-5" "checkbox"
200
    And I click on "selectquestion-6" "checkbox"
201
    And I click on "Delete selected" "button"
202
    And I click on "Yes" "button" in the "Confirm" "dialogue"
203
 
204
    Then I should see "Question A" on quiz page "1"
205
    And I should see "Question B" on quiz page "2"
206
    And I should see "Question D" on quiz page "3"
207
    And I should not see "Question C"
208
    And I should not see "Question E"
209
    And I should not see "Question F"
210
 
211
  @javascript
212
  Scenario: Attempting to delete all questions of a sections
213
    Given the following "questions" exist:
214
      | questioncategory | qtype       | name       | questiontext    |
215
      | Test questions   | truefalse   | Question A | First question  |
216
      | Test questions   | truefalse   | Question B | Second question |
217
      | Test questions   | truefalse   | Question C | Third question  |
218
      | Test questions   | truefalse   | Question D | Fourth question |
219
      | Test questions   | truefalse   | Question E | Fifth question  |
220
      | Test questions   | truefalse   | Question F | Sixth question  |
221
    And quiz "Quiz 1" contains the following questions:
222
      | question   | page |
223
      | Question A | 1    |
224
      | Question B | 2    |
225
      | Question C | 3    |
226
      | Question D | 4    |
227
      | Question E | 5    |
228
      | Question F | 6    |
229
    And quiz "Quiz 1" contains the following sections:
230
      | heading   | firstslot | shuffle |
231
      | Section 1 | 1         | 0       |
232
      | Section 2 | 2         | 0       |
233
      | Section 3 | 4         | 0       |
234
    And I am on the "Quiz 1" "mod_quiz > Edit" page
235
 
236
    When I click on "Select multiple items" "button"
237
    And I click on "selectquestion-2" "checkbox"
238
    And I click on "selectquestion-3" "checkbox"
239
    And I click on "Delete selected" "button"
240
 
241
    Then I should see "Cannot remove questions"
242
 
243
  @javascript
244
  Scenario: Delete multiple random questions from sections.
245
    Given the following "questions" exist:
246
      | questioncategory | qtype     | name       | questiontext    |
247
      | Test questions   | truefalse | Question A | First question  |
248
      | Test questions   | truefalse | Question B | Second question |
249
      | Test questions   | truefalse | Question C | Third question  |
250
      | Test questions   | truefalse | Question D | Fourth question |
251
      | Test questions   | truefalse | Question E | Fifth question  |
252
      | Test questions   | truefalse | Question F | Sixth question  |
253
    And I am on the "Quiz 1" "mod_quiz > Edit" page
254
 
255
    When I open the "last" add to quiz menu
256
    And I follow "a random question"
257
    And I set the field "Number of random questions" to "3"
258
    And I press "Add random question"
259
    And I click on "Select multiple items" "button"
260
    And I click on "selectquestion-1" "checkbox"
261
    And I click on "selectquestion-2" "checkbox"
262
    And I click on "Delete selected" "button"
263
    And I click on "Yes" "button" in the "Confirm" "dialogue"
264
    Then I should see "Random question based on filter condition" on quiz page "1"
265
    And I should not see "Random question based on filter condition" on quiz page "2"
266
    And I should not see "Random question based on filter condition" on quiz page "3"
267
    And I should see "Total of marks: 1.00"
268
    And I should see "Questions: 1"
269
 
270
  @javascript
271
  Scenario: Delete all random questions by checking select all.
272
    Given the following "questions" exist:
273
      | questioncategory | qtype     | name       | questiontext    |
274
      | Test questions   | truefalse | Question A | First question  |
275
      | Test questions   | truefalse | Question B | Second question |
276
      | Test questions   | truefalse | Question C | Third question  |
277
      | Test questions   | truefalse | Question D | Fourth question |
278
      | Test questions   | truefalse | Question E | Fifth question  |
279
      | Test questions   | truefalse | Question F | Sixth question  |
280
    And I am on the "Quiz 1" "mod_quiz > Edit" page
281
 
282
    # Delete all questions in page. Page contains multiple questions.
283
    When I open the "last" add to quiz menu
284
    And I follow "a random question"
285
    And I set the field "Number of random questions" to "3"
286
    And I press "Add random question"
287
    And I click on "Select multiple items" "button"
288
    And I press "Select all"
289
    And I click on "Delete selected" "button"
290
    And I click on "Yes" "button" in the "Confirm" "dialogue"
291
    Then I should not see "Random question based on filter condition" on quiz page "1"
292
    And I should not see "Random question based on filter condition" on quiz page "2"
293
    And I should not see "Random question based on filter condition" on quiz page "3"
294
    And I should see "Total of marks: 0.00"
295
    And I should see "Questions: 0"