1 |
efrain |
1 |
@qbank @qbank_columnsortorder @javascript
|
|
|
2 |
Feature: Set default question bank column order and size
|
|
|
3 |
In order to set sensible defaults for the question bank interface
|
|
|
4 |
As an admin
|
|
|
5 |
I want to hide, reorder, and resize columns
|
|
|
6 |
|
|
|
7 |
Scenario: Admin can reorder question bank columns
|
|
|
8 |
Given I change the window size to "large"
|
|
|
9 |
And I log in as "admin"
|
|
|
10 |
When I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
|
|
|
11 |
And I drag "Created by" "qbank_columnsortorder > column move handle" and I drop it in "T" "qbank_columnsortorder > column move handle"
|
|
|
12 |
Then "Created by" "table_row" should appear before "T" "table_row"
|
|
|
13 |
And I reload the page
|
|
|
14 |
And "Created by" "table_row" should appear before "T" "table_row"
|
|
|
15 |
And I follow "Preview"
|
|
|
16 |
And "Created by" "qbank_columnsortorder > column header" should appear before "T" "qbank_columnsortorder > column header"
|
|
|
17 |
|
|
|
18 |
Scenario: Disabling a question bank plugin removes its columns
|
|
|
19 |
Given I log in as "admin"
|
|
|
20 |
When I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
|
|
|
21 |
And I should see "Created by"
|
|
|
22 |
And I click on "Manage question bank plugins" "link"
|
|
|
23 |
And I click on "Disable" "link" in the "View creator" "table_row"
|
|
|
24 |
And I click on "Column sort order" "link"
|
|
|
25 |
Then "Currently disabled question bank plugins:" "text" should appear before "Created by" "text"
|
|
|
26 |
And I click on "Manage question bank plugins" "link"
|
|
|
27 |
And I click on "Enable" "link" in the "View creator" "table_row"
|
|
|
28 |
And I click on "Column sort order" "link"
|
|
|
29 |
Then I should not see "Currently disabled question bank plugins:"
|
|
|
30 |
And I should see "Created by"
|
|
|
31 |
|
|
|
32 |
Scenario: Admin can hide a column in site administration page
|
|
|
33 |
Given I log in as "admin"
|
|
|
34 |
And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
|
|
|
35 |
And "Created by" "table_row" should exist
|
|
|
36 |
When I click on "Actions menu" "link" in the "Created by" "table_row"
|
|
|
37 |
And I choose "Remove" in the open action menu
|
|
|
38 |
Then "Created by" "table_row" should not exist
|
|
|
39 |
And I reload the page
|
|
|
40 |
And "Created by" "table_row" should not exist
|
|
|
41 |
And I follow "Preview"
|
|
|
42 |
And "Created by" "qbank_columnsortorder > column header" should not exist
|
|
|
43 |
|
|
|
44 |
Scenario: Admin can show a column in site administration page
|
|
|
45 |
Given the following config values are set as admin:
|
|
|
46 |
| config | value | plugin |
|
|
|
47 |
| hiddencols | qbank_viewcreator\creator_name_column-creator_name_column | qbank_columnsortorder |
|
|
|
48 |
And I log in as "admin"
|
|
|
49 |
And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
|
|
|
50 |
And "Created by" "table_row" should not exist
|
|
|
51 |
When I press "Add columns"
|
|
|
52 |
And I follow "Created by"
|
|
|
53 |
Then "Created by" "table_row" should exist
|
|
|
54 |
And I reload the page
|
|
|
55 |
And "Created by" "table_row" should exist
|
|
|
56 |
And I follow "Preview"
|
|
|
57 |
And "Created by" "qbank_columnsortorder > column header" should exist
|
|
|
58 |
|
|
|
59 |
Scenario: Admin can resize a column in site administration page
|
|
|
60 |
Given I log in as "admin"
|
|
|
61 |
And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
|
|
|
62 |
And the field "Width of 'Question' in pixels" matches value ""
|
|
|
63 |
When I set the field "Width of 'Question' in pixels" to "400"
|
|
|
64 |
And I reload the page
|
|
|
65 |
Then the field "Width of 'Question' in pixels" matches value "400"
|
|
|
66 |
And I follow "Preview"
|
|
|
67 |
And the "style" attribute of "Question" "qbank_columnsortorder > column header" should contain "width: 400px"
|
|
|
68 |
|
|
|
69 |
Scenario: Custom fields can be reordered, resized, hidden and shown
|
|
|
70 |
Given I change the window size to "large"
|
|
|
71 |
And I log in as "admin"
|
|
|
72 |
And I navigate to "Plugins > Question bank plugins > Question custom fields" in site administration
|
|
|
73 |
And I press "Add a new category"
|
|
|
74 |
And I click on "Add a new custom field" "link"
|
|
|
75 |
And I follow "Checkbox"
|
|
|
76 |
And I set the following fields to these values:
|
|
|
77 |
| Name | checkboxcustomcolumn |
|
|
|
78 |
| Short name | chckcust |
|
|
|
79 |
And I press "Save changes"
|
|
|
80 |
And I should see "checkboxcustomcolumn"
|
|
|
81 |
And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
|
|
|
82 |
And "checkboxcustomcolumn" "table_row" should appear after "Comments" "table_row"
|
|
|
83 |
When I drag "checkboxcustomcolumn" "qbank_columnsortorder > column move handle" and I drop it in "Comments" "qbank_columnsortorder > column move handle"
|
|
|
84 |
And I set the field "Width of 'checkboxcustomcolumn' in pixels" to "200"
|
|
|
85 |
And I follow "Preview"
|
|
|
86 |
And "checkboxcustomcolumn" "qbank_columnsortorder > column header" should appear before "Comments" "qbank_columnsortorder > column header"
|
|
|
87 |
And the "style" attribute of "checkboxcustomcolumn" "qbank_columnsortorder > column header" should contain "width: 200px"
|
|
|
88 |
And I follow "Back"
|
|
|
89 |
And "checkboxcustomcolumn" "table_row" should appear before "Comments" "table_row"
|
|
|
90 |
And the field "Width of 'checkboxcustomcolumn' in pixels" matches value "200"
|
|
|
91 |
And I click on "Actions menu" "link" in the "checkboxcustomcolumn" "table_row"
|
|
|
92 |
And I choose "Remove" in the open action menu
|
|
|
93 |
And "checkboxcustomcolumn" "table_row" should not exist
|
|
|
94 |
And I follow "Preview"
|
|
|
95 |
And "checkboxcustomcolumn" "qbank_columnsortorder > column header" should not exist
|
|
|
96 |
And I follow "Back"
|
|
|
97 |
And I press "Add columns"
|
|
|
98 |
And I follow "checkboxcustomcolumn"
|
|
|
99 |
And "checkboxcustomcolumn" "table_row" should exist
|
|
|
100 |
And I follow "Preview"
|
|
|
101 |
And "checkboxcustomcolumn" "qbank_columnsortorder > column header" should exist
|
|
|
102 |
|
|
|
103 |
Scenario: Resetting columns on the admin page clears global settings
|
|
|
104 |
Given the following config values are set as admin:
|
|
|
105 |
| config | value | plugin |
|
|
|
106 |
| hiddencols | qbank_usage\question_last_used_column-question_last_used_column | qbank_columnsortorder |
|
|
|
107 |
| 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 |
|
|
|
108 |
| 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 |
|
|
|
109 |
And I change the window size to "large"
|
|
|
110 |
And I log in as "admin"
|
|
|
111 |
And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
|
|
|
112 |
And "Last used" "table_row" should not exist
|
|
|
113 |
And "Comments" "table_row" should appear before "Question" "table_row"
|
|
|
114 |
And the field "Width of 'Question' in pixels" matches value "300"
|
|
|
115 |
When I follow "Reset columns"
|
|
|
116 |
Then "Last used" "table_row" should exist
|
|
|
117 |
And "Question" "table_row" should appear before "Comments" "table_row"
|
|
|
118 |
And the field "Width of 'Question' in pixels" matches value ""
|
|
|
119 |
|
|
|
120 |
Scenario: Deleting a custom field which is removed from the Column sort order
|
|
|
121 |
Given the following "custom field categories" exist:
|
|
|
122 |
| name | component | area | itemid |
|
|
|
123 |
| Category for test | qbank_customfields | question | 0 |
|
|
|
124 |
And the following "custom fields" exist:
|
|
|
125 |
| name | category | type | shortname | configdata |
|
|
|
126 |
| Field 1 | Category for test | text | f1 | {"visibility":"2"} |
|
|
|
127 |
| Field 2 | Category for test | text | f2 | {"visibility":"2"} |
|
|
|
128 |
And I change the window size to "large"
|
|
|
129 |
When I log in as "admin"
|
|
|
130 |
And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
|
|
|
131 |
And "Field 1" "table_row" should exist
|
|
|
132 |
And "Field 2" "table_row" should exist
|
|
|
133 |
And I click on "Actions menu" "link" in the "Field 1" "table_row"
|
|
|
134 |
And I choose "Remove" in the open action menu
|
|
|
135 |
|
|
|
136 |
# Delete a question custom field.
|
|
|
137 |
And I navigate to "Plugins > Question bank plugins > Question custom fields" in site administration
|
|
|
138 |
And I click on "Delete" "link" in the "Field 1" "table_row"
|
|
|
139 |
And I click on "Yes" "button" in the "Confirm" "dialogue"
|
|
|
140 |
And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
|
|
|
141 |
Then I should see "Column sort order"
|
|
|
142 |
And "Field 2" "table_row" should exist
|
|
|
143 |
And I click on "Actions menu" "link" in the "Field 2" "table_row"
|
|
|
144 |
And I choose "Remove" in the open action menu
|
|
|
145 |
|
|
|
146 |
# Delete the question custom category.
|
|
|
147 |
And I navigate to "Plugins > Question bank plugins > Question custom fields" in site administration
|
|
|
148 |
And I click on "[data-role='deletecategory']" "css_element"
|
|
|
149 |
And I click on "Yes" "button" in the "Confirm" "dialogue"
|
|
|
150 |
And I should not see "Category for test" in the "#customfield_catlist" "css_element"
|
|
|
151 |
And I navigate to "Plugins > Question bank plugins > Column sort order" in site administration
|
|
|
152 |
And I should see "Column sort order"
|