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
BB
130
131 Scenario: List display persistence
132 Given I log in as "student1"
60f59e55 133 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
3cfff885
BB
134 And I click on "List" "link" in the "Course overview" "block"
135 And I reload the page
136 Then I should see "List" in the "Course overview" "block"
137 And "[data-display='list']" "css_element" in the "Course overview" "block" should be visible
138
139 Scenario: Cards display persistence
140 Given I log in as "student1"
60f59e55 141 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
3cfff885
BB
142 And I click on "Card" "link" in the "Course overview" "block"
143 And I reload the page
144 Then I should see "Card" in the "Course overview" "block"
a3f25405 145 And "[data-display='card']" "css_element" in the "Course overview" "block" should be visible
3cfff885
BB
146
147 Scenario: Summary display persistence
148 Given I log in as "student1"
60f59e55 149 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
3cfff885
BB
150 And I click on "Summary" "link" in the "Course overview" "block"
151 And I reload the page
152 Then I should see "Summary" in the "Course overview" "block"
153 And "[data-display='summary']" "css_element" in the "Course overview" "block" should be visible
154
d82cc9f2 155 Scenario: Course name sort persistence
3cfff885
BB
156 Given I log in as "student1"
157 And I click on "sortingdropdown" "button" in the "Course overview" "block"
d82cc9f2 158 And I click on "Course name" "link" in the "Course overview" "block"
3cfff885 159 And I reload the page
d82cc9f2 160 Then I should see "Course name" in the "Course overview" "block"
3cfff885
BB
161 And "[data-sort='fullname']" "css_element" in the "Course overview" "block" should be visible
162
163 Scenario: Last accessed sort persistence
164 Given I log in as "student1"
165 And I click on "sortingdropdown" "button" in the "Course overview" "block"
166 And I click on "Last accessed" "link" in the "Course overview" "block"
167 And I reload the page
168 Then I should see "Last accessed" in the "Course overview" "block"
e6f03948
P
169 And "[data-sort='ul.timeaccess desc']" "css_element" in the "Course overview" "block" should be visible
170
171 Scenario: View inprogress courses with hide persistent functionality
172 Given I log in as "student1"
74d7ab50 173 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e6f03948 174 When I click on "In progress" "link" in the "Course overview" "block"
c896546c 175 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
74d7ab50 176 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 2')]" "xpath_element"
e6f03948
P
177 And I reload the page
178 Then I should see "Course 3" in the "Course overview" "block"
179 Then I should see "Course 4" in the "Course overview" "block"
180 And I should not see "Course 2" in the "Course overview" "block"
181 And I should not see "Course 1" in the "Course overview" "block"
182 And I should not see "Course 5" in the "Course overview" "block"
e6f03948
P
183
184 Scenario: View past courses with hide persistent functionality
185 Given I log in as "student1"
74d7ab50 186 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e6f03948 187 When I click on "Past" "link" in the "Course overview" "block"
c896546c 188 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
74d7ab50 189 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 1')]" "xpath_element"
e6f03948
P
190 And I reload the page
191 Then I should not see "Course 1" in the "Course overview" "block"
192 And I should not see "Course 2" in the "Course overview" "block"
193 And I should not see "Course 3" in the "Course overview" "block"
194 And I should not see "Course 4" in the "Course overview" "block"
195 And I should not see "Course 5" in the "Course overview" "block"
e6f03948
P
196
197 Scenario: View future courses with hide persistent functionality
198 Given I log in as "student1"
74d7ab50 199 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
e6f03948 200 When I click on "Future" "link" in the "Course overview" "block"
c896546c 201 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
74d7ab50 202 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
e6f03948
P
203 And I reload the page
204 Then I should not see "Course 5" in the "Course overview" "block"
205 And 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"
d657d80d 209
cd4abbc7
AB
210 Scenario: View all (except hidden) courses with hide persistent functionality
211 Given I log in as "student1"
74d7ab50
NM
212 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
213 When I click on "All (except removed from view)" "link" in the "Course overview" "block"
cd4abbc7 214 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
74d7ab50 215 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
cd4abbc7
AB
216 And I reload the page
217 Then I should not see "Course 5" in the "Course overview" "block"
218 And I should see "Course 1" in the "Course overview" "block"
219 And I should see "Course 2" in the "Course overview" "block"
220 And I should see "Course 3" in the "Course overview" "block"
221 And I should see "Course 4" in the "Course overview" "block"
cd4abbc7 222
74d7ab50 223 Scenario: View all (including removed) courses with hide persistent functionality
2276614c
AB
224 Given the following config values are set as admin:
225 | config | value | plugin |
226 | displaygroupingallincludinghidden | 1 | block_myoverview |
227 And I log in as "student1"
74d7ab50
NM
228 And I click on "All (except removed from view)" "button" in the "Course overview" "block"
229 # 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
230 When I click on "[data-value='allincludinghidden']" "css_element" in the "Course overview" "block"
231 And I click on ".coursemenubtn" "css_element" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
74d7ab50 232 And I click on "Remove from view" "link" in the "//div[@class='card dashboard-card' and contains(.,'Course 5')]" "xpath_element"
cd4abbc7
AB
233 And I reload the page
234 Then I should see "Course 5" in the "Course overview" "block"
235 And I should see "Course 1" in the "Course overview" "block"
236 And I should see "Course 2" in the "Course overview" "block"
237 And I should see "Course 3" in the "Course overview" "block"
238 And I should see "Course 4" in the "Course overview" "block"
cd4abbc7 239
d657d80d 240 Scenario: Show course category in cards display
93ad530e
MG
241 Given the following config values are set as admin:
242 | displaycategories | 1 | block_myoverview |
243 And I log in as "student1"
60f59e55 244 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
245 When I click on "Card" "link" in the "Course overview" "block"
246 Then I should see "Category 1" in the "Course overview" "block"
247
248 Scenario: Show course category in list display
93ad530e
MG
249 Given the following config values are set as admin:
250 | displaycategories | 1 | block_myoverview |
251 And I log in as "student1"
60f59e55 252 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
253 When I click on "List" "link" in the "Course overview" "block"
254 Then I should see "Category 1" in the "Course overview" "block"
255
256 Scenario: Show course category in summary display
93ad530e
MG
257 Given the following config values are set as admin:
258 | displaycategories | 1 | block_myoverview |
259 And I log in as "student1"
60f59e55 260 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
d657d80d
MG
261 When I click on "Summary" "link" in the "Course overview" "block"
262 Then I should see "Category 1" in the "Course overview" "block"
93ad530e
MG
263
264 Scenario: Hide course category in cards display
265 Given the following config values are set as admin:
266 | displaycategories | 0 | block_myoverview |
267 And I log in as "student1"
268 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
269 When I click on "Card" "link" in the "Course overview" "block"
270 Then I should not see "Category 1" in the "Course overview" "block"
271
272 Scenario: Hide course category in list display
273 Given the following config values are set as admin:
274 | displaycategories | 0 | block_myoverview |
275 And I log in as "student1"
276 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
277 When I click on "List" "link" in the "Course overview" "block"
278 Then I should not see "Category 1" in the "Course overview" "block"
279
280 Scenario: Show course category in summary display
281 Given the following config values are set as admin:
282 | displaycategories | 0 | block_myoverview |
283 And I log in as "student1"
284 And I click on "Display drop-down menu" "button" in the "Course overview" "block"
285 When I click on "Summary" "link" in the "Course overview" "block"
286 Then I should not see "Category 1" in the "Course overview" "block"