weekly release 3.9dev
[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
185 Scenario: View inprogress courses with hide persistent functionality
186 Given I log in as "student1"
74d7ab50 187 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e6f03948 188 When I click on "In progress" "link" in the "Course overview" "block"
c896546c 189 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
74d7ab50 190 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
e6f03948
P
191 And I reload the page
192 Then I should see "Course 3" in the "Course overview" "block"
193 Then I should see "Course 4" in the "Course overview" "block"
194 And I should not see "Course 2" in the "Course overview" "block"
195 And I should not see "Course 1" in the "Course overview" "block"
196 And I should not see "Course 5" in the "Course overview" "block"
e6f03948
P
197
198 Scenario: View past courses with hide persistent functionality
199 Given I log in as "student1"
74d7ab50 200 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e6f03948 201 When I click on "Past" "link" in the "Course overview" "block"
c896546c 202 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
74d7ab50 203 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
e6f03948
P
204 And I reload the page
205 Then I should not see "Course 1" in the "Course overview" "block"
206 And I should not see "Course 2" in the "Course overview" "block"
207 And I should not see "Course 3" in the "Course overview" "block"
208 And I should not see "Course 4" in the "Course overview" "block"
209 And I should not see "Course 5" in the "Course overview" "block"
e6f03948
P
210
211 Scenario: View future courses with hide persistent functionality
212 Given I log in as "student1"
74d7ab50 213 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e6f03948 214 When I click on "Future" "link" in the "Course overview" "block"
c896546c 215 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
74d7ab50 216 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
e6f03948
P
217 And I reload the page
218 Then I should not see "Course 5" in the "Course overview" "block"
219 And 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"
d657d80d 223
cd4abbc7
AB
224 Scenario: View all (except hidden) courses with hide persistent functionality
225 Given I log in as "student1"
74d7ab50
NM
226 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
227 When I click on "All (except removed from view)" "link" in the "Course overview" "block"
cd4abbc7 228 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
74d7ab50 229 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
cd4abbc7
AB
230 And I reload the page
231 Then I should not see "Course 5" in the "Course overview" "block"
232 And I should see "Course 1" in the "Course overview" "block"
233 And I should see "Course 2" in the "Course overview" "block"
234 And I should see "Course 3" in the "Course overview" "block"
235 And I should see "Course 4" in the "Course overview" "block"
cd4abbc7 236
74d7ab50 237 Scenario: View all (including removed) courses with hide persistent functionality
2276614c
AB
238 Given the following config values are set as admin:
239 | config | value | plugin |
240 | displaygroupingallincludinghidden | 1 | block_myoverview |
241 And I log in as "student1"
74d7ab50
NM
242 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
243 # 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
244 When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
245 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
74d7ab50 246 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
cd4abbc7
AB
247 And I reload the page
248 Then I should see "Course 5" in the "Course overview" "block"
249 And I should see "Course 1" in the "Course overview" "block"
250 And I should see "Course 2" in the "Course overview" "block"
251 And I should see "Course 3" in the "Course overview" "block"
252 And I should see "Course 4" in the "Course overview" "block"
cd4abbc7 253
d657d80d 254 Scenario: Show course category in cards display
93ad530e
MG
255 Given the following config values are set as admin:
256 | displaycategories | 1 | block_myoverview |
257 And I log in as "student1"
60f59e55 258 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
259 When I click on "Card" "link" in the "Course overview" "block"
260 Then I should see "Category 1" in the "Course overview" "block"
261
262 Scenario: Show course category in list display
93ad530e
MG
263 Given the following config values are set as admin:
264 | displaycategories | 1 | block_myoverview |
265 And I log in as "student1"
60f59e55 266 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
267 When I click on "List" "link" in the "Course overview" "block"
268 Then I should see "Category 1" in the "Course overview" "block"
269
270 Scenario: Show course category in summary display
93ad530e
MG
271 Given the following config values are set as admin:
272 | displaycategories | 1 | block_myoverview |
273 And I log in as "student1"
60f59e55 274 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
275 When I click on "Summary" "link" in the "Course overview" "block"
276 Then I should see "Category 1" in the "Course overview" "block"
93ad530e
MG
277
278 Scenario: Hide course category in cards display
279 Given the following config values are set as admin:
280 | displaycategories | 0 | block_myoverview |
281 And I log in as "student1"
282 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
283 When I click on "Card" "link" in the "Course overview" "block"
284 Then I should not see "Category 1" in the "Course overview" "block"
285
286 Scenario: Hide course category in list display
287 Given the following config values are set as admin:
288 | displaycategories | 0 | block_myoverview |
289 And I log in as "student1"
290 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
291 When I click on "List" "link" in the "Course overview" "block"
292 Then I should not see "Category 1" in the "Course overview" "block"
293
294 Scenario: Show course category in summary display
295 Given the following config values are set as admin:
296 | displaycategories | 0 | block_myoverview |
297 And I log in as "student1"
298 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
299 When I click on "Summary" "link" in the "Course overview" "block"
300 Then I should not see "Category 1" in the "Course overview" "block"