MDL-66016 block_myoverview: Add 'All' course filter
[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"
cd4abbc7 31 And I click on "All (except hidden)" "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"
38 And I log out
39
40 Scenario: View future courses
41 Given I log in as "student1"
cd4abbc7 42 And I click on "All (except hidden)" "button" in the "Course overview" "block"
e4b4b9e7
BB
43 When I click on "Future" "link" in the "Course overview" "block"
44 Then I should see "Course 5" in the "Course overview" "block"
45 And I should not see "Course 1" in the "Course overview" "block"
46 And I should not see "Course 2" in the "Course overview" "block"
47 And I should not see "Course 3" in the "Course overview" "block"
48 And I should not see "Course 4" in the "Course overview" "block"
1dc764a6 49 And I log out
e4b4b9e7
BB
50
51 Scenario: View inprogress courses
52 Given I log in as "student1"
cd4abbc7 53 And I click on "All (except hidden)" "button" in the "Course overview" "block"
e4b4b9e7
BB
54 When I click on "In progress" "link" in the "Course overview" "block"
55 Then I should see "Course 2" in the "Course overview" "block"
56 Then I should see "Course 3" in the "Course overview" "block"
57 Then I should see "Course 4" in the "Course overview" "block"
58 And I should not see "Course 1" in the "Course overview" "block"
59 And I should not see "Course 5" in the "Course overview" "block"
60 And I log out
61
cd4abbc7 62 Scenario: View all (except hidden) courses
e4b4b9e7 63 Given I log in as "student1"
cd4abbc7
AB
64 And I click on "All (except hidden)" "button" in the "Course overview" "block"
65 When I click on "All (except hidden)" "link" in the "Course overview" "block"
66 Then I should see "Course 1" in the "Course overview" "block"
67 Then I should see "Course 2" in the "Course overview" "block"
68 Then I should see "Course 3" in the "Course overview" "block"
69 Then I should see "Course 4" in the "Course overview" "block"
70 Then I should see "Course 5" in the "Course overview" "block"
71 And I log out
72
73 Scenario: View all (including hidden) courses
74 Given I log in as "student1"
75 And I click on "All (except hidden)" "button" in the "Course overview" "block"
76 # 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 hidden)" element instead
77 When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
e4b4b9e7
BB
78 Then I should see "Course 1" in the "Course overview" "block"
79 Then I should see "Course 2" in the "Course overview" "block"
80 Then I should see "Course 3" in the "Course overview" "block"
81 Then I should see "Course 4" in the "Course overview" "block"
82 Then I should see "Course 5" in the "Course overview" "block"
3cfff885
BB
83 And I log out
84
85 Scenario: View inprogress courses - test persistence
86 Given I log in as "student1"
cd4abbc7 87 And I click on "All (except hidden)" "button" in the "Course overview" "block"
3cfff885
BB
88 And I click on "In progress" "link" in the "Course overview" "block"
89 And I reload the page
90 Then I should see "In progress" in the "Course overview" "block"
91 Then I should see "Course 2" in the "Course overview" "block"
92 Then I should see "Course 3" in the "Course overview" "block"
93 Then I should see "Course 4" in the "Course overview" "block"
94 And I should not see "Course 1" in the "Course overview" "block"
95 And I should not see "Course 5" in the "Course overview" "block"
96 And I log out
97
cd4abbc7 98 Scenario: View all (except hidden) courses - w/ persistence
3cfff885 99 Given I log in as "student1"
cd4abbc7
AB
100 And I click on "All (except hidden)" "button" in the "Course overview" "block"
101 When I click on "All (except hidden)" "link" in the "Course overview" "block"
3cfff885 102 And I reload the page
cd4abbc7 103 Then I should see "All (except hidden)" in the "Course overview" "block"
3cfff885
BB
104 Then I should see "Course 1" in the "Course overview" "block"
105 Then I should see "Course 2" in the "Course overview" "block"
106 Then I should see "Course 3" in the "Course overview" "block"
107 Then I should see "Course 4" in the "Course overview" "block"
108 Then I should see "Course 5" in the "Course overview" "block"
109 And I log out
110
111 Scenario: View past courses - w/ persistence
112 Given I log in as "student1"
cd4abbc7 113 And I click on "All (except hidden)" "button" in the "Course overview" "block"
3cfff885
BB
114 When I click on "Past" "link" in the "Course overview" "block"
115 And I reload the page
116 Then I should see "Past" in the "Course overview" "block"
117 Then I should see "Course 1" in the "Course overview" "block"
118 And I should not see "Course 2" in the "Course overview" "block"
119 And I should not see "Course 3" in the "Course overview" "block"
120 And I should not see "Course 4" in the "Course overview" "block"
121 And I should not see "Course 5" in the "Course overview" "block"
122 And I log out
123
124 Scenario: View future courses - w/ persistence
125 Given I log in as "student1"
cd4abbc7 126 And I click on "All (except hidden)" "button" in the "Course overview" "block"
3cfff885
BB
127 When I click on "Future" "link" in the "Course overview" "block"
128 And I reload the page
129 Then I should see "Future" in the "Course overview" "block"
130 Then I should see "Course 5" in the "Course overview" "block"
131 And I should not see "Course 1" in the "Course overview" "block"
132 And I should not see "Course 2" in the "Course overview" "block"
133 And I should not see "Course 3" in the "Course overview" "block"
134 And I should not see "Course 4" in the "Course overview" "block"
135 And I log out
136
137 Scenario: List display persistence
138 Given I log in as "student1"
60f59e55 139 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
3cfff885
BB
140 And I click on "List" "link" in the "Course overview" "block"
141 And I reload the page
142 Then I should see "List" in the "Course overview" "block"
143 And "[data-display='list']" "css_element" in the "Course overview" "block" should be visible
144
145 Scenario: Cards 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 "Card" "link" in the "Course overview" "block"
149 And I reload the page
150 Then I should see "Card" in the "Course overview" "block"
a3f25405 151 And "[data-display='card']" "css_element" in the "Course overview" "block" should be visible
3cfff885
BB
152
153 Scenario: Summary 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 "Summary" "link" in the "Course overview" "block"
157 And I reload the page
158 Then I should see "Summary" in the "Course overview" "block"
159 And "[data-display='summary']" "css_element" in the "Course overview" "block" should be visible
160
d82cc9f2 161 Scenario: Course name sort persistence
3cfff885
BB
162 Given I log in as "student1"
163 And I click on "sortingdropdown" "button" in the "Course overview" "block"
d82cc9f2 164 And I click on "Course name" "link" in the "Course overview" "block"
3cfff885 165 And I reload the page
d82cc9f2 166 Then I should see "Course name" in the "Course overview" "block"
3cfff885
BB
167 And "[data-sort='fullname']" "css_element" in the "Course overview" "block" should be visible
168
169 Scenario: Last accessed sort persistence
170 Given I log in as "student1"
171 And I click on "sortingdropdown" "button" in the "Course overview" "block"
172 And I click on "Last accessed" "link" in the "Course overview" "block"
173 And I reload the page
174 Then I should see "Last accessed" in the "Course overview" "block"
e6f03948
P
175 And "[data-sort='ul.timeaccess desc']" "css_element" in the "Course overview" "block" should be visible
176
177 Scenario: View inprogress courses with hide persistent functionality
178 Given I log in as "student1"
cd4abbc7 179 And I click on "All (except hidden)" "button" in the "Course overview" "block"
e6f03948 180 When I click on "In progress" "link" in the "Course overview" "block"
c896546c
P
181 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
182 And I click on "Hide from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
e6f03948
P
183 And I reload the page
184 Then I should see "Course 3" in the "Course overview" "block"
185 Then I should see "Course 4" in the "Course overview" "block"
186 And I should not see "Course 2" in the "Course overview" "block"
187 And I should not see "Course 1" in the "Course overview" "block"
188 And I should not see "Course 5" in the "Course overview" "block"
189 And I log out
190
191 Scenario: View past courses with hide persistent functionality
192 Given I log in as "student1"
cd4abbc7 193 And I click on "All (except hidden)" "button" in the "Course overview" "block"
e6f03948 194 When I click on "Past" "link" in the "Course overview" "block"
c896546c
P
195 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
196 And I click on "Hide from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
e6f03948
P
197 And I reload the page
198 Then I should not see "Course 1" in the "Course overview" "block"
199 And I should not see "Course 2" in the "Course overview" "block"
200 And I should not see "Course 3" in the "Course overview" "block"
201 And I should not see "Course 4" in the "Course overview" "block"
202 And I should not see "Course 5" in the "Course overview" "block"
203 And I log out
204
205 Scenario: View future courses with hide persistent functionality
206 Given I log in as "student1"
cd4abbc7 207 And I click on "All (except hidden)" "button" in the "Course overview" "block"
e6f03948 208 When I click on "Future" "link" in the "Course overview" "block"
c896546c
P
209 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
210 And I click on "Hide from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
e6f03948
P
211 And I reload the page
212 Then I should not see "Course 5" in the "Course overview" "block"
213 And I should not see "Course 1" in the "Course overview" "block"
214 And I should not see "Course 2" in the "Course overview" "block"
215 And I should not see "Course 3" in the "Course overview" "block"
216 And I should not see "Course 4" in the "Course overview" "block"
217 And I log out
d657d80d 218
cd4abbc7
AB
219 Scenario: View all (except hidden) courses with hide persistent functionality
220 Given I log in as "student1"
221 And I click on "All (except hidden)" "button" in the "Course overview" "block"
222 When I click on "All (except hidden)" "link" in the "Course overview" "block"
223 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
224 And I click on "Hide from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
225 And I reload the page
226 Then I should not see "Course 5" in the "Course overview" "block"
227 And I should see "Course 1" in the "Course overview" "block"
228 And I should see "Course 2" in the "Course overview" "block"
229 And I should see "Course 3" in the "Course overview" "block"
230 And I should see "Course 4" in the "Course overview" "block"
231 And I log out
232
233 Scenario: View all (including hidden) courses with hide persistent functionality
234 Given I log in as "student1"
235 And I click on "All (except hidden)" "button" in the "Course overview" "block"
236 # 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 hidden)" element instead
237 When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
238 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
239 And I click on "Hide from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
240 And I reload the page
241 Then I should see "Course 5" in the "Course overview" "block"
242 And I should see "Course 1" in the "Course overview" "block"
243 And I should see "Course 2" in the "Course overview" "block"
244 And I should see "Course 3" in the "Course overview" "block"
245 And I should see "Course 4" in the "Course overview" "block"
246 And I log out
247
d657d80d
MG
248 Scenario: Show course category in cards display
249 Given I log in as "student1"
60f59e55 250 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
251 When I click on "Card" "link" in the "Course overview" "block"
252 Then I should see "Category 1" in the "Course overview" "block"
253
254 Scenario: Show course category in list display
255 Given I log in as "student1"
60f59e55 256 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
257 When I click on "List" "link" in the "Course overview" "block"
258 Then I should see "Category 1" in the "Course overview" "block"
259
260 Scenario: Show course category in summary display
261 Given I log in as "student1"
60f59e55 262 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
263 When I click on "Summary" "link" in the "Course overview" "block"
264 Then I should see "Category 1" in the "Course overview" "block"