1 |
efrain |
1 |
@block @block_myoverview @javascript
|
|
|
2 |
Feature: The my overview block allows admins to easily configure the students' course list
|
|
|
3 |
In order to adapt the my overview block to my users' needs
|
|
|
4 |
As an admin
|
|
|
5 |
I can configure the appearance of the my overview block
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email | idnumber |
|
|
|
10 |
| student1 | Student | X | student1@example.com | S1 |
|
|
|
11 |
And the following "categories" exist:
|
|
|
12 |
| name | category | idnumber |
|
|
|
13 |
| Category 1 | 0 | CAT1 |
|
|
|
14 |
And the following "courses" exist:
|
|
|
15 |
| fullname | shortname | category | startdate | enddate |
|
|
|
16 |
| Course 1 | C1 | 0 | ##1 month ago## | ##15 days ago## |
|
|
|
17 |
| Course 2 | C2 | 0 | ##yesterday## | ##tomorrow## |
|
|
|
18 |
| Course 3 | C3 | 0 | ##yesterday## | ##tomorrow## |
|
|
|
19 |
| Course 4 | C4 | CAT1 | ##yesterday## | ##tomorrow## |
|
|
|
20 |
| Course 5 | C5 | 0 | ##first day of next month## | ##last day of next month## |
|
|
|
21 |
And the following "course enrolments" exist:
|
|
|
22 |
| user | course | role |
|
|
|
23 |
| student1 | C1 | student |
|
|
|
24 |
| student1 | C2 | student |
|
|
|
25 |
| student1 | C3 | student |
|
|
|
26 |
| student1 | C4 | student |
|
|
|
27 |
| student1 | C5 | student |
|
|
|
28 |
|
|
|
29 |
Scenario: Enable 'All (including removed from view)' course filter option
|
|
|
30 |
Given I log in as "admin"
|
|
|
31 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
32 |
And I set the field "All (including removed from view)" to "1"
|
|
|
33 |
And I press "Save"
|
|
|
34 |
And I log out
|
|
|
35 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
36 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
37 |
# We have to check for the data attribute instead of the list element text as we would get false positives from the "All" element otherwise
|
|
|
38 |
Then "All (including removed from view)" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
39 |
|
|
|
40 |
Scenario: Disable 'All (including removed from view)' course filter option
|
|
|
41 |
Given I log in as "admin"
|
|
|
42 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
43 |
And I set the field "All (including removed from view)" to "0"
|
|
|
44 |
And I press "Save"
|
|
|
45 |
And I log out
|
|
|
46 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
47 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
48 |
Then "All (including removed from view)" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
49 |
|
|
|
50 |
Scenario: Enable 'All' course filter option
|
|
|
51 |
Given I log in as "admin"
|
|
|
52 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
53 |
And I set the field "All" in the "//*[@id=\"admin-displaygroupingall\"]" "xpath_element" to "1"
|
|
|
54 |
And I press "Save"
|
|
|
55 |
And I log out
|
|
|
56 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
57 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
58 |
Then "[data-value='all']" "css_element" should exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
59 |
|
|
|
60 |
Scenario: Disable 'All' course filter option
|
|
|
61 |
Given I log in as "admin"
|
|
|
62 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
63 |
And I set the field "All" in the "//*[@id=\"admin-displaygroupingall\"]" "xpath_element" to "0"
|
|
|
64 |
And I press "Save"
|
|
|
65 |
And I log out
|
|
|
66 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
67 |
# 'All' option has been disabled, so the button is falling back to the 'In progress' option which is the next enabled option.
|
|
|
68 |
And I click on "In progress" "button" in the "Course overview" "block"
|
|
|
69 |
Then "[data-value='all']" "css_element" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
70 |
|
|
|
71 |
Scenario: Enable 'In progress' course filter option
|
|
|
72 |
Given I log in as "admin"
|
|
|
73 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
74 |
And I set the field "In progress" to "1"
|
|
|
75 |
And I press "Save"
|
|
|
76 |
And I log out
|
|
|
77 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
78 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
79 |
# We have to check for the data attribute instead of the list element text as we would get false negatives "All (including removed from view)" element otherwise
|
|
|
80 |
Then "In progress" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
81 |
|
|
|
82 |
Scenario: Disable 'In progress' course filter option
|
|
|
83 |
Given I log in as "admin"
|
|
|
84 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
85 |
And I set the field "In progress" to "0"
|
|
|
86 |
And I press "Save"
|
|
|
87 |
And I log out
|
|
|
88 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
89 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
90 |
Then "In progress" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
91 |
|
|
|
92 |
Scenario: Enable 'Future' course filter option
|
|
|
93 |
Given I log in as "admin"
|
|
|
94 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
95 |
And I set the field "Future" to "1"
|
|
|
96 |
And I press "Save"
|
|
|
97 |
And I log out
|
|
|
98 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
99 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
100 |
Then "Future" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
101 |
|
|
|
102 |
Scenario: Disable 'Future' course filter option
|
|
|
103 |
Given I log in as "admin"
|
|
|
104 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
105 |
And I set the field "Future" to "0"
|
|
|
106 |
And I press "Save"
|
|
|
107 |
And I log out
|
|
|
108 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
109 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
110 |
Then "Future" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
111 |
|
|
|
112 |
Scenario: Enable 'Past' course filter option
|
|
|
113 |
Given I log in as "admin"
|
|
|
114 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
115 |
And I set the field "Past" to "1"
|
|
|
116 |
And I press "Save"
|
|
|
117 |
And I log out
|
|
|
118 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
119 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
120 |
Then "Past" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
121 |
|
|
|
122 |
Scenario: Disable 'Past' course filter option
|
|
|
123 |
Given I log in as "admin"
|
|
|
124 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
125 |
And I set the field "Past" to "0"
|
|
|
126 |
And I press "Save"
|
|
|
127 |
And I log out
|
|
|
128 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
129 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
130 |
Then "Past" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
131 |
|
|
|
132 |
Scenario: Enable 'Starred' course filter option
|
|
|
133 |
Given I log in as "admin"
|
|
|
134 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
135 |
And I set the field "Starred" to "1"
|
|
|
136 |
And I press "Save"
|
|
|
137 |
And I log out
|
|
|
138 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
139 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
140 |
Then "Starred" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
141 |
|
|
|
142 |
Scenario: Disable 'Starred' course filter option
|
|
|
143 |
Given I log in as "admin"
|
|
|
144 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
145 |
And I set the field "Starred" to "0"
|
|
|
146 |
And I press "Save"
|
|
|
147 |
And I log out
|
|
|
148 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
149 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
150 |
Then "Starred" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
151 |
|
|
|
152 |
Scenario: Enable 'Removed courses' course filter option
|
|
|
153 |
Given I log in as "admin"
|
|
|
154 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
155 |
And I set the field "Removed from view" to "1"
|
|
|
156 |
And I press "Save"
|
|
|
157 |
And I log out
|
|
|
158 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
159 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
160 |
Then "Removed from view" "list_item" should exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
161 |
|
|
|
162 |
Scenario: Disable 'Removed courses' course filter option
|
|
|
163 |
Given I log in as "admin"
|
|
|
164 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
165 |
And I set the field "Removed from view" to "0"
|
|
|
166 |
And I press "Save"
|
|
|
167 |
And I log out
|
|
|
168 |
Then I am on the "My courses" page logged in as "student1"
|
|
|
169 |
And I click on "All" "button" in the "Course overview" "block"
|
|
|
170 |
Then "Removed from view" "list_item" should not exist in the ".block_myoverview .dropdown-menu" "css_element"
|
|
|
171 |
|
|
|
172 |
Scenario: Disable all course filter options
|
|
|
173 |
Given I log in as "admin"
|
|
|
174 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
175 |
And I set the field "All (including removed from view)" to "0"
|
|
|
176 |
And I set the field "All" in the "//*[@id=\"admin-displaygroupingall\"]" "xpath_element" to "0"
|
|
|
177 |
And I set the field "In progress" to "0"
|
|
|
178 |
And I set the field "Future" to "0"
|
|
|
179 |
And I set the field "Past" to "0"
|
|
|
180 |
And I set the field "Starred" to "0"
|
|
|
181 |
And I set the field "Removed from view" to "0"
|
|
|
182 |
And I press "Save"
|
|
|
183 |
And I log out
|
|
|
184 |
And I am on the "My courses" page logged in as "student1"
|
|
|
185 |
Then "button#groupingdropdown" "css_element" should not exist in the ".block_myoverview" "css_element"
|
|
|
186 |
And I should see "Course 1" in the "Course overview" "block"
|
|
|
187 |
And I should see "Course 2" in the "Course overview" "block"
|
|
|
188 |
And I should see "Course 3" in the "Course overview" "block"
|
|
|
189 |
And I should see "Course 4" in the "Course overview" "block"
|
|
|
190 |
And I should see "Course 5" in the "Course overview" "block"
|
|
|
191 |
|
|
|
192 |
Scenario: Disable all but one course filter option
|
|
|
193 |
Given I log in as "admin"
|
|
|
194 |
And I navigate to "Plugins > Blocks > Course overview" in site administration
|
|
|
195 |
And I set the field "All (including removed from view)" to "0"
|
|
|
196 |
And I set the field "All" in the "//*[@id=\"admin-displaygroupingall\"]" "xpath_element" to "0"
|
|
|
197 |
And I set the field "In progress" to "1"
|
|
|
198 |
And I set the field "Future" to "0"
|
|
|
199 |
And I set the field "Past" to "0"
|
|
|
200 |
And I set the field "Starred" to "0"
|
|
|
201 |
And I set the field "Removed from view" to "0"
|
|
|
202 |
And I press "Save"
|
|
|
203 |
And I log out
|
|
|
204 |
And I am on the "My courses" page logged in as "student1"
|
|
|
205 |
Then "button#groupingdropdown" "css_element" should not exist in the ".block_myoverview" "css_element"
|
|
|
206 |
And I should see "Course 2" in the "Course overview" "block"
|
|
|
207 |
And I should see "Course 3" in the "Course overview" "block"
|
|
|
208 |
And I should see "Course 4" in the "Course overview" "block"
|
|
|
209 |
And I should not see "Course 1" in the "Course overview" "block"
|
|
|
210 |
And I should not see "Course 5" in the "Course overview" "block"
|