Proyectos de Subversion Moodle

Rev

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

Rev 11 Rev 1441
Línea 13... Línea 13...
13
      | Course 1 | C1        |
13
      | Course 1 | C1        |
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 random question form | C1     | quiz1    |
19
      | quiz       | Quiz 1  | Quiz 1 for testing the Add random question form | C1     | quiz1    |
-
 
20
      | qbank      | Qbank 1 | Question bank 1 for testing the Add menu        | C1     | qbank1   |
20
    And the following "question categories" exist:
21
    And the following "question categories" exist:
21
      | contextlevel | reference | name                 |
22
      | contextlevel    | reference    | name                 |
22
      | Course       | C1        | Questions Category 1 |
23
      | Activity module | quiz1        | Questions Category 1 |
23
      | Course       | C1        | Questions Category 2 |
24
      | Activity module | quiz1        | Questions Category 2 |
-
 
25
      | Activity module | qbank1       | Qbank questions      |
24
    And the following "question categories" exist:
26
    And the following "question categories" exist:
25
      | contextlevel | reference | name        | questioncategory     |
27
      | contextlevel    | reference | name        | questioncategory     |
26
      | Course       | C1        | Subcategory | Questions Category 1 |
28
      | Activity module | quiz1     | Subcategory | Questions Category 1 |
27
    And the following "questions" exist:
29
    And the following "questions" exist:
28
      | questioncategory     | qtype | name                | user     | questiontext    |
30
      | questioncategory     | qtype | name                | user     | questiontext    |
29
      | Questions Category 1 | essay | question 1 name     | admin    | Question 1 text |
31
      | Questions Category 1 | essay | question 1 name     | admin    | Question 1 text |
30
      | Questions Category 1 | essay | question 2 name     | teacher1 | Question 2 text |
32
      | Questions Category 1 | essay | question 2 name     | teacher1 | Question 2 text |
31
      | Subcategory          | essay | question 3 name     | teacher1 | Question 3 text |
33
      | Subcategory          | essay | question 3 name     | teacher1 | Question 3 text |
32
      | Subcategory          | essay | question 4 name     | teacher1 | Question 4 text |
34
      | Subcategory          | essay | question 4 name     | teacher1 | Question 4 text |
33
      | Questions Category 1 | essay | "listen" & "answer" | teacher1 | Question 5 text |
35
      | Questions Category 1 | essay | "listen" & "answer" | teacher1 | Question 5 text |
-
 
36
      | Qbank questions      | essay | Qbank question 1    | teacher1 | Qbank question  |
34
    And the following "core_question > Tags" exist:
37
    And the following "core_question > Tags" exist:
35
      | question            | tag |
38
      | question            | tag      |
36
      | question 1 name     | foo |
39
      | question 1 name     | foo      |
37
      | question 2 name     | bar |
40
      | question 2 name     | bar      |
38
      | question 3 name     | foo |
41
      | question 3 name     | foo      |
39
      | question 4 name     | bar |
42
      | question 4 name     | bar      |
40
      | "listen" & "answer" | foo |
43
      | "listen" & "answer" | foo      |
-
 
44
      | Qbank question 1    | qbanktag |
Línea 41... Línea 45...
41
 
45
 
42
  Scenario: Available tags are shown in the autocomplete tag field
46
  Scenario: Available tags are shown in the autocomplete tag field
43
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
47
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
44
    When I open the "last" add to quiz menu
48
    When I open the "last" add to quiz menu
Línea 51... Línea 55...
51
 
55
 
52
  Scenario: Questions can be filtered by tags
56
  Scenario: Questions can be filtered by tags
53
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
57
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
54
    When I open the "last" add to quiz menu
58
    When I open the "last" add to quiz menu
-
 
59
    And I follow "a random question"
55
    And I follow "a random question"
60
    And I apply question bank filter "Category" with value "Questions Category 1"
56
    And I apply question bank filter "Tag" with value "foo"
61
    And I apply question bank filter "Tag" with value "foo"
57
    And I wait until the page is ready
62
    And I wait until the page is ready
58
    And I should see "question 1 name"
63
    And I should see "question 1 name"
59
    And I should see "\"listen\" & \"answer\""
64
    And I should see "\"listen\" & \"answer\""
Línea 68... Línea 73...
68
    And I should see "question 3 name"
73
    And I should see "question 3 name"
69
    And I should see "\"listen\" & \"answer\""
74
    And I should see "\"listen\" & \"answer\""
70
    And I should not see "question 2 name"
75
    And I should not see "question 2 name"
71
    And I should not see "question 4 name"
76
    And I should not see "question 4 name"
Línea 72... Línea 77...
72
 
77
 
73
  Scenario: A random question can be added to the quiz
78
  Scenario: Questions can be filtered by tags on a shared question bank
74
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
79
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
75
    When I open the "last" add to quiz menu
80
    When I open the "last" add to quiz menu
-
 
81
    And I follow "a random question"
-
 
82
    Then I click on "Switch bank" "button"
-
 
83
    And I click on "Qbank 1" "link" in the "Select question bank" "dialogue"
-
 
84
    And I apply question bank filter "Category" with value "Qbank questions"
-
 
85
    And I apply question bank filter "Tag" with value "qbanktag"
-
 
86
    And I click on "Apply filters" "button"
-
 
87
    And I wait until the page is ready
-
 
88
    And I should see "Qbank question 1"
-
 
89
    And I should not see "question 3 name"
-
 
90
    And I should not see "question 2 name"
-
 
91
    And I should not see "question 4 name"
-
 
92
 
-
 
93
  Scenario: A random question can be added to the quiz
-
 
94
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
-
 
95
    And I open the "last" add to quiz menu
-
 
96
    And I follow "a random question"
76
    And I follow "a random question"
97
    And I apply question bank filter "Category" with value "Questions Category 1"
77
    And I apply question bank filter "Tag" with value "foo"
98
    And I apply question bank filter "Tag" with value "foo"
78
    And I select "1" from the "randomcount" singleselect
99
    And I select "1" from the "randomcount" singleselect
79
    And I press "Add random question"
100
    And I press "Add random question"
80
    And I should see "Random question based on filter condition with tags: foo" on quiz page "1"
101
    And I should see "Random (Questions Category 1) based on filter condition with tags: foo" on quiz page "1"
81
    When I click on "Configure question" "link" in the "Random question based on filter condition with tags: foo" "list_item"
102
    When I click on "Configure question" "link" in the "Random (Questions Category 1) based on filter condition with tags: foo" "list_item"
82
    Then I should see "Questions Category 1"
103
    Then I should see "Questions Category 1"
83
    And I should see "foo"
104
    And I should see "foo"
84
    And I should see "question 1 name"
105
    And I should see "question 1 name"
-
 
106
    And I should see "\"listen\" & \"answer\""
-
 
107
    And I click on "Cancel" "button" in the "Editing a random question" "dialogue"
-
 
108
    # Include subcategories.
-
 
109
    And I navigate to "Questions" in current page administration
-
 
110
    And I open the "Page 1" add to quiz menu
-
 
111
    And I follow "a random question"
-
 
112
    And I apply question bank filter "Category" with value "Questions Category 1"
-
 
113
    And I set the field "Also show questions from subcategories" to "1"
-
 
114
    And I click on "Apply filters" "button"
-
 
115
    And I apply question bank filter "Tag" with value "foo"
-
 
116
    And I select "1" from the "randomcount" singleselect
-
 
117
    And I press "Add random question"
-
 
118
    And I should see "Random (Questions Category 1 and subcategories) based on filter condition with tags: foo" on quiz page "1"
-
 
119
    And I click on "Configure question" "link" in the "Random (Questions Category 1 and subcategories) based on filter condition with tags: foo" "list_item"
-
 
120
    And I should see "Questions Category 1"
-
 
121
    And I should see "foo"
-
 
122
    And I should see "question 1 name"
-
 
123
    And I should see "\"listen\" & \"answer\""
-
 
124
    And I should see "question 3 name"
-
 
125
 
-
 
126
  Scenario: A random question from the quiz's top category can be added to the quiz
-
 
127
    Given the following "question categories" exist:
-
 
128
      | contextlevel    | reference  | name            |
-
 
129
      | Activity module | quiz1      | Quiz 1 category |
-
 
130
    And the following "questions" exist:
-
 
131
      | questioncategory | qtype | name                   | user     | questiontext           |
-
 
132
      | Quiz 1 category  | essay | quiz 1 question 1 name | teacher1 | Quiz 1 question 1 text |
-
 
133
      | Quiz 1 category  | essay | quiz 1 question 2 name | teacher1 | Quiz 1 question 2 text |
-
 
134
    And the following "core_question > Tags" exist:
-
 
135
      | question               | tag |
-
 
136
      | quiz 1 question 1 name | foo |
-
 
137
    And I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
-
 
138
    And I open the "last" add to quiz menu
-
 
139
    And I follow "a random question"
-
 
140
    And I apply question bank filter "Category" with value "Top for Quiz 1"
-
 
141
    And I set the field "Also show questions from subcategories" to "1"
-
 
142
    And I click on "Apply filters" "button"
-
 
143
    And I apply question bank filter "Tag" with value "foo"
-
 
144
    And I select "1" from the "randomcount" singleselect
-
 
145
    When I press "Add random question"
-
 
146
    Then I should see "Random (Any category of this quiz) based on filter condition with tags: foo" on quiz page "1"
-
 
147
    And I click on "Configure question" "link" in the "Random (Any category of this quiz) based on filter condition with tags: foo" "list_item"
-
 
148
    And I should see "Top for Quiz 1"
-
 
149
    And I should see "foo"
-
 
150
    And I should see "quiz 1 question 1 name"
-
 
151
    And I should not see "quiz 1 question 2 name"
-
 
152
 
-
 
153
  Scenario: A random question from a top category, excluding subcategories, shows an indicator of being faulty
-
 
154
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
-
 
155
    And I open the "last" add to quiz menu
-
 
156
    And I follow "a random question"
-
 
157
    And I apply question bank filter "Category" with value "Top for Quiz 1"
-
 
158
    And I set the field "Also show questions from subcategories" to "0"
-
 
159
    And I click on "Apply filters" "button"
-
 
160
    And I apply question bank filter "Tag" with value "foo"
-
 
161
    And I select "1" from the "randomcount" singleselect
-
 
162
    When I press "Add random question"
Línea 85... Línea 163...
85
    And I should see "\"listen\" & \"answer\""
163
    Then I should see "Random (Faulty question) based on filter condition" on quiz page "1"
86
 
164
 
87
  Scenario: After closing and reopening the modal, it still works
165
  Scenario: After closing and reopening the modal, it still works
88
    When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as teacher1
166
    When I am on the "Quiz 1" "mod_quiz > Edit" page logged in as teacher1
Línea 94... Línea 172...
94
    And I should not see "question 3 name"
172
    And I should not see "question 3 name"
95
    And I set the field "Category" to "Subcategory"
173
    And I set the field "Category" to "Subcategory"
96
    And I press "Apply filters"
174
    And I press "Apply filters"
97
    Then I should see "question 3 name"
175
    Then I should see "question 3 name"
Línea -... Línea 176...
-
 
176
 
-
 
177
  Scenario: A random question can be added to the quiz from a shared question bank
-
 
178
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
-
 
179
    And I open the "last" add to quiz menu
-
 
180
    And I follow "a random question"
-
 
181
    And I should see "Current bank: Quiz 1"
-
 
182
    And I apply question bank filter "Category" with value "Questions Category 1"
-
 
183
    And I should see "question 1 name"
-
 
184
    And I click on "Switch bank" "button"
-
 
185
    And I click on "Qbank 1" "link" in the "Select question bank" "dialogue"
-
 
186
    And I should see "Current bank: Qbank 1"
-
 
187
    And I should not see "question 1 name"
-
 
188
    And I apply question bank filter "Category" with value "Qbank questions"
-
 
189
    And I should see "Qbank question 1"
-
 
190
    When I apply question bank filter "Tag" with value "qbanktag"
-
 
191
    And I select "1" from the "randomcount" singleselect
-
 
192
    And I press "Add random question"
-
 
193
    Then I should see "Random (Qbank questions) based on filter condition with tags: qbanktag" on quiz page "1"
-
 
194
    And I click on "Configure question" "link" in the "Random (Qbank questions) based on filter condition with tags: qbank" "list_item"
-
 
195
    And I should see "Qbank questions"
-
 
196
    And I should see "qbanktag"
-
 
197
    And I should see "Qbank question 1"
98
 
198
 
99
  Scenario: Teacher without moodle/question:useall should not see the add a random question menu item
199
  Scenario: Teacher without moodle/question:useall should not see the add a random question menu item
100
    Given the following "permission overrides" exist:
200
    Given the following "permission overrides" exist:
101
      | capability             | permission | role           | contextlevel | reference |
201
      | capability             | permission | role           | contextlevel | reference |
102
      | moodle/question:useall | Prevent    | editingteacher | Course       | C1        |
202
      | moodle/question:useall | Prevent    | editingteacher | Course       | C1        |
Línea 111... Línea 211...
111
    And I follow "a random question"
211
    And I follow "a random question"
112
    And I follow "New category"
212
    And I follow "New category"
113
    And "Help with Parent category" "icon" should exist in the "Random question using a new category" "fieldset"
213
    And "Help with Parent category" "icon" should exist in the "Random question using a new category" "fieldset"
114
    And I set the following fields to these values:
214
    And I set the following fields to these values:
115
      | Name            | New Random category |
215
      | Name            | New Random category |
116
      | Parent category |  Default for Quiz 1 |
216
      | Parent category | Questions Category 1 |
117
    And I press "Create category and add random question"
217
    And I press "Create category and add random question"
118
    And I should see "Random question based on filter condition" on quiz page "1"
218
    And I should see "Random (New Random category) based on filter condition" on quiz page "1"
119
    And I click on "Configure question" "link" in the "Random question based on filter condition" "list_item"
219
    And I click on "Configure question" "link" in the "Random (New Random category) based on filter condition" "list_item"
120
    Then I should see "New Random category"
220
    Then I should see "New Random category"
-
 
221
 
-
 
222
  Scenario: See questions link applies all random question filters
-
 
223
    Given I am on the "Quiz 1" "mod_quiz > Edit" page logged in as "teacher1"
-
 
224
    And I open the "last" add to quiz menu
-
 
225
    And I follow "a random question"
-
 
226
    And I apply question bank filter "Category" with value "Questions Category 1"
-
 
227
    And I apply question bank filter "Tag" with value "foo"
-
 
228
    And I select "1" from the "randomcount" singleselect
-
 
229
    And I press "Add random question"
-
 
230
    And I should see "Random (Questions Category 1) based on filter condition with tags: foo" on quiz page "1"
-
 
231
    And I click on "Configure question" "link" in the "Random (Questions Category 1) based on filter condition with tags: foo" "list_item"
-
 
232
    And I should see "Questions Category 1"
-
 
233
    And I should see "foo"
-
 
234
    And I should see "question 1 name"
-
 
235
    And I should see "\"listen\" & \"answer\""
-
 
236
    And I should not see "bar"
-
 
237
    And I should not see "question 2 name"
-
 
238
    When I am on the "Quiz 1" "mod_quiz > Edit" page
-
 
239
    And I click on "(See questions)" "link" in the "Random (Questions Category 1) based on filter condition with tags: foo" "list_item"
-
 
240
    Then I should see "Questions Category 1"
-
 
241
    And I should see "foo"
-
 
242
    And I should see "question 1 name"
-
 
243
    And I should see "\"listen\" & \"answer\""
-
 
244
    And I should not see "bar"
-
 
245
    And I should not see "question 2 name"