weekly release 3.8dev
[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
2276614c
AB
74 Given the following config values are set as admin:
75 | config | value | plugin |
76 | displaygroupingallincludinghidden | 1 | block_myoverview |
77 And I log in as "student1"
cd4abbc7
AB
78 And I click on "All (except hidden)" "button" in the "Course overview" "block"
79 # 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
80 When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
e4b4b9e7
BB
81 Then I should see "Course 1" in the "Course overview" "block"
82 Then I should see "Course 2" in the "Course overview" "block"
83 Then I should see "Course 3" in the "Course overview" "block"
84 Then I should see "Course 4" in the "Course overview" "block"
85 Then I should see "Course 5" in the "Course overview" "block"
3cfff885
BB
86 And I log out
87
88 Scenario: View inprogress courses - test persistence
89 Given I log in as "student1"
cd4abbc7 90 And I click on "All (except hidden)" "button" in the "Course overview" "block"
3cfff885
BB
91 And I click on "In progress" "link" in the "Course overview" "block"
92 And I reload the page
93 Then I should see "In progress" in the "Course overview" "block"
94 Then I should see "Course 2" in the "Course overview" "block"
95 Then I should see "Course 3" in the "Course overview" "block"
96 Then I should see "Course 4" in the "Course overview" "block"
97 And I should not see "Course 1" in the "Course overview" "block"
98 And I should not see "Course 5" in the "Course overview" "block"
99 And I log out
100
cd4abbc7 101 Scenario: View all (except hidden) courses - w/ persistence
3cfff885 102 Given I log in as "student1"
cd4abbc7
AB
103 And I click on "All (except hidden)" "button" in the "Course overview" "block"
104 When I click on "All (except hidden)" "link" in the "Course overview" "block"
3cfff885 105 And I reload the page
cd4abbc7 106 Then I should see "All (except hidden)" in the "Course overview" "block"
3cfff885
BB
107 Then I should see "Course 1" in the "Course overview" "block"
108 Then I should see "Course 2" in the "Course overview" "block"
109 Then I should see "Course 3" in the "Course overview" "block"
110 Then I should see "Course 4" in the "Course overview" "block"
111 Then I should see "Course 5" in the "Course overview" "block"
112 And I log out
113
114 Scenario: View past courses - w/ persistence
115 Given I log in as "student1"
cd4abbc7 116 And I click on "All (except hidden)" "button" in the "Course overview" "block"
3cfff885
BB
117 When I click on "Past" "link" in the "Course overview" "block"
118 And I reload the page
119 Then I should see "Past" in the "Course overview" "block"
120 Then I should see "Course 1" in the "Course overview" "block"
121 And I should not see "Course 2" in the "Course overview" "block"
122 And I should not see "Course 3" in the "Course overview" "block"
123 And I should not see "Course 4" in the "Course overview" "block"
124 And I should not see "Course 5" in the "Course overview" "block"
125 And I log out
126
127 Scenario: View future courses - w/ persistence
128 Given I log in as "student1"
cd4abbc7 129 And I click on "All (except hidden)" "button" in the "Course overview" "block"
3cfff885
BB
130 When I click on "Future" "link" in the "Course overview" "block"
131 And I reload the page
132 Then I should see "Future" in the "Course overview" "block"
133 Then I should see "Course 5" in the "Course overview" "block"
134 And I should not see "Course 1" in the "Course overview" "block"
135 And I should not see "Course 2" in the "Course overview" "block"
136 And I should not see "Course 3" in the "Course overview" "block"
137 And I should not see "Course 4" in the "Course overview" "block"
138 And I log out
139
140 Scenario: List display persistence
141 Given I log in as "student1"
60f59e55 142 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
3cfff885
BB
143 And I click on "List" "link" in the "Course overview" "block"
144 And I reload the page
145 Then I should see "List" in the "Course overview" "block"
146 And "[data-display='list']" "css_element" in the "Course overview" "block" should be visible
147
148 Scenario: Cards display persistence
149 Given I log in as "student1"
60f59e55 150 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
3cfff885
BB
151 And I click on "Card" "link" in the "Course overview" "block"
152 And I reload the page
153 Then I should see "Card" in the "Course overview" "block"
a3f25405 154 And "[data-display='card']" "css_element" in the "Course overview" "block" should be visible
3cfff885
BB
155
156 Scenario: Summary display persistence
157 Given I log in as "student1"
60f59e55 158 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
3cfff885
BB
159 And I click on "Summary" "link" in the "Course overview" "block"
160 And I reload the page
161 Then I should see "Summary" in the "Course overview" "block"
162 And "[data-display='summary']" "css_element" in the "Course overview" "block" should be visible
163
d82cc9f2 164 Scenario: Course name sort persistence
3cfff885
BB
165 Given I log in as "student1"
166 And I click on "sortingdropdown" "button" in the "Course overview" "block"
d82cc9f2 167 And I click on "Course name" "link" in the "Course overview" "block"
3cfff885 168 And I reload the page
d82cc9f2 169 Then I should see "Course name" in the "Course overview" "block"
3cfff885
BB
170 And "[data-sort='fullname']" "css_element" in the "Course overview" "block" should be visible
171
172 Scenario: Last accessed sort persistence
173 Given I log in as "student1"
174 And I click on "sortingdropdown" "button" in the "Course overview" "block"
175 And I click on "Last accessed" "link" in the "Course overview" "block"
176 And I reload the page
177 Then I should see "Last accessed" in the "Course overview" "block"
e6f03948
P
178 And "[data-sort='ul.timeaccess desc']" "css_element" in the "Course overview" "block" should be visible
179
180 Scenario: View inprogress courses with hide persistent functionality
181 Given I log in as "student1"
cd4abbc7 182 And I click on "All (except hidden)" "button" in the "Course overview" "block"
e6f03948 183 When I click on "In progress" "link" in the "Course overview" "block"
c896546c
P
184 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
185 And I click on "Hide from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
e6f03948
P
186 And I reload the page
187 Then I should see "Course 3" in the "Course overview" "block"
188 Then I should see "Course 4" in the "Course overview" "block"
189 And I should not see "Course 2" in the "Course overview" "block"
190 And I should not see "Course 1" in the "Course overview" "block"
191 And I should not see "Course 5" in the "Course overview" "block"
192 And I log out
193
194 Scenario: View past courses with hide persistent functionality
195 Given I log in as "student1"
cd4abbc7 196 And I click on "All (except hidden)" "button" in the "Course overview" "block"
e6f03948 197 When I click on "Past" "link" in the "Course overview" "block"
c896546c
P
198 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
199 And I click on "Hide from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
e6f03948
P
200 And I reload the page
201 Then I should not see "Course 1" in the "Course overview" "block"
202 And I should not see "Course 2" in the "Course overview" "block"
203 And I should not see "Course 3" in the "Course overview" "block"
204 And I should not see "Course 4" in the "Course overview" "block"
205 And I should not see "Course 5" in the "Course overview" "block"
206 And I log out
207
208 Scenario: View future courses with hide persistent functionality
209 Given I log in as "student1"
cd4abbc7 210 And I click on "All (except hidden)" "button" in the "Course overview" "block"
e6f03948 211 When I click on "Future" "link" in the "Course overview" "block"
c896546c
P
212 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
213 And I click on "Hide from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
e6f03948
P
214 And I reload the page
215 Then I should not see "Course 5" in the "Course overview" "block"
216 And I should not see "Course 1" in the "Course overview" "block"
217 And I should not see "Course 2" in the "Course overview" "block"
218 And I should not see "Course 3" in the "Course overview" "block"
219 And I should not see "Course 4" in the "Course overview" "block"
220 And I log out
d657d80d 221
cd4abbc7
AB
222 Scenario: View all (except hidden) courses with hide persistent functionality
223 Given I log in as "student1"
224 And I click on "All (except hidden)" "button" in the "Course overview" "block"
225 When I click on "All (except hidden)" "link" in the "Course overview" "block"
226 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
227 And I click on "Hide from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
228 And I reload the page
229 Then I should not see "Course 5" in the "Course overview" "block"
230 And I should see "Course 1" in the "Course overview" "block"
231 And I should see "Course 2" in the "Course overview" "block"
232 And I should see "Course 3" in the "Course overview" "block"
233 And I should see "Course 4" in the "Course overview" "block"
234 And I log out
235
236 Scenario: View all (including hidden) courses with hide persistent functionality
2276614c
AB
237 Given the following config values are set as admin:
238 | config | value | plugin |
239 | displaygroupingallincludinghidden | 1 | block_myoverview |
240 And I log in as "student1"
cd4abbc7
AB
241 And I click on "All (except hidden)" "button" in the "Course overview" "block"
242 # 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
243 When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
244 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
245 And I click on "Hide from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
246 And I reload the page
247 Then I should see "Course 5" in the "Course overview" "block"
248 And I should see "Course 1" in the "Course overview" "block"
249 And I should see "Course 2" in the "Course overview" "block"
250 And I should see "Course 3" in the "Course overview" "block"
251 And I should see "Course 4" in the "Course overview" "block"
252 And I log out
253
d657d80d
MG
254 Scenario: Show course category in cards 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 "Card" "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 list 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 "List" "link" in the "Course overview" "block"
264 Then I should see "Category 1" in the "Course overview" "block"
265
266 Scenario: Show course category in summary display
267 Given I log in as "student1"
60f59e55 268 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
269 When I click on "Summary" "link" in the "Course overview" "block"
270 Then I should see "Category 1" in the "Course overview" "block"