MDL-69392 block_myoverview: Basic contrast check for the dashboard
[moodle.git] / blocks / myoverview / tests / behat / block_myoverview_dashboard.feature
CommitLineData
1dc764a6 1@block @block_myoverview @javascript
44eb44e4 2Feature: The my overview block allows users to easily access their courses
1dc764a6
SL
3 In order to enable the my overview block in a course
4 As a student
5 I can add the my overview block to my dashboard
6
7 Background:
8 Given the following "users" exist:
9 | username | firstname | lastname | email | idnumber |
e4b4b9e7 10 | student1 | Student | X | student1@example.com | S1 |
d657d80d
MG
11 And the following "categories" exist:
12 | name | category | idnumber |
13 | Category 1 | 0 | CAT1 |
1dc764a6
SL
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## |
e4b4b9e7 18 | Course 3 | C3 | 0 | ##yesterday## | ##tomorrow## |
d657d80d 19 | Course 4 | C4 | CAT1 | ##yesterday## | ##tomorrow## |
e4b4b9e7 20 | Course 5 | C5 | 0 | ##first day of next month## | ##last day of next month## |
1dc764a6
SL
21 And the following "course enrolments" exist:
22 | user | course | role |
23 | student1 | C1 | student |
24 | student1 | C2 | student |
25 | student1 | C3 | student |
e4b4b9e7
BB
26 | student1 | C4 | student |
27 | student1 | C5 | student |
1dc764a6 28
e4b4b9e7 29 Scenario: View past courses
1dc764a6 30 Given I log in as "student1"
74d7ab50 31 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
4671ae63
RW
32 When I click on "Past" "link" in the "Course overview" "block"
33 Then I should see "Course 1" in the "Course overview" "block"
34 And I should not see "Course 2" in the "Course overview" "block"
35 And I should not see "Course 3" in the "Course overview" "block"
e4b4b9e7
BB
36 And I should not see "Course 4" in the "Course overview" "block"
37 And I should not see "Course 5" in the "Course overview" "block"
e4b4b9e7
BB
38
39 Scenario: View future courses
40 Given I log in as "student1"
74d7ab50 41 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e4b4b9e7
BB
42 When I click on "Future" "link" in the "Course overview" "block"
43 Then I should see "Course 5" in the "Course overview" "block"
44 And I should not see "Course 1" in the "Course overview" "block"
45 And I should not see "Course 2" in the "Course overview" "block"
46 And I should not see "Course 3" in the "Course overview" "block"
47 And I should not see "Course 4" in the "Course overview" "block"
e4b4b9e7
BB
48
49 Scenario: View inprogress courses
50 Given I log in as "student1"
74d7ab50 51 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e4b4b9e7
BB
52 When I click on "In progress" "link" in the "Course overview" "block"
53 Then I should see "Course 2" in the "Course overview" "block"
54 Then I should see "Course 3" in the "Course overview" "block"
55 Then I should see "Course 4" in the "Course overview" "block"
56 And I should not see "Course 1" in the "Course overview" "block"
57 And I should not see "Course 5" in the "Course overview" "block"
e4b4b9e7 58
74d7ab50 59 Scenario: View all (except removed) courses
e4b4b9e7 60 Given I log in as "student1"
74d7ab50
NM
61 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
62 When I click on "All (except removed from view)" "link" in the "Course overview" "block"
cd4abbc7
AB
63 Then I should see "Course 1" in the "Course overview" "block"
64 Then I should see "Course 2" in the "Course overview" "block"
65 Then I should see "Course 3" in the "Course overview" "block"
66 Then I should see "Course 4" in the "Course overview" "block"
67 Then I should see "Course 5" in the "Course overview" "block"
cd4abbc7 68
74d7ab50 69 Scenario: View all (including removed) courses
2276614c
AB
70 Given the following config values are set as admin:
71 | config | value | plugin |
72 | displaygroupingallincludinghidden | 1 | block_myoverview |
73 And I log in as "student1"
74d7ab50
NM
74 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
75 # We have to click on the data attribute instead of the button element text as we might risk to click on the false positive "All (except removed from view)" element instead
cd4abbc7 76 When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
e4b4b9e7
BB
77 Then I should see "Course 1" in the "Course overview" "block"
78 Then I should see "Course 2" in the "Course overview" "block"
79 Then I should see "Course 3" in the "Course overview" "block"
80 Then I should see "Course 4" in the "Course overview" "block"
81 Then I should see "Course 5" in the "Course overview" "block"
3cfff885
BB
82
83 Scenario: View inprogress courses - test persistence
84 Given I log in as "student1"
74d7ab50 85 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
3cfff885
BB
86 And I click on "In progress" "link" in the "Course overview" "block"
87 And I reload the page
88 Then I should see "In progress" in the "Course overview" "block"
89 Then I should see "Course 2" in the "Course overview" "block"
90 Then I should see "Course 3" in the "Course overview" "block"
91 Then I should see "Course 4" in the "Course overview" "block"
92 And I should not see "Course 1" in the "Course overview" "block"
93 And I should not see "Course 5" in the "Course overview" "block"
3cfff885 94
74d7ab50 95 Scenario: View all (except removed) courses - w/ persistence
3cfff885 96 Given I log in as "student1"
74d7ab50
NM
97 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
98 When I click on "All (except removed from view)" "link" in the "Course overview" "block"
3cfff885 99 And I reload the page
74d7ab50 100 Then I should see "All (except removed from view)" in the "Course overview" "block"
3cfff885
BB
101 Then I should see "Course 1" in the "Course overview" "block"
102 Then I should see "Course 2" in the "Course overview" "block"
103 Then I should see "Course 3" in the "Course overview" "block"
104 Then I should see "Course 4" in the "Course overview" "block"
105 Then I should see "Course 5" in the "Course overview" "block"
3cfff885
BB
106
107 Scenario: View past courses - w/ persistence
108 Given I log in as "student1"
74d7ab50 109 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
3cfff885
BB
110 When I click on "Past" "link" in the "Course overview" "block"
111 And I reload the page
112 Then I should see "Past" in the "Course overview" "block"
113 Then I should see "Course 1" in the "Course overview" "block"
114 And I should not see "Course 2" in the "Course overview" "block"
115 And I should not see "Course 3" in the "Course overview" "block"
116 And I should not see "Course 4" in the "Course overview" "block"
117 And I should not see "Course 5" in the "Course overview" "block"
3cfff885
BB
118
119 Scenario: View future courses - w/ persistence
120 Given I log in as "student1"
74d7ab50 121 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
3cfff885
BB
122 When I click on "Future" "link" in the "Course overview" "block"
123 And I reload the page
124 Then I should see "Future" in the "Course overview" "block"
125 Then I should see "Course 5" in the "Course overview" "block"
126 And I should not see "Course 1" in the "Course overview" "block"
127 And I should not see "Course 2" in the "Course overview" "block"
128 And I should not see "Course 3" in the "Course overview" "block"
129 And I should not see "Course 4" in the "Course overview" "block"
3cfff885 130
2d2189ae
EM
131 Scenario: View favourite courses - w/ persistence
132 Given I log in as "student1"
133 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
134 And I click on "Star this course" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
135 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
136 When I click on "Starred" "link" in the "Course overview" "block"
137 And I reload the page
138 Then I should see "Starred" in the "Course overview" "block"
139 And I should see "Course 2" in the "Course overview" "block"
140 And I should not see "Course 1" in the "Course overview" "block"
141 And I should not see "Course 3" in the "Course overview" "block"
142 And I should not see "Course 4" in the "Course overview" "block"
143 And I should not see "Course 5" in the "Course overview" "block"
144
3cfff885
BB
145 Scenario: List display persistence
146 Given I log in as "student1"
60f59e55 147 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
3cfff885
BB
148 And I click on "List" "link" in the "Course overview" "block"
149 And I reload the page
150 Then I should see "List" in the "Course overview" "block"
151 And "[data-display='list']" "css_element" in the "Course overview" "block" should be visible
152
153 Scenario: Cards display persistence
154 Given I log in as "student1"
60f59e55 155 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
3cfff885
BB
156 And I click on "Card" "link" in the "Course overview" "block"
157 And I reload the page
158 Then I should see "Card" in the "Course overview" "block"
a3f25405 159 And "[data-display='card']" "css_element" in the "Course overview" "block" should be visible
3cfff885
BB
160
161 Scenario: Summary display persistence
162 Given I log in as "student1"
60f59e55 163 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
3cfff885
BB
164 And I click on "Summary" "link" in the "Course overview" "block"
165 And I reload the page
166 Then I should see "Summary" in the "Course overview" "block"
167 And "[data-display='summary']" "css_element" in the "Course overview" "block" should be visible
168
d82cc9f2 169 Scenario: Course name sort persistence
3cfff885
BB
170 Given I log in as "student1"
171 And I click on "sortingdropdown" "button" in the "Course overview" "block"
d82cc9f2 172 And I click on "Course name" "link" in the "Course overview" "block"
3cfff885 173 And I reload the page
d82cc9f2 174 Then I should see "Course name" in the "Course overview" "block"
3cfff885
BB
175 And "[data-sort='fullname']" "css_element" in the "Course overview" "block" should be visible
176
177 Scenario: Last accessed sort persistence
178 Given I log in as "student1"
179 And I click on "sortingdropdown" "button" in the "Course overview" "block"
180 And I click on "Last accessed" "link" in the "Course overview" "block"
181 And I reload the page
182 Then I should see "Last accessed" in the "Course overview" "block"
e6f03948
P
183 And "[data-sort='ul.timeaccess desc']" "css_element" in the "Course overview" "block" should be visible
184
ad2ef9dd 185 Scenario: Short name sort persistence
186 Given I log in as "student1"
187 When I click on "sortingdropdown" "button" in the "Course overview" "block"
188 Then I should not see "Short name" in the "Course overview" "block"
189 When the following config values are set as admin:
190 | config | value |
191 | courselistshortnames | 1 |
192 And I reload the page
193 And I click on "sortingdropdown" "button" in the "Course overview" "block"
194 And I click on "Short name" "link" in the "Course overview" "block"
195 And I reload the page
196 Then I should see "Short name" in the "Course overview" "block"
197 And "[data-sort='shortname']" "css_element" in the "Course overview" "block" should be visible
198
e6f03948
P
199 Scenario: View inprogress courses with hide persistent functionality
200 Given I log in as "student1"
74d7ab50 201 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e6f03948 202 When I click on "In progress" "link" in the "Course overview" "block"
c896546c 203 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
74d7ab50 204 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
e6f03948
P
205 And I reload the page
206 Then I should see "Course 3" in the "Course overview" "block"
207 Then I should see "Course 4" in the "Course overview" "block"
208 And I should not see "Course 2" 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"
e6f03948
P
211
212 Scenario: View past courses with hide persistent functionality
213 Given I log in as "student1"
74d7ab50 214 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e6f03948 215 When I click on "Past" "link" in the "Course overview" "block"
c896546c 216 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
74d7ab50 217 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
e6f03948
P
218 And I reload the page
219 Then I should not see "Course 1" in the "Course overview" "block"
220 And I should not see "Course 2" in the "Course overview" "block"
221 And I should not see "Course 3" in the "Course overview" "block"
222 And I should not see "Course 4" in the "Course overview" "block"
223 And I should not see "Course 5" in the "Course overview" "block"
e6f03948
P
224
225 Scenario: View future courses with hide persistent functionality
226 Given I log in as "student1"
74d7ab50 227 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e6f03948 228 When I click on "Future" "link" in the "Course overview" "block"
c896546c 229 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
74d7ab50 230 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
e6f03948
P
231 And I reload the page
232 Then I should not see "Course 5" in the "Course overview" "block"
233 And I should not see "Course 1" in the "Course overview" "block"
234 And I should not see "Course 2" in the "Course overview" "block"
235 And I should not see "Course 3" in the "Course overview" "block"
236 And I should not see "Course 4" in the "Course overview" "block"
d657d80d 237
cd4abbc7
AB
238 Scenario: View all (except hidden) courses with hide persistent functionality
239 Given I log in as "student1"
74d7ab50
NM
240 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
241 When I click on "All (except removed from view)" "link" in the "Course overview" "block"
cd4abbc7 242 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
74d7ab50 243 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
cd4abbc7
AB
244 And I reload the page
245 Then I should not see "Course 5" in the "Course overview" "block"
246 And I should see "Course 1" in the "Course overview" "block"
247 And I should see "Course 2" in the "Course overview" "block"
248 And I should see "Course 3" in the "Course overview" "block"
249 And I should see "Course 4" in the "Course overview" "block"
cd4abbc7 250
74d7ab50 251 Scenario: View all (including removed) courses with hide persistent functionality
2276614c
AB
252 Given the following config values are set as admin:
253 | config | value | plugin |
254 | displaygroupingallincludinghidden | 1 | block_myoverview |
255 And I log in as "student1"
74d7ab50
NM
256 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
257 # We have to click on the data attribute instead of the button element text as we might risk to click on the false positive "All (except removed from view)" element instead
cd4abbc7
AB
258 When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
259 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
74d7ab50 260 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
cd4abbc7
AB
261 And I reload the page
262 Then I should see "Course 5" in the "Course overview" "block"
263 And I should see "Course 1" in the "Course overview" "block"
264 And I should see "Course 2" in the "Course overview" "block"
265 And I should see "Course 3" in the "Course overview" "block"
266 And I should see "Course 4" in the "Course overview" "block"
cd4abbc7 267
d657d80d 268 Scenario: Show course category in cards display
93ad530e
MG
269 Given the following config values are set as admin:
270 | displaycategories | 1 | block_myoverview |
271 And I log in as "student1"
60f59e55 272 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
273 When I click on "Card" "link" in the "Course overview" "block"
274 Then I should see "Category 1" in the "Course overview" "block"
275
276 Scenario: Show course category in list display
93ad530e
MG
277 Given the following config values are set as admin:
278 | displaycategories | 1 | block_myoverview |
279 And I log in as "student1"
60f59e55 280 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
281 When I click on "List" "link" in the "Course overview" "block"
282 Then I should see "Category 1" in the "Course overview" "block"
283
284 Scenario: Show course category in summary display
93ad530e
MG
285 Given the following config values are set as admin:
286 | displaycategories | 1 | block_myoverview |
287 And I log in as "student1"
60f59e55 288 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
289 When I click on "Summary" "link" in the "Course overview" "block"
290 Then I should see "Category 1" in the "Course overview" "block"
93ad530e
MG
291
292 Scenario: Hide course category in cards display
293 Given the following config values are set as admin:
294 | displaycategories | 0 | block_myoverview |
295 And I log in as "student1"
296 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
297 When I click on "Card" "link" in the "Course overview" "block"
298 Then I should not see "Category 1" in the "Course overview" "block"
299
300 Scenario: Hide course category in list display
301 Given the following config values are set as admin:
302 | displaycategories | 0 | block_myoverview |
303 And I log in as "student1"
304 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
305 When I click on "List" "link" in the "Course overview" "block"
306 Then I should not see "Category 1" in the "Course overview" "block"
307
308 Scenario: Show course category in summary display
309 Given the following config values are set as admin:
310 | displaycategories | 0 | block_myoverview |
311 And I log in as "student1"
312 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
313 When I click on "Summary" "link" in the "Course overview" "block"
314 Then I should not see "Category 1" in the "Course overview" "block"
191de5fe
JP
315
316 @accessibility
317 Scenario: The dashboard page must have sufficient colour contrast
318 When I log in as "student1"
319 Then the page should meet "wcag143" accessibility standards