Proyectos de Subversion Moodle

Rev

Rev 11 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 11 Rev 1441
Línea 7... Línea 7...
7
  Background:
7
  Background:
8
    Given the following "users" exist:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email |
9
      | username | firstname | lastname | email |
10
      | teacher1 | Teacher | 1 | teacher1@example.com |
10
      | teacher1 | Teacher | 1 | teacher1@example.com |
11
    And the following "courses" exist:
11
    And the following "courses" exist:
12
      | fullname | shortname | format |
12
      | fullname                                                                                                                | shortname | format |
13
      | Course 1 | C1 | weeks |
13
      | <span lang="en" class="multilang">Test course</span><span lang="fr" class="multilang">Cours test</span> & < > " ' &amp; | C1        | weeks  |
14
    And the following "course enrolments" exist:
14
    And the following "course enrolments" exist:
15
      | user | course | role |
15
      | user | course | role |
16
      | teacher1 | C1 | editingteacher |
16
      | teacher1 | C1 | editingteacher |
17
    And the following "activities" exist:
17
    And the following "activities" exist:
18
      | activity   | name   | intro                           | course | idnumber |
18
      | activity | name                                                                                                             | intro                                    | course | idnumber |
19
      | quiz       | Quiz 1 | Quiz 1 for testing the Add menu | C1     | quiz1    |
19
      | quiz     | Quiz 1                                                                                                           | Quiz 1 for testing the Add menu          | C1     | quiz1    |
-
 
20
      | qbank    | <span lang="en" class="multilang">Qbank</span><span lang="fr" class="multilang">Banqueq</span> 1 & < > " ' &amp; | Question bank 1 for testing the Add menu | C1     | qbank1   |
-
 
21
      | qbank    | Question Bank A                                                                                                  | Question Bank A for testing qbank name   | C1     | qbankA   |
-
 
22
      | qbank    | Question Bank B                                                                                                  | Question Bank B for testing qbank name   | C1     | qbankB   |
20
    And the following "question categories" exist:
23
    And the following "question categories" exist:
21
      | contextlevel | reference | name           |
24
      | contextlevel    | reference  | name              |
22
      | Course       | C1        | Test questions |
25
      | Activity module | quiz1      | Test questions    |
-
 
26
      | Activity module | qbank1     | Qbank questions   |
-
 
27
      | Activity module | qbankA     | Qbank Questions 1 |
-
 
28
      | Activity module | qbankB     | Qbank Questions 2 |
23
    And the following "questions" exist:
29
    And the following "questions" exist:
24
      | questioncategory | qtype     | name             | user     | questiontext     | idnumber |
30
      | questioncategory  | qtype     | name             | user     | questiontext     | idnumber |
25
      | Test questions   | essay     | question 01 name | admin    | Question 01 text |          |
31
      | Test questions    | essay     | question 01 name | admin    | Question 01 text |          |
26
      | Test questions   | essay     | question 02 name | teacher1 | Question 02 text | qidnum   |
32
      | Test questions    | essay     | question 02 name | teacher1 | Question 02 text | qidnum   |
-
 
33
      | Qbank questions   | essay     | question 03 name | teacher1 | Question 03 text | q3idnum  |
-
 
34
      | Qbank questions   | essay     | question 04 name | teacher1 | Question 04 text | q4idnum  |
-
 
35
      | Qbank Questions 1 | truefalse | TF1              | admin    | Qbank 1 question |          |
-
 
36
      | Qbank Questions 2 | truefalse | TF2              | admin    | Qbank 2 question |          |
Línea 27... Línea 37...
27
 
37
 
28
  Scenario: The questions can be filtered by tag
38
  Scenario: The questions can be filtered by tag
29
    Given I am on the "question 01 name" "core_question > edit" page logged in as teacher1
39
    Given I am on the "question 01 name" "core_question > edit" page logged in as teacher1
30
    And I set the following fields to these values:
40
    And I set the following fields to these values:
Línea 35... Línea 45...
35
      | Tags | bar |
45
      | Tags | bar |
36
    And I press "id_submitbutton"
46
    And I press "id_submitbutton"
37
    When I am on the "Quiz 1" "mod_quiz > Edit" page
47
    When I am on the "Quiz 1" "mod_quiz > Edit" page
38
    And I open the "last" add to quiz menu
48
    And I open the "last" add to quiz menu
39
    And I follow "from question bank"
49
    And I follow "from question bank"
-
 
50
    And I apply question bank filter "Category" with value "Test questions"
40
    Then I should see "foo" in the "question 01 name" "table_row"
51
    Then I should see "foo" in the "question 01 name" "table_row"
41
    And I should see "bar" in the "question 02 name" "table_row"
52
    And I should see "bar" in the "question 02 name" "table_row"
42
    And I should see "qidnum" in the "question 02 name" "table_row"
53
    And I should see "qidnum" in the "question 02 name" "table_row"
43
    When I apply question bank filter "Tag" with value "foo"
54
    When I apply question bank filter "Tag" with value "foo"
44
    And I should see "question 01 name" in the "categoryquestions" "table"
55
    And I should see "question 01 name" in the "categoryquestions" "table"
45
    And I should not see "question 02 name" in the "categoryquestions" "table"
56
    And I should not see "question 02 name" in the "categoryquestions" "table"
Línea -... Línea 57...
-
 
57
 
-
 
58
  Scenario: The questions can be filtered by tag on a shared question bank
-
 
59
    Given the "multilang" filter is "on"
-
 
60
    And the "multilang" filter applies to "content and headings"
-
 
61
    And I am on the "question 03 name" "core_question > edit" page logged in as teacher1
-
 
62
    And I set the following fields to these values:
-
 
63
      | Tags | qbanktag1 |
-
 
64
    And I press "Save changes"
-
 
65
    And I am on the "question 04 name" "core_question > edit" page logged in as teacher1
-
 
66
    And I set the following fields to these values:
-
 
67
      | Tags | qbanktag2 |
-
 
68
    And I press "Save changes"
-
 
69
    When I am on the "Quiz 1" "mod_quiz > Edit" page
-
 
70
    And I open the "last" add to quiz menu
-
 
71
    And I follow "from question bank"
-
 
72
    And I click on "Switch bank" "button"
-
 
73
    And I click on "Qbank 1 & < > \" ' &amp;" "link" in the "Select question bank" "dialogue"
-
 
74
    And I apply question bank filter "Category" with value "Qbank questions"
-
 
75
    Then I should see "qbanktag1" in the "question 03 name" "table_row"
-
 
76
    And I should see "qbanktag2" in the "question 04 name" "table_row"
-
 
77
    And I apply question bank filter "Tag" with value "qbanktag1"
-
 
78
    And I should see "question 03 name" in the "categoryquestions" "table"
-
 
79
    And I should not see "question 04 name" in the "categoryquestions" "table"
46
 
80
 
47
  Scenario: The question modal can be paginated
81
  Scenario: The question modal can be paginated
48
    Given the following "question categories" exist:
82
    Given the following "question categories" exist:
49
      | contextlevel | reference | name           |
83
      | contextlevel    | reference | name           |
50
      | Course       | C1        | My collection  |
84
      | Activity module | quiz1    | My collection  |
51
    And 45 "questions" exist with the following data:
85
    And 45 "questions" exist with the following data:
52
      | questioncategory | My collection             |
86
      | questioncategory | My collection             |
53
      | qtype            | essay                     |
87
      | qtype            | essay                     |
54
      | name             | Feature question [count]  |
88
      | name             | Feature question [count]  |
Línea 57... Línea 91...
57
    # Sadly, the above step generates questions which sort like FQ1, FQ11, FQ12, ..., FQ19, FQ2, FQ20, ...
91
    # Sadly, the above step generates questions which sort like FQ1, FQ11, FQ12, ..., FQ19, FQ2, FQ20, ...
58
    # so the expected paging behaviour is not immediately intuitive with 20 questions per page.
92
    # so the expected paging behaviour is not immediately intuitive with 20 questions per page.
59
    When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as teacher1
93
    When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as teacher1
60
    And I open the "last" add to quiz menu
94
    And I open the "last" add to quiz menu
61
    And I follow "from question bank"
95
    And I follow "from question bank"
-
 
96
    And I apply question bank filter "Category" with value "Test questions"
62
    And I should see "question 01 name" in the "categoryquestions" "table"
97
    And I should see "question 01 name" in the "categoryquestions" "table"
63
    And I should see "question 02 name" in the "categoryquestions" "table"
98
    And I should see "question 02 name" in the "categoryquestions" "table"
64
    And I should not see "Feature question" in the "categoryquestions" "table"
99
    And I should not see "Feature question" in the "categoryquestions" "table"
65
    And I set the field "Category" to "My collection"
100
    And I set the field "Category" to "My collection"
66
    And I press "Apply filters"
101
    And I press "Apply filters"
Línea 81... Línea 116...
81
    And I should see "Feature question 5"
116
    And I should see "Feature question 5"
82
    And I should see "Feature question 9"
117
    And I should see "Feature question 9"
Línea 83... Línea 118...
83
 
118
 
84
  Scenario: After closing and reopening the modal, it still works
119
  Scenario: After closing and reopening the modal, it still works
85
    Given the following "question categories" exist:
120
    Given the following "question categories" exist:
86
      | contextlevel | reference | name           |
121
      | contextlevel    | reference | name           |
87
      | Course       | C1        | My collection  |
122
      | Activity module | quiz1     | My collection  |
88
    And the following "question" exists:
123
    And the following "question" exists:
89
      | questioncategory | My collection     |
124
      | questioncategory | My collection     |
90
      | qtype            | essay             |
125
      | qtype            | essay             |
91
      | name             | Feature question  |
126
      | name             | Feature question  |
Línea 115... Línea 150...
115
      | Section 2 | 2         | 0       |
150
      | Section 2 | 2         | 0       |
116
    And I log in as "teacher1"
151
    And I log in as "teacher1"
117
    And I am on the "Quiz 1" "mod_quiz > Edit" page
152
    And I am on the "Quiz 1" "mod_quiz > Edit" page
118
    When I open the "Page 1" add to quiz menu
153
    When I open the "Page 1" add to quiz menu
119
    And I follow "from question bank"
154
    And I follow "from question bank"
-
 
155
    And I apply question bank filter "Category" with value "Test questions"
120
    And I set the field with xpath "//tr[contains(normalize-space(.), 'question 03 name')]//input[@type='checkbox']" to "1"
156
    And I set the field with xpath "//tr[contains(normalize-space(.), 'question 03 name')]//input[@type='checkbox']" to "1"
121
    And I click on "Add selected questions to the quiz" "button"
157
    And I click on "Add selected questions to the quiz" "button"
122
    Then I should see "question 03 name" on quiz page "1"
158
    Then I should see "question 03 name" on quiz page "1"
123
    And I should see "question 01 name" before "question 03 name" on the edit quiz page
159
    And I should see "question 01 name" before "question 03 name" on the edit quiz page
Línea 124... Línea 160...
124
 
160
 
125
  Scenario: Add several selected questions from the question bank
161
  Scenario: Add several selected questions from the question bank
126
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
162
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
127
    When I open the "last" add to quiz menu
163
    When I open the "last" add to quiz menu
-
 
164
    And I follow "from question bank"
128
    And I follow "from question bank"
165
    And I apply question bank filter "Category" with value "Test questions"
129
    And I set the field with xpath "//input[@type='checkbox' and @id='qbheadercheckbox']" to "1"
166
    And I set the field with xpath "//input[@type='checkbox' and @id='qbheadercheckbox']" to "1"
130
    And I press "Add selected questions to the quiz"
167
    And I press "Add selected questions to the quiz"
131
    Then I should see "question 01 name" on quiz page "1"
168
    Then I should see "question 01 name" on quiz page "1"
Línea -... Línea 169...
-
 
169
    And I should see "question 02 name" on quiz page "2"
-
 
170
 
-
 
171
  Scenario: Adding a question to quiz from a shared question bank
-
 
172
    Given the "multilang" filter is "on"
-
 
173
    And the "multilang" filter applies to "content and headings"
-
 
174
    And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
-
 
175
    When I open the "last" add to quiz menu
-
 
176
    And I follow "from question bank"
-
 
177
    Then I should see "Current bank: Quiz 1"
-
 
178
    And I apply question bank filter "Category" with value "Test questions"
-
 
179
    And I should see "question 01 name"
-
 
180
    And I click on "Switch bank" "button"
-
 
181
    And I click on "Qbank 1 & < > \" ' &amp;" "link" in the "Select question bank" "dialogue"
-
 
182
    And I apply question bank filter "Category" with value "Qbank questions"
-
 
183
    And I should see "question 03 name"
-
 
184
    But I should not see "question 01 name"
-
 
185
    And I click on "Select" "checkbox" in the "question 03 name" "table_row"
-
 
186
    And I click on "Add selected questions to the quiz" "button"
-
 
187
    And I should see "question 03 name"
132
    And I should see "question 02 name" on quiz page "2"
188
    And "Qbank 1 & < > " "text" should appear after "question 03 name" "text"
133
 
189
 
134
  @javascript
190
  @javascript
135
  Scenario: Validate the sorting while adding questions from question bank
191
  Scenario: Validate the sorting while adding questions from question bank
136
    Given the following "questions" exist:
192
    Given the following "questions" exist:
137
      | questioncategory | qtype       | name              | questiontext          |
193
      | questioncategory | qtype       | name              | questiontext          |
138
      | Test questions   | multichoice | question 03 name  | question 03 name text |
194
      | Test questions   | multichoice | question 03 name  | question 03 name text |
139
    And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
195
    And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
-
 
196
    When I open the "last" add to quiz menu
140
    When I open the "last" add to quiz menu
197
    And I follow "from question bank"
141
    And I follow "from question bank"
198
    And I apply question bank filter "Category" with value "Test questions"
142
    And I click on "Sort by Question ascending" "link"
199
    And I click on "Sort by Question ascending" "link"
143
    Then "question 01 name" "text" should appear before "question 02 name" "text"
200
    Then "question 01 name" "text" should appear before "question 02 name" "text"
144
    And I click on "Sort by Question descending" "link"
201
    And I click on "Sort by Question descending" "link"
Línea 155... Línea 212...
155
    And I log in as "teacher1"
212
    And I log in as "teacher1"
156
    And I am on the "Quiz 1" "mod_quiz > Edit" page
213
    And I am on the "Quiz 1" "mod_quiz > Edit" page
157
    When I set the field "Shuffle" to "1"
214
    When I set the field "Shuffle" to "1"
158
    And I open the "last" add to quiz menu
215
    And I open the "last" add to quiz menu
159
    And I follow "from question bank"
216
    And I follow "from question bank"
-
 
217
    And I apply question bank filter "Category" with value "Test questions"
160
    Then I should see "question 01 name"
218
    Then I should see "question 01 name"
-
 
219
 
-
 
220
  Scenario: Question bank names are displayed in quiz questions
-
 
221
    Given quiz "Quiz 1" contains the following questions:
-
 
222
      | question | page |
-
 
223
      | TF1      | 1    |
-
 
224
      | TF2      | 1    |
-
 
225
    When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as teacher1
-
 
226
    Then I should see "Question Bank A" in the "TF1" "list_item"
-
 
227
    And I should see "Question Bank B" in the "TF2" "list_item"
-
 
228
 
-
 
229
  Scenario: User doesn't see the option to switch to a bank they can't use
-
 
230
    Given the "multilang" filter is "on"
-
 
231
    And the "multilang" filter applies to "content and headings"
-
 
232
    And the following "users" exist:
-
 
233
      | username | firstname | lastname | email                |
-
 
234
      | teacher2 | Teacher   | 2        | teacher2@example.com |
-
 
235
    And the following "role" exists:
-
 
236
      | shortname               | noquestions          |
-
 
237
      | name                    | Cannot use questions |
-
 
238
      | moodle/question:usemine | prohibit             |
-
 
239
      | moodle/question:useall  | prohibit             |
-
 
240
    And the following "course enrolments" exist:
-
 
241
      | user     | course | role           |
-
 
242
      | teacher2 | C1     | editingteacher |
-
 
243
    And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher2"
-
 
244
    And I open the "last" add to quiz menu
-
 
245
    And I follow "from question bank"
-
 
246
    And I click on "Switch bank" "button"
-
 
247
    And I click on "Qbank 1 & < > \" ' &amp;" "link" in the "Select question bank" "dialogue"
-
 
248
    And I apply question bank filter "Category" with value "Qbank questions"
-
 
249
    And I click on "Select" "checkbox" in the "question 03 name" "table_row"
-
 
250
    And I click on "Add selected questions to the quiz" "button"
-
 
251
    When the following "role assigns" exist:
-
 
252
      | user     | role        | contextlevel    | reference |
-
 
253
      | teacher2 | noquestions | Activity module | qbank1    |
-
 
254
    And I open the "Page 1" add to quiz menu
-
 
255
    And I follow "from question bank"
-
 
256
    And I click on "Switch bank" "button"
-
 
257
    Then "Qbank 1 & < > \" ' &amp;" "link" should not exist in the "Select question bank" "dialogue"
-
 
258
 
-
 
259
  @javascript
-
 
260
  Scenario: Don't show the edit link if the user doesn't have permission
-
 
261
    Given the following "courses" exist:
-
 
262
      | fullname | shortname | category |
-
 
263
      | Course 2 | C2        | 0        |
-
 
264
    And the following "activities" exist:
-
 
265
      | activity   | name            | course | idnumber |
-
 
266
      | qbank      | Question Bank C | C2     | qbankC   |
-
 
267
    And the following "question categories" exist:
-
 
268
      | contextlevel    | reference | name              |
-
 
269
      | Activity module | qbankC    | Qbank Questions 3 |
-
 
270
    And the following "questions" exist:
-
 
271
      | questioncategory  | qtype     | name            | questiontext        |
-
 
272
      | Qbank Questions 3 | truefalse | Shared question | Answer the question |
-
 
273
    And quiz "Quiz 1" contains the following questions:
-
 
274
      | question        | page |
-
 
275
      | TF1             | 1    |
-
 
276
      | Shared question | 1    |
-
 
277
    When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as teacher1
-
 
278
    Then "TF1" "link" should exist
-
 
279
    And "Question Bank A" "link" should exist
-
 
280
    And "Shared question" "link" should not exist
-
 
281
    And "Question Bank C" "link" should not exist