Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 1... Línea 1...
1
@qbank @qbank_bulkmove
1
@qbank @qbank_bulkmove
2
Feature: Use the qbank plugin manager page for bulkmove
2
Feature: Use the qbank plugin manager page for bulkmove
3
  In order to check the plugin behaviour with enable and disable
3
  In order to check the plugin behaviour with enable and disable
Línea 4... Línea 4...
4
 
4
 
5
  Background:
5
  Background:
-
 
6
    Given the following "users" exist:
-
 
7
      | username | firstname | lastname | email                |
-
 
8
      | teacher1 | Teacher   | 1        | teacher1@example.com |
6
    Given the following "courses" exist:
9
    And the following "courses" exist:
7
      | fullname | shortname | category |
10
      | fullname | shortname | category |
-
 
11
      | Course 1 | C1        | 0        |
-
 
12
      | Course 2 | C2        | 0        |
-
 
13
      | Course 3 | C3        | 0        |
-
 
14
    And the following "course enrolments" exist:
-
 
15
      | user     | course | role           |
-
 
16
      | teacher1 | C1     | editingteacher |
-
 
17
      | teacher1 | C2     | editingteacher |
-
 
18
    And the following "course enrolments" exist:
-
 
19
      | user     | course | role           |
8
      | Course 1 | C1        | 0        |
20
      | teacher1 | C1     | editingteacher |
9
    And the following "activities" exist:
21
    And the following "activities" exist:
10
      | activity   | name      | course | idnumber |
22
      | activity    | name            | course | idnumber  |
-
 
23
      | quiz        | Test quiz       | C1     | quiz1     |
-
 
24
      | qbank       | Question bank 1 | C1     | qbank1    |
-
 
25
      | qbank       | Question bank 2 | C2     | qbank2    |
11
      | quiz       | Test quiz | C1     | quiz1    |
26
      | qbank       | Question bank 3 | C3     | qbank3    |
12
    And the following "question categories" exist:
27
    And the following "question categories" exist:
-
 
28
      | contextlevel    | reference  | name              |
-
 
29
      | Activity module | quiz1      | Test questions 1  |
-
 
30
      | Activity module | qbank1     | Test questions 2  |
-
 
31
      | Activity module | qbank2     | Test questions 3  |
-
 
32
      | Activity module | qbank3     | Test questions 4  |
-
 
33
      | Activity module | qbank1     | Test questions 5  |
13
      | contextlevel | reference | name           |
34
      | Activity module | quiz1      | Test questions 6  |
-
 
35
      | Course          | C1         | Test questions    |
14
      | Course         | C1     | Test questions |
36
      | Course          | C1         | Moved questions   |
15
    And the following "questions" exist:
37
    And the following "questions" exist:
16
      | questioncategory | qtype     | name           | questiontext              |
38
      | questioncategory   | qtype     | name            | questiontext               |
-
 
39
      | Test questions 1   | truefalse | First question  | Answer the first question  |
-
 
40
      | Test questions 2   | truefalse | Second question | Answer the second question |
-
 
41
      | Test questions 3   | truefalse | Third question  | Answer the third question  |
-
 
42
      | Test questions 4   | truefalse | Fourth question | Answer the fourth question |
-
 
43
      | Test questions 5   | truefalse | Fifth question  | Answer the fifth question  |
Línea 17... Línea 44...
17
      | Test questions   | truefalse | First question | Answer the first question |
44
      | Test questions 6   | truefalse | Sixth question  | Answer the sixth question  |
18
 
45
 
19
  @javascript
46
  @javascript
20
  Scenario: Enable/disable bulk move questions bulk action from the base view
47
  Scenario: Enable/disable bulk move questions bulk action from the base view
21
    Given I log in as "admin"
48
    Given I log in as "admin"
22
    When I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
49
    When I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
23
    And I should see "Bulk move questions"
50
    And I should see "Bulk move questions"
-
 
51
    And I click on "Disable" "link" in the "Bulk move questions" "table_row"
24
    And I click on "Disable" "link" in the "Bulk move questions" "table_row"
52
    And I am on the "Test quiz" "mod_quiz > question bank" page
25
    And I am on the "Test quiz" "mod_quiz > question bank" page
53
    And I apply question bank filter "Category" with value "Test questions 1"
26
    And I click on "First question" "checkbox"
54
    And I click on "First question" "checkbox"
27
    And I click on "With selected" "button"
55
    And I click on "With selected" "button"
28
    Then I should not see question bulk action "move"
56
    Then I should not see question bulk action "move"
29
    And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
57
    And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
-
 
58
    And I click on "Enable" "link" in the "Bulk move questions" "table_row"
30
    And I click on "Enable" "link" in the "Bulk move questions" "table_row"
59
    And I am on the "Test quiz" "mod_quiz > question bank" page
31
    And I am on the "Test quiz" "mod_quiz > question bank" page
60
    And I apply question bank filter "Category" with value "Test questions 1"
32
    And I click on "First question" "checkbox"
61
    And I click on "First question" "checkbox"
-
 
62
    And I click on "With selected" "button"
-
 
63
    And I should see question bulk action "move"
-
 
64
 
-
 
65
  @javascript
-
 
66
  Scenario: Selecting a shared question bank limits the available categories to those belonging to the selected bank.
-
 
67
    Given I log in as "teacher1"
-
 
68
    And I am on the "Test quiz" "mod_quiz > question bank" page
-
 
69
    And I apply question bank filter "Category" with value "Test questions 1"
-
 
70
    And I click on "First question" "checkbox"
-
 
71
    And I click on "With selected" "button"
-
 
72
    And I click on "move" "button"
-
 
73
    And I open the autocomplete suggestions list in the ".search-categories" "css_element"
-
 
74
    And "Test questions 1" "autocomplete_suggestions" should exist
-
 
75
    And "Test questions 2" "autocomplete_suggestions" should not exist
-
 
76
    And "Test questions 3" "autocomplete_suggestions" should not exist
-
 
77
    And "Test questions 4" "autocomplete_suggestions" should not exist
-
 
78
    And "Test questions 5" "autocomplete_suggestions" should not exist
-
 
79
    And "Test questions 6" "autocomplete_suggestions" should exist
-
 
80
    When I open the autocomplete suggestions list in the ".search-banks" "css_element"
-
 
81
    Then I should not see "C3 - Question bank 3" in the ".search-banks" "css_element"
-
 
82
    And I click on "C1 - Question bank 1" item in the autocomplete list
-
 
83
    Then I should not see "Test questions 1" in the ".search-categories .form-autocomplete-selection" "css_element"
-
 
84
    And the field "selectcategory" matches value "Default for Question bank 1"
-
 
85
    And I open the autocomplete suggestions list in the ".search-categories" "css_element"
-
 
86
    And "Test questions 2 (1)" "autocomplete_suggestions" should exist
-
 
87
    And "Test questions 3" "autocomplete_suggestions" should not exist
-
 
88
    And "Test questions 4" "autocomplete_suggestions" should not exist
-
 
89
    And "Test questions 5" "autocomplete_suggestions" should exist
-
 
90
 
-
 
91
  @javascript
-
 
92
  Scenario: Move a question from one bank category to another.
-
 
93
    Given I log in as "teacher1"
-
 
94
    And I am on the "Test quiz" "mod_quiz > question bank" page
-
 
95
    And I apply question bank filter "Category" with value "Test questions 1"
-
 
96
    And I click on "First question" "checkbox"
-
 
97
    And I click on "With selected" "button"
-
 
98
    And I click on "move" "button"
-
 
99
    And I open the autocomplete suggestions list in the ".search-categories" "css_element"
-
 
100
    And I click on "Test questions 6 (1)" item in the autocomplete list
-
 
101
    And I click on "Move questions" "button"
-
 
102
    Then I should see "Are you sure you want to move these questions?"
-
 
103
    And I click on "Confirm" "button"
-
 
104
    And I wait until the page is ready
-
 
105
    Then I should see "Questions successfully moved"
-
 
106
 
-
 
107
  @javascript
-
 
108
  Scenario: Questions can be bulk moved from the question bank
-
 
109
    Given the following "questions" exist:
-
 
110
      | questioncategory | qtype       | name       | questiontext              |
-
 
111
      | Test questions   | truefalse   | Question 1 | Answer the first question |
-
 
112
      | Test questions   | missingtype | Question 2 | Write something           |
-
 
113
      | Test questions   | essay       | Question 3 | frog                      |
-
 
114
    And I am on the "Course 1" "core_question > course question bank" page logged in as teacher1
-
 
115
    And I apply question bank filter "Category" with value "Test questions"
-
 
116
    # Select questions to be moved.
-
 
117
    And I click on "Question 1" "checkbox"
-
 
118
    And I click on "Question 2" "checkbox"
-
 
119
    And I click on "With selected" "button"
-
 
120
    When I press "Move to"
-
 
121
    # Select a different category to move the questions into.
-
 
122
    And I open the autocomplete suggestions list in the ".search-categories" "css_element"
-
 
123
    And I click on "Moved questions" item in the autocomplete list
-
 
124
    And I press "Move questions"
-
 
125
    And I click on "Confirm" "button"
-
 
126
    # Confirm that selected questions are moved to selected category while unselected questions are not moved.
-
 
127
    Then I should see "Moved questions"
-
 
128
    And I should see "Question 1"
-
 
129
    And I should see "Question 2"
-
 
130
    And I should not see "Question 3"
-
 
131
    # No questions are highlighted when bulk-moved.
-
 
132
    And the "class" attribute of "Question 1" "table_row" should not contain "highlight"
-
 
133
    And the "class" attribute of "Question 2" "table_row" should not contain "highlight"
-
 
134
 
-
 
135
  @javascript
-
 
136
  Scenario: Unable to bulk move questions from history page
-
 
137
    Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
-
 
138
    And I apply question bank filter "Category" with value "Test questions 1"
-
 
139
    And I choose "History" action for "First question" in the question bank
-
 
140
    And I click on "First question" "checkbox"
-
 
141
    And I click on "With selected" "button"
-
 
142
    Then I should see question bulk action "deleteselected"
-
 
143
    And I should not see question bulk action "move"
-
 
144
 
-
 
145
  @javascript
-
 
146
  Scenario: Questions can be moved to a different bank, if the user has the correct capability
-
 
147
    Given the following "role" exists:
-
 
148
      | name      | Question adder |
-
 
149
      | shortname | adder          |
-
 
150
    And the following "role capability" exists:
-
 
151
      | role                | adder |
-
 
152
      | moodle/question:add | allow |
-
 
153
    And the following "course" exists:
-
 
154
      | fullname  | Course 4 |
-
 
155
      | shortname | C4       |
-
 
156
      | category  | 0        |
-
 
157
    And the following "course enrolment" exists:
-
 
158
      | course | C4       |
-
 
159
      | user   | teacher1 |
-
 
160
      | role   | adder    |
-
 
161
    And the following "activity" exists:
-
 
162
      | activity | qbank           |
-
 
163
      | course   | C4              |
-
 
164
      | name     | Question bank 4 |
-
 
165
      | idnumber | qbank4          |
-
 
166
    And the following "question category" exists:
-
 
167
      | contextlevel | Activity module  |
-
 
168
      | reference    | qbank4           |
-
 
169
      | name         | Test questions 7 |
-
 
170
    Given I am on the "Test quiz" "mod_quiz > question bank" page logged in as "teacher1"
-
 
171
    And I apply question bank filter "Category" with value "Test questions 1"
-
 
172
    And I press "Create a new question ..."
-
 
173
    And I set the field "item_qtype_truefalse" to "1"
-
 
174
    # Manually create a new question so additional parameters are included in the URL, and we can test they are handled correctly
-
 
175
    # during the move operation.
-
 
176
    And I click on "Add" "button" in the "Choose a question type to add" "dialogue"
-
 
177
    And I set the following fields to these values:
-
 
178
      | Question name | Seventh question |
-
 
179
      | Question text | test             |
-
 
180
    And I press "id_submitbutton"
-
 
181
    And I click on "Seventh question" "checkbox"
-
 
182
    And I click on "With selected" "button"
-
 
183
    And I click on "move" "button"
-
 
184
    And the field "searchbanks" matches value "C1 - Test quiz"
-
 
185
    And the field "selectcategory" matches value "Default for Test quiz"
-
 
186
    And I open the autocomplete suggestions list in the ".search-banks" "css_element"
-
 
187
    And I should see "C1 - Question bank 1" in the ".search-banks .form-autocomplete-suggestions" "css_element"
-
 
188
    And I should see "C2 - Question bank 2" in the ".search-banks .form-autocomplete-suggestions" "css_element"
-
 
189
    And I should see "C4 - Question bank 4" in the ".search-banks .form-autocomplete-suggestions" "css_element"
-
 
190
    And I should not see "C3 - Question bank 3" in the ".search-banks .form-autocomplete-suggestions" "css_element"
-
 
191
    And I click on "C1 - Question bank 1" item in the autocomplete list
-
 
192
    And I open the autocomplete suggestions list in the ".question_category_selector" "css_element"
-
 
193
    And I click on "Test questions 2 (1)" item in the autocomplete list
-
 
194
    And I click on "Move questions" "button"
-
 
195
    And I should see "Are you sure you want to move these questions?"
-
 
196
    When I click on "Confirm" "button"
-
 
197
    Then I should see "Questions successfully moved"
-
 
198
    # The move dialogue should default to the new bank and category.
-
 
199
    And I click on "Seventh question" "checkbox"
-
 
200
    And I click on "With selected" "button"
-
 
201
    And I click on "move" "button"
-
 
202
    And the field "searchbanks" matches value "C1 - Question bank 1"
-
 
203
    And the field "selectcategory" matches value "Default for Question bank 1 (1)"
-
 
204
    # The moved question should be highlighted
-
 
205
    And the "class" attribute of "Seventh question" "table_row" should contain "highlight"
-
 
206
 
-
 
207
  @javascript
-
 
208
  Scenario: A new question bank is available in the move dialogue immediately
-
 
209
    Given I am on the "C1" "Course" page logged in as "teacher1"
-
 
210
    And the following "user preferences" exist:
-
 
211
      | user     | preference | value    |
-
 
212
      | teacher1 | htmleditor | textarea |
-
 
213
    And I navigate to "Question banks" in current page administration
-
 
214
    And I press "Add"
-
 
215
    And I set the field "Question bank name" to "New question bank"
-
 
216
    And I press "Save and return to question bank list"
-
 
217
    And I am on the "Test quiz" "mod_quiz > question bank" page
-
 
218
    And I apply question bank filter "Category" with value "Test questions 1"
-
 
219
    And I click on "First question" "checkbox"
-
 
220
    And I click on "With selected" "button"
-
 
221
    And I click on "move" "button"