Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@qbank @qbank_columnsortorder @javascript
2
Feature: Set question bank column order and size
3
  In order customise my view of the question bank
4
  As a teacher
5
  I want to hide, reorder, and resize columns
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email                |
10
      | teacher1 | Teacher   | 1        | teacher1@example.com |
11
    And the following "courses" exist:
12
      | fullname | shortname | format |
13
      | Course 1 | C1        | weeks  |
14
    And the following "activity" exists:
15
      | activity | quiz           |
16
      | course   | C1             |
17
      | name     | Test quiz Q001 |
18
    And the following "course enrolments" exist:
19
      | user     | course | role           |
20
      | teacher1 | C1     | editingteacher |
21
    And the following "question category" exist:
22
      | contextlevel    | reference      | name                |
23
      | Activity module | Test quiz Q001 | Question category 1 |
24
    And the following "questions" exist:
25
      | questioncategory    | qtype | name                     | user     | questiontext                  | idnumber  |
26
      | Question category 1 | essay | Test question to be seen | teacher1 | Write about whatever you want | idnumber1 |
27
    And the following config values are set as admin:
28
      | config       | value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | plugin                |
29
      | hiddencols   | qbank_usage\question_last_used_column-question_last_used_column                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | qbank_columnsortorder |
30
      | enabledcol   | qbank_comment\comment_count_column-comment_count_column,qbank_viewquestionname\question_name_idnumber_tags_column-question_name_idnumber_tags_column,core_question\local\bank\edit_menu_column-edit_menu_column,qbank_editquestion\question_status_column-question_status_column,qbank_history\version_number_column-version_number_column,qbank_statistics\columns\discrimination_index:discrimination_index,qbank_statistics\columns\facility_index:facility_index,qbank_statistics\columns\discriminative_efficiency:discriminative_efficiency,qbank_usage\question_usage_column-question_usage_column,qbank_usage\question_last_used_column-question_last_used_column,qbank_viewcreator\creator_name_column-creator_name_column,qbank_viewcreator\modifier_name_column-modifier_name_column,qbank_viewquestiontype\question_type_column-question_type_column                                                                                                                                                                                                                                                                               | qbank_columnsortorder |
31
      | colsize      | [{"column":"qbank_comment\\comment_count_column-comment_count_column","width":"20"},{"column":"qbank_viewquestionname\\question_name_idnumber_tags_column-question_name_idnumber_tags_column","width":"300"},{"column":"qbank_editquestion\\question_status_column-question_status_column","width":"20"},{"column":"qbank_history\\version_number_column-version_number_column","width":"20"},{"column":"qbank_statistics\\columns\\discrimination_index:discrimination_index","width":"20"},{"column":"qbank_statistics\\columns\\facility_index:facility_index","width":"20"},{"column":"qbank_statistics\\columns\\discriminative_efficiency:discriminative_efficiency","width":"20"},{"column":"qbank_usage\\question_usage_column-question_usage_column","width":"20"},{"column":"qbank_viewcreator\\creator_name_column-creator_name_column","width":"200"},{"column":"qbank_viewcreator\\modifier_name_column-modifier_name_column","width":"200"},{"column":"qbank_viewquestiontype\\question_type_column-question_type_column","width":"20"},{"column":"core_question\\local\\bank\\edit_menu_column-edit_menu_column","width":"50"}] | qbank_columnsortorder |
32
 
33
  Scenario: The teacher sees the question bank with global settings initially
34
    Given I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
35
    When I apply question bank filter "Category" with value "Question category 1"
36
    Then I should see "Test question to be seen"
37
    And "Last used" "qbank_columnsortorder > column header" should not exist
38
    And "Comments" "qbank_columnsortorder > column header" should appear before "Question" "qbank_columnsortorder > column header"
39
    And the "style" attribute of "Question" "qbank_columnsortorder > column header" should contain "width: 300px;"
40
 
41
  Scenario: User preference takes precedence over global defaults
42
    Given the following "user preferences" exist:
43
    | user      | preference                       | value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
44
    | teacher1  | qbank_columnsortorder_hiddencols | qbank_comment\comment_count_column-comment_count_column                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
45
    | teacher1  | qbank_columnsortorder_enabledcol | qbank_viewquestionname\question_name_idnumber_tags_column-question_name_idnumber_tags_column,qbank_usage\question_last_used_column-question_last_used_column,core_question\local\bank\edit_menu_column-edit_menu_column,qbank_editquestion\question_status_column-question_status_column,qbank_history\version_number_column-version_number_column,qbank_statistics\columns\discrimination_index:discrimination_index,qbank_statistics\columns\facility_index:facility_index,qbank_statistics\columns\discriminative_efficiency:discriminative_efficiency,qbank_usage\question_usage_column-question_usage_column,qbank_usage\question_last_used_column-question_last_used_column,qbank_viewcreator\creator_name_column-creator_name_column,qbank_viewcreator\modifier_name_column-modifier_name_column,qbank_viewquestiontype\question_type_column-question_type_column                                                                                                                                                                                                                                                                       |
46
    | teacher1  | qbank_columnsortorder_colsize    | [{"column":"qbank_comment\\comment_count_column-comment_count_column","width":"20"},{"column":"qbank_viewquestionname\\question_name_idnumber_tags_column-question_name_idnumber_tags_column","width":"400"},{"column":"qbank_editquestion\\question_status_column-question_status_column","width":"20"},{"column":"qbank_history\\version_number_column-version_number_column","width":"20"},{"column":"qbank_statistics\\columns\\discrimination_index:discrimination_index","width":"20"},{"column":"qbank_statistics\\columns\\facility_index:facility_index","width":"20"},{"column":"qbank_statistics\\columns\\discriminative_efficiency:discriminative_efficiency","width":"20"},{"column":"qbank_usage\\question_usage_column-question_usage_column","width":"20"},{"column":"qbank_viewcreator\\creator_name_column-creator_name_column","width":"200"},{"column":"qbank_viewcreator\\modifier_name_column-modifier_name_column","width":"200"},{"column":"qbank_viewquestiontype\\question_type_column-question_type_column","width":"20"},{"column":"core_question\\local\\bank\\edit_menu_column-edit_menu_column","width":"50"}] |
47
    And I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
48
    When I apply question bank filter "Category" with value "Question category 1"
49
    Then "Comments" "qbank_columnsortorder > column header" should not exist
50
    And "Question" "qbank_columnsortorder > column header" should appear before "Last used" "qbank_columnsortorder > column header"
51
    And the "style" attribute of "Question" "qbank_columnsortorder > column header" should contain "width: 400px;"
52
 
53
  Scenario: Resetting user view goes back to global defaults
54
    Given the following "user preferences" exist:
55
      | user      | preference                       | value                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
56
      | teacher1  | qbank_columnsortorder_hiddencols |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
57
      | teacher1  | qbank_columnsortorder_enabledcol | qbank_viewquestionname\question_name_idnumber_tags_column-question_name_idnumber_tags_column,qbank_usage\question_last_used_column-question_last_used_column,core_question\local\bank\edit_menu_column-edit_menu_column,qbank_editquestion\question_status_column-question_status_column,qbank_history\version_number_column-version_number_column,qbank_statistics\columns\discrimination_index:discrimination_index,qbank_statistics\columns\facility_index:facility_index,qbank_statistics\columns\discriminative_efficiency:discriminative_efficiency,qbank_usage\question_usage_column-question_usage_column,qbank_usage\question_last_used_column-question_last_used_column,qbank_viewcreator\creator_name_column-creator_name_column,qbank_viewcreator\modifier_name_column-modifier_name_column,qbank_viewquestiontype\question_type_column-question_type_column                                                                                                                                                                                                                                                                       |
58
      | teacher1  | qbank_columnsortorder_colsize    | [{"column":"qbank_comment\\comment_count_column-comment_count_column","width":"20"},{"column":"qbank_viewquestionname\\question_name_idnumber_tags_column-question_name_idnumber_tags_column","width":"400"},{"column":"qbank_editquestion\\question_status_column-question_status_column","width":"20"},{"column":"qbank_history\\version_number_column-version_number_column","width":"20"},{"column":"qbank_statistics\\columns\\discrimination_index:discrimination_index","width":"20"},{"column":"qbank_statistics\\columns\\facility_index:facility_index","width":"20"},{"column":"qbank_statistics\\columns\\discriminative_efficiency:discriminative_efficiency","width":"20"},{"column":"qbank_usage\\question_usage_column-question_usage_column","width":"20"},{"column":"qbank_viewcreator\\creator_name_column-creator_name_column","width":"200"},{"column":"qbank_viewcreator\\modifier_name_column-modifier_name_column","width":"200"},{"column":"qbank_viewquestiontype\\question_type_column-question_type_column","width":"20"},{"column":"core_question\\local\\bank\\edit_menu_column-edit_menu_column","width":"50"}] |
59
    And I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
60
    And I apply question bank filter "Category" with value "Question category 1"
61
    And "Last used" "qbank_columnsortorder > column header" should exist
62
    And "Question" "qbank_columnsortorder > column header" should appear before "Last used" "qbank_columnsortorder > column header"
63
    And the "style" attribute of "Question" "qbank_columnsortorder > column header" should contain "width: 400px;"
64
    When I follow "Reset columns"
65
    Then "Last used" "qbank_columnsortorder > column header" should not exist
66
    And "Comments" "qbank_columnsortorder > column header" should appear before "Question" "qbank_columnsortorder > column header"
67
    And the "style" attribute of "Question" "qbank_columnsortorder > column header" should contain "width: 300px;"
68
 
69
  Scenario: User can remove a column in the question bank
70
    Given I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
71
    And I apply question bank filter "Category" with value "Question category 1"
72
    And "Comments" "qbank_columnsortorder > column header" should exist
73
    And I click on "Actions menu" "link" in the "Comments" "qbank_columnsortorder > column header"
74
    And I choose "Remove" in the open action menu
75
    Then "Comments" "qbank_columnsortorder > column header" should not exist
76
    And I reload the page
77
    And "Comments" "qbank_columnsortorder > column header" should not exist
78
 
79
  Scenario: User can add a column in the question bank
80
    Given I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
81
    And I apply question bank filter "Category" with value "Question category 1"
82
    And "Last used" "qbank_columnsortorder > column header" should not exist
83
    When I press "Add columns"
84
    And I follow "Last used"
85
    Then "Last used" "qbank_columnsortorder > column header" should exist
86
    And I reload the page
87
    And "Last used" "qbank_columnsortorder > column header" should exist
88
 
89
  Scenario: User can resize a column in the question bank using modal dialog
90
    Given I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
91
    And I apply question bank filter "Category" with value "Question category 1"
92
    And the "style" attribute of "Question" "qbank_columnsortorder > column header" should contain "width: 300px"
93
    When I click on "Actions menu" "link" in the "Question" "qbank_columnsortorder > column header"
94
    And I choose "Resize" in the open action menu
95
    And I set the field "Column width (pixels)" to "400"
96
    And I press "Save changes"
97
    Then the "style" attribute of "Question" "qbank_columnsortorder > column header" should contain "width: 400px"
98
    And I reload the page
99
    And the "style" attribute of "Question" "qbank_columnsortorder > column header" should contain "width: 400px"
100
 
101
  Scenario: User can resize a column in the question bank by dragging
102
    Given I change the window size to "large"
103
    And I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
104
    And I apply question bank filter "Category" with value "Question category 1"
105
    And the "style" attribute of "Question" "qbank_columnsortorder > column header" should contain "width: 300px"
106
    When I hover "Question" "qbank_columnsortorder > column header"
107
    And I drag "Question" "qbank_columnsortorder > column resize handle" and I drop it in "Status" "qbank_columnsortorder > column header"
108
    And the "style" attribute of "Question" "qbank_columnsortorder > column header" should not contain "width: 300px"
109
    And I reload the page
110
    And the "style" attribute of "Question" "qbank_columnsortorder > column header" should not contain "width: 300px"
111
 
112
  Scenario: User can move a column in the question bank using modal dialog
113
    Given I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
114
    And I apply question bank filter "Category" with value "Question category 1"
115
    And "Comments" "qbank_columnsortorder > column header" should appear before "Question" "qbank_columnsortorder > column header"
116
    When I click on "Actions menu" "link" in the "Comments" "qbank_columnsortorder > column header"
117
    And I choose "Move" in the open action menu
118
    And I follow "After \"Question\""
119
    Then "Comments" "qbank_columnsortorder > column header" should appear after "Question" "qbank_columnsortorder > column header"
120
    And I reload the page
121
    And "Comments" "qbank_columnsortorder > column header" should appear after "Question" "qbank_columnsortorder > column header"
122
 
123
  Scenario: User can move a column in the question bank by dragging
124
    Given I change the window size to "large"
125
    And I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
126
    And I apply question bank filter "Category" with value "Question category 1"
127
    And "Comments" "qbank_columnsortorder > column header" should appear before "Question" "qbank_columnsortorder > column header"
128
    When I hover "Comments" "qbank_columnsortorder > column header"
129
    And I drag "Comments" "qbank_columnsortorder > column move handle" and I drop it in "Status" "qbank_columnsortorder > column header"
130
    Then "Comments" "qbank_columnsortorder > column header" should appear after "Question" "qbank_columnsortorder > column header"
131
    And I reload the page
132
    And "Comments" "qbank_columnsortorder > column header" should appear after "Question" "qbank_columnsortorder > column header"
133
 
134
  Scenario: Reordering with disabled columns
135
    When I log in as "admin"
136
    And I navigate to "Plugins > Question bank plugins > Manage question bank plugins" in site administration
137
    And I click on "Disable" "link" in the "Question statistics" "table_row"
138
    And I click on "Enable" "link" in the "Question statistics" "table_row"
139
    And I click on "Disable" "link" in the "Question statistics" "table_row"
140
    And I am on the "Course 1" "core_question > course question bank" page
141
    Then I should see "Question bank"
142
    And "Create a new question" "button" should exist
143
    # Really, we are just checking the question bank displayed without errors.
144
 
145
  Scenario: Deleting a custom field which a user had removed from his preferences
146
    Given the following "custom field categories" exist:
147
      | name              | component          | area     | itemid |
148
      | Category for test | qbank_customfields | question | 0      |
149
    And the following "custom fields" exist:
150
      | name    | category          | type | shortname | configdata         |
151
      | Field 1 | Category for test | text | f1        | {"visibility":"2"} |
152
      | Field 2 | Category for test | text | f2        | {"visibility":"2"} |
153
    And I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
154
    And I apply question bank filter "Category" with value "Question category 1"
155
    And I click on "Actions menu" "link" in the "Field 1" "qbank_columnsortorder > column header"
156
    And I choose "Remove" in the open action menu
157
    And I click on "Actions menu" "link" in the "Field 2" "qbank_columnsortorder > column header"
158
    And I choose "Remove" in the open action menu
159
    And "Field 2" "qbank_columnsortorder > column header" should not exist
160
 
161
    # Delete a question custom field.
162
    And I log in as "admin"
163
    And I navigate to "Plugins > Question bank plugins > Question custom fields" in site administration
164
    And I click on "Delete" "link" in the "Field 1" "table_row"
165
    And I click on "Yes" "button" in the "Confirm" "dialogue"
166
    And I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
167
    And I apply question bank filter "Category" with value "Question category 1"
168
    Then I should see "Question bank"
169
 
170
    # Delete the question custom category.
171
    And I log in as "admin"
172
    And I navigate to "Plugins > Question bank plugins > Question custom fields" in site administration
173
    And I click on "[data-role='deletecategory']" "css_element"
174
    And I click on "Yes" "button" in the "Confirm" "dialogue"
175
    And I should not see "Category for test" in the "#customfield_catlist" "css_element"
176
    And I am on the "Test quiz Q001" "mod_quiz > question bank" page logged in as "teacher1"
177
    And I apply question bank filter "Category" with value "Question category 1"
178
    And I should see "Question bank"