2 Feature: Course category management interface performs as expected
3 In order to test JS enhanced display of categories and subcategories.
5 I need to expand and collapse categories.
8 Scenario: Test general look of management interface
9 Given the following "categories" exist:
10 | name | category | idnumber |
12 And I log in as "admin"
13 And I go to the courses management page
14 And I should see "Course and category management" in the "h2" "css_element"
15 And I should see "Course categories" in the ".view-mode-selector" "css_element"
16 And I should see "Course categories" in the "h3" "css_element"
17 And I should see the "Course categories" management page
20 Scenario: Test view mode functionality
21 Given the following "categories" exist:
22 | name | category | idnumber |
24 And the following "courses" exist:
25 | fullname | shortname | category | format |
26 | Course 1 | C1 | CAT1 | topics |
28 And I log in as "admin"
29 And I go to the courses management page
30 And I should see the "Course categories" management page
31 And I should see "Course categories" in the "#category-listing h3" "css_element"
32 And I should see "Cat 1" in the "#category-listing" "css_element"
33 And I should see "Course categories" in the ".view-mode-selector" "css_element"
34 And I should not see "Course categories and courses" in the ".view-mode-selector .menu" "css_element"
35 And I should not see "Course categories" in the ".view-mode-selector .menu" "css_element"
36 And I should not see "Courses" in the ".view-mode-selector .menu" "css_element"
37 When I click on "Course categories" "link" in the ".view-mode-selector" "css_element"
38 Then I should see "Course categories and courses" in the ".view-mode-selector .menu" "css_element"
39 And I should see "Course categories" in the ".view-mode-selector .menu" "css_element"
40 And I should see "Courses" in the ".view-mode-selector .menu" "css_element"
41 And I click on "Course categories and courses" "link" in the ".view-mode-selector .menu" "css_element"
43 And I should see the "Course categories and courses" management page
44 And I should see "Course categories" in the "#category-listing h3" "css_element"
45 And I should see "Courses" in the "#course-listing h3" "css_element"
46 And I should see "Cat 1" in the "#category-listing" "css_element"
47 And I should see "Please select a category" in the "#course-listing" "css_element"
48 And I click on category "Cat 1" in the management interface
50 And I should see the "Course categories and courses" management page
51 And I should see "Course categories" in the "#category-listing h3" "css_element"
52 And I should see "Cat 1" in the "#course-listing h3" "css_element"
53 And I should see "Cat 1" in the "#category-listing" "css_element"
54 And I should see "Course 1" in the "#course-listing" "css_element"
55 When I click on "Course categories" "link" in the ".view-mode-selector" "css_element"
56 Then I should see "Courses" in the ".view-mode-selector .menu" "css_element"
57 And I click on "Courses" "link" in the ".view-mode-selector .menu" "css_element"
59 And I should see the "Courses" management page
60 And I should see "Cat 1" in the "#course-listing h3" "css_element"
61 And I should see "Course 1" in the "#course-listing" "css_element"
62 And I click on course "Course 1" in the management interface
64 And I should see the "Courses" management page with a course selected
65 And I should see "Cat 1" in the "#course-listing h3" "css_element"
66 And I should see "Course 1" in the "#course-listing" "css_element"
67 And I should see "Course 1" in the "#course-detail h3" "css_element"
68 And I should see "C1" in the "#course-detail .shortname" "css_element"
69 And I should see "Course 1" in the "#course-detail .fullname" "css_element"
70 And I should see "Topics" in the "#course-detail .format" "css_element"
71 And I should see "Cat 1" in the "#course-detail .category" "css_element"
73 Scenario: Test displaying of sub categories
74 Given the following "categories" exist:
75 | name | category | idnumber |
78 | Cat 1-1 | CAT1 | CAT3 |
79 | Cat 1-2 | CAT1 | CAT4 |
80 | Cat 1-1-1 | CAT3 | CAT5 |
81 | Cat 1-1-2 | CAT3 | CAT6 |
82 | Cat 2-1 | CAT2 | CAT7 |
83 | Cat 2-1-1 | CAT7 | CAT8 |
84 And the following "courses" exist:
85 | fullname | shortname | category |
86 | Course 1 | C1 | CAT1 |
87 | Course 2 | C2 | CAT1 |
88 | Course 3 | C3 | CAT3 |
89 | Course 4 | C4 | CAT3 |
90 | Course 5 | C5 | CAT5 |
91 | Course 6 | C6 | CAT5 |
92 | Course 7 | C7 | CAT8 |
93 | Course 8 | C8 | CAT8 |
95 And I log in as "admin"
96 And I go to the courses management page
97 And I should see the "Course categories" management page
98 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
99 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
100 And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
101 And I should not see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
102 And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
103 And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
104 And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
105 And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
106 And I click on "Cat 1" "link"
108 And I should see the "Course categories and courses" management page
109 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
110 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
111 And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
112 And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
113 And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
114 And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
115 And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
116 And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
117 And I click on "Cat 1-1" "link"
119 And I should see the "Course categories and courses" management page
120 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
121 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
122 And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
123 And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
124 And I should see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
125 And I should see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
126 And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
127 And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
128 And I click on "Cat 2" "link"
130 And I should see the "Course categories and courses" management page
131 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
132 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
133 And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
134 And I should not see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
135 And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
136 And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
137 And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
138 And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
140 # This is similar to the above scenario except here we are going to use AJAX
141 # to load the categories.
142 @javascript @_cross_browser
143 Scenario: Test AJAX loading of sub categories
144 Given the following "categories" exist:
145 | name | category | idnumber |
148 | Cat 1-1 | CAT1 | CAT3 |
149 | Cat 1-2 | CAT1 | CAT4 |
150 | Cat 1-1-1 | CAT3 | CAT5 |
151 | Cat 1-1-2 | CAT3 | CAT6 |
152 | Cat 2-1 | CAT2 | CAT7 |
153 | Cat 2-1-1 | CAT7 | CAT8 |
154 And the following "courses" exist:
155 | fullname | shortname | category |
156 | Course 1 | C1 | CAT1 |
157 | Course 2 | C2 | CAT1 |
158 | Course 3 | C3 | CAT3 |
159 | Course 4 | C4 | CAT3 |
160 | Course 5 | C5 | CAT5 |
161 | Course 6 | C6 | CAT5 |
162 | Course 7 | C7 | CAT8 |
163 | Course 8 | C8 | CAT8 |
165 And I log in as "admin"
166 And I go to the courses management page
167 And I should see the "Course categories" management page
168 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
169 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
170 And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
171 And I should not see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
172 And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
173 And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
174 And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
175 And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
176 And I click to expand category "CAT1" in the management interface
177 # AJAX action - no redirect.
178 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
179 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
180 And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
181 And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
182 And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
183 And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
184 And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
185 And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
186 And I click to expand category "CAT3" in the management interface
187 # AJAX action - no redirect.
188 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
189 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
190 And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
191 And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
192 And I should see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
193 And I should see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
194 And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
195 And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
196 And I click to expand category "CAT2" in the management interface
197 # AJAX action - no redirect.
198 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
199 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
200 And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
201 And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
202 And I should see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
203 And I should see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
204 And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
205 And I should not see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
206 And I click to expand category "CAT7" in the management interface
207 # AJAX action - no redirect.
208 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
209 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
210 And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
211 And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
212 And I should see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
213 And I should see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
214 And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
215 And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
216 And I click to expand category "CAT1" in the management interface
217 # AJAX action - no redirect.
218 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
219 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
220 And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
221 And I should not see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
222 And I should not see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
223 And I should not see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
224 And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
225 And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
226 And I click to expand category "CAT1" in the management interface
227 # AJAX action - no redirect.
228 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
229 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
230 And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
231 And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
232 And I should see "Cat 1-1-1" in the "#course-category-listings ul.ml" "css_element"
233 And I should see "Cat 1-1-2" in the "#course-category-listings ul.ml" "css_element"
234 And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
235 And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
238 Scenario Outline: Top level categories are displayed correctly when resorted
239 Given the following "categories" exist:
240 | category | name | idnumber | sortorder |
241 | 0 | Social studies | Ext003 | 1 |
242 | 0 | Applied sciences | Sci001 | 2 |
243 | 0 | Extended social studies | Ext002 | 3 |
245 And I log in as "admin"
246 And I go to the courses management page
247 And I should see the "Course categories" management page
248 And I set the field "menuselectsortby" to "All categories"
249 And I set the field "menuresortcategoriesby" to <sortby>
252 And I should see the "Course categories" management page
253 And I should see category listing <cat1> before <cat2>
254 And I should see category listing <cat2> before <cat3>
257 | sortby | cat1 | cat2 | cat3 |
258 | "Sort categories by name" | "Applied sciences" | "Extended social studies" | "Social studies" |
259 | "Sort categories by ID number" | "Extended social studies" | "Social studies" | "Applied sciences" |
262 Scenario Outline: Sub categories are displayed correctly when resorted
263 Given the following "categories" exist:
264 | category | name | idnumber | sortorder |
265 | 0 | Master cat | CAT1 | 1 |
266 | CAT1 | Social studies | Ext003 | 1 |
267 | CAT1 | Applied sciences | Sci001 | 2 |
268 | CAT1 | Extended social studies | Ext002 | 3 |
270 And I log in as "admin"
271 And I go to the courses management page
272 And I should see the "Course categories" management page
273 And I click on "Master cat" category in the management category listing
275 And I should see the "Course categories and courses" management page
276 And I click on <sortby> action for "Master cat" in management category listing
278 And I should see the "Course categories and courses" management page
279 And I should see category listing <cat1> before <cat2>
280 And I should see category listing <cat2> before <cat3>
283 | sortby | cat1 | cat2 | cat3 |
284 | "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
285 | "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
288 Scenario Outline: Test courses are displayed correctly after being resorted.
289 Given the following "categories" exist:
290 | name | category 0| idnumber |
292 And the following "courses" exist:
293 | category | fullname | shortname | idnumber | sortorder |
294 | CAT1 | Social studies | Senior school | Ext003 | 1 |
295 | CAT1 | Applied sciences | Middle school | Sci001 | 2 |
296 | CAT1 | Extended social studies | Junior school | Ext002 | 3 |
298 And I log in as "admin"
299 And I go to the courses management page
300 And I should see the "Course categories" management page
301 And I click on "Cat 1" "link"
303 And I should see the "Course categories and courses" management page
304 And I click on "Sort courses" "link"
305 And I should see "By fullname" in the ".course-listing-actions" "css_element"
306 And I should see "By shortname" in the ".course-listing-actions" "css_element"
307 And I should see "By idnumber" in the ".course-listing-actions" "css_element"
308 And I click on <sortby> "link" in the ".course-listing-actions" "css_element"
310 And I should see the "Course categories and courses" management page
311 And I should see course listing <course1> before <course2>
312 And I should see course listing <course2> before <course3>
315 | sortby | course1 | course2 | course3 |
316 | "By fullname" | "Applied sciences" | "Extended social studies" | "Social studies" |
317 | "By shortname" | "Extended social studies" | "Applied sciences" | "Social studies" |
318 | "By idnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
321 Scenario: Test course pagination
322 Given the following "categories" exist:
323 | name | category | idnumber |
325 And the following "courses" exist:
326 | category | fullname | shortname | idnumber |
327 | CAT1 | Course 1 | Course 1 | C1 |
328 | CAT1 | Course 2 | Course 2 | C2 |
329 | CAT1 | Course 3 | Course 3 | C3 |
330 | CAT1 | Course 4 | Course 4 | C4 |
331 | CAT1 | Course 5 | Course 5 | C5 |
332 | CAT1 | Course 6 | Course 6 | C6 |
333 | CAT1 | Course 7 | Course 7 | C7 |
334 | CAT1 | Course 8 | Course 8 | C8 |
335 | CAT1 | Course 9 | Course 9 | C9 |
336 | CAT1 | Course 10 | Course 10 | C10 |
337 | CAT1 | Course 11 | Course 11 | C11 |
338 | CAT1 | Course 12 | Course 12 | C12 |
340 And I log in as "admin"
341 And I go to the courses management page
342 And I should see the "Course categories" management page
343 And I click on "Cat 1" "link"
345 And I should see the "Course categories and courses" management page
346 And I click on "Sort courses" "link"
347 And I click on "By idnumber" "link" in the ".course-listing-actions" "css_element"
349 And I should see "Per page: 20" in the ".course-listing-actions" "css_element"
350 And I should see course listing "Course 1" before "Course 2"
351 And I should see course listing "Course 2" before "Course 3"
352 And I should see course listing "Course 3" before "Course 4"
353 And I should see course listing "Course 4" before "Course 5"
354 And I should see course listing "Course 5" before "Course 6"
355 And I should see course listing "Course 6" before "Course 7"
356 And I should see course listing "Course 7" before "Course 8"
357 And I should see course listing "Course 8" before "Course 9"
358 And I should see course listing "Course 9" before "Course 10"
359 And I should see course listing "Course 10" before "Course 11"
360 And I should see course listing "Course 11" before "Course 12"
361 And "#course-listing .listing-pagination" "css_element" should not exist
362 And I click on "Per page: 20" "link" in the ".course-listing-actions" "css_element"
363 And I should see "5" in the ".courses-per-page" "css_element"
364 And I should see "10" in the ".courses-per-page" "css_element"
365 And I should see "20" in the ".courses-per-page" "css_element"
366 And I should see "All" in the ".courses-per-page" "css_element"
367 And I click on "5" "link" in the ".courses-per-page" "css_element"
369 And I should see the "Course categories and courses" management page
370 And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
371 And I should see course listing "Course 1" before "Course 2"
372 And I should see course listing "Course 2" before "Course 3"
373 And I should see course listing "Course 3" before "Course 4"
374 And I should see course listing "Course 4" before "Course 5"
375 And I should not see "Course 6"
376 And I should not see "Course 7"
377 And I should not see "Course 8"
378 And I should not see "Course 9"
379 And I should not see "Course 10"
380 And I should not see "Course 11"
381 And I should not see "Course 12"
382 And "#course-listing .listing-pagination" "css_element" should exist
383 And I should see "Showing courses 1 to 5 of 12 courses"
384 And I should not see "First" in the "#course-listing .listing-pagination" "css_element"
385 And I should not see "Prev" in the "#course-listing .listing-pagination" "css_element"
386 And I should see "1" in the "#course-listing .listing-pagination" "css_element"
387 And I should see "2" in the "#course-listing .listing-pagination" "css_element"
388 And I should see "3" in the "#course-listing .listing-pagination" "css_element"
389 And I should see "Next" in the "#course-listing .listing-pagination" "css_element"
390 And I should see "Last" in the "#course-listing .listing-pagination" "css_element"
391 And I click on "2" "link" in the "#course-listing .listing-pagination" "css_element"
393 And I should see the "Course categories and courses" management page
394 And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
395 And I should see "Course 10" in the "#course-listing" "css_element"
396 And I should not see "Course 2" in the "#course-listing" "css_element"
397 And I should not see "Course 3" in the "#course-listing" "css_element"
398 And I should not see "Course 4" in the "#course-listing" "css_element"
399 And I should not see "Course 5" in the "#course-listing" "css_element"
400 And I should see course listing "Course 6" before "Course 7"
401 And I should see course listing "Course 7" before "Course 8"
402 And I should see course listing "Course 8" before "Course 9"
403 And I should see course listing "Course 9" before "Course 10"
404 And I should not see "Course 11"
405 And I should not see "Course 12"
406 And "#course-listing .listing-pagination" "css_element" should exist
407 And I should see "Showing courses 6 to 10 of 12 courses"
408 And I should see "First" in the "#course-listing .listing-pagination" "css_element"
409 And I should see "Prev" in the "#course-listing .listing-pagination" "css_element"
410 And I should see "1" in the "#course-listing .listing-pagination" "css_element"
411 And I should see "2" in the "#course-listing .listing-pagination" "css_element"
412 And I should see "3" in the "#course-listing .listing-pagination" "css_element"
413 And I should see "Next" in the "#course-listing .listing-pagination" "css_element"
414 And I should see "Last" in the "#course-listing .listing-pagination" "css_element"
415 And I click on "Next" "link" in the "#course-listing .listing-pagination" "css_element"
416 # Redirect. Test next link.
417 And I should see the "Course categories and courses" management page
418 And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
419 And I should see "Course 11"
420 And I should not see "Course 2" in the "#course-listing" "css_element"
421 And I should not see "Course 3" in the "#course-listing" "css_element"
422 And I should not see "Course 4" in the "#course-listing" "css_element"
423 And I should not see "Course 5" in the "#course-listing" "css_element"
424 And I should not see "Course 6" in the "#course-listing" "css_element"
425 And I should not see "Course 7" in the "#course-listing" "css_element"
426 And I should not see "Course 8" in the "#course-listing" "css_element"
427 And I should not see "Course 9" in the "#course-listing" "css_element"
428 And I should not see "Course 10" in the "#course-listing" "css_element"
429 And I should see course listing "Course 11" before "Course 12"
430 And "#course-listing .listing-pagination" "css_element" should exist
431 And I should see "Showing courses 11 to 12 of 12 courses"
432 And I should see "First" in the "#course-listing .listing-pagination" "css_element"
433 And I should see "Prev" in the "#course-listing .listing-pagination" "css_element"
434 And I should see "1" in the "#course-listing .listing-pagination" "css_element"
435 And I should see "2" in the "#course-listing .listing-pagination" "css_element"
436 And I should see "3" in the "#course-listing .listing-pagination" "css_element"
437 And I should not see "Next" in the "#course-listing .listing-pagination" "css_element"
438 And I should not see "Last" in the "#course-listing .listing-pagination" "css_element"
439 And I click on "First" "link" in the "#course-listing .listing-pagination" "css_element"
440 # Redirect. Test first link.
441 And I should see the "Course categories and courses" management page
442 And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
443 And I should see course listing "Course 1" before "Course 2"
444 And I should see course listing "Course 2" before "Course 3"
445 And I should see course listing "Course 3" before "Course 4"
446 And I should see course listing "Course 4" before "Course 5"
447 And I should not see "Course 6" in the "#course-listing" "css_element"
448 And I should not see "Course 7" in the "#course-listing" "css_element"
449 And I should not see "Course 8" in the "#course-listing" "css_element"
450 And I should not see "Course 9" in the "#course-listing" "css_element"
451 And I should not see "Course 10" in the "#course-listing" "css_element"
452 And I should not see "Course 11" in the "#course-listing" "css_element"
453 And I should not see "Course 12" in the "#course-listing" "css_element"
454 And "#course-listing .listing-pagination" "css_element" should exist
455 And I should see "Showing courses 1 to 5 of 12 courses"
456 And I should not see "First" in the "#course-listing .listing-pagination" "css_element"
457 And I should not see "Prev" in the "#course-listing .listing-pagination" "css_element"
458 And I should see "1" in the "#course-listing .listing-pagination" "css_element"
459 And I should see "2" in the "#course-listing .listing-pagination" "css_element"
460 And I should see "3" in the "#course-listing .listing-pagination" "css_element"
461 And I should see "Next" in the "#course-listing .listing-pagination" "css_element"
462 And I should see "Last" in the "#course-listing .listing-pagination" "css_element"
463 And I click on "Last" "link" in the "#course-listing .listing-pagination" "css_element"
464 # Redirect. Test last link.
465 And I should see the "Course categories and courses" management page
466 And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
467 And I should see "Course 11" in the "#course-listing" "css_element"
468 And I should not see "Course 2" in the "#course-listing" "css_element"
469 And I should not see "Course 3" in the "#course-listing" "css_element"
470 And I should not see "Course 4" in the "#course-listing" "css_element"
471 And I should not see "Course 5" in the "#course-listing" "css_element"
472 And I should not see "Course 6" in the "#course-listing" "css_element"
473 And I should not see "Course 7" in the "#course-listing" "css_element"
474 And I should not see "Course 8" in the "#course-listing" "css_element"
475 And I should not see "Course 9" in the "#course-listing" "css_element"
476 And I should not see "Course 10" in the "#course-listing" "css_element"
477 And I should see course listing "Course 11" before "Course 12"
478 And "#course-listing .listing-pagination" "css_element" should exist
479 And I should see "Showing courses 11 to 12 of 12 courses"
480 And I should see "First" in the "#course-listing .listing-pagination" "css_element"
481 And I should see "Prev" in the "#course-listing .listing-pagination" "css_element"
482 And I should see "1" in the "#course-listing .listing-pagination" "css_element"
483 And I should see "2" in the "#course-listing .listing-pagination" "css_element"
484 And I should see "3" in the "#course-listing .listing-pagination" "css_element"
485 And I should not see "Next" in the "#course-listing .listing-pagination" "css_element"
486 And I should not see "Last" in the "#course-listing .listing-pagination" "css_element"
487 And I click on "Prev" "link" in the "#course-listing .listing-pagination" "css_element"
488 # Redirect. Test prev link.
489 And I should see the "Course categories and courses" management page
490 And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
491 And I should see "Course 10" in the "#course-listing" "css_element"
492 And I should not see "Course 2" in the "#course-listing" "css_element"
493 And I should not see "Course 3" in the "#course-listing" "css_element"
494 And I should not see "Course 4" in the "#course-listing" "css_element"
495 And I should not see "Course 5" in the "#course-listing" "css_element"
496 And I should see course listing "Course 6" before "Course 7"
497 And I should see course listing "Course 7" before "Course 8"
498 And I should see course listing "Course 8" before "Course 9"
499 And I should see course listing "Course 9" before "Course 10"
500 And I should not see "Course 11"
501 And I should not see "Course 12"
502 And "#course-listing .listing-pagination" "css_element" should exist
503 And I should see "Showing courses 6 to 10 of 12 courses"
504 And I should see "First" in the "#course-listing .listing-pagination" "css_element"
505 And I should see "Prev" in the "#course-listing .listing-pagination" "css_element"
506 And I should see "1" in the "#course-listing .listing-pagination" "css_element"
507 And I should see "2" in the "#course-listing .listing-pagination" "css_element"
508 And I should see "3" in the "#course-listing .listing-pagination" "css_element"
509 And I should see "Next" in the "#course-listing .listing-pagination" "css_element"
510 And I should see "Last" in the "#course-listing .listing-pagination" "css_element"
512 Scenario: Test pagination is only shown when required
513 Given the following "categories" exist:
514 | name | category | idnumber |
516 And the following "courses" exist:
517 | category | fullname | shortname | idnumber |
518 | CAT1 | Course 1 | Course 1 | C1 |
519 | CAT1 | Course 2 | Course 2 | C2 |
520 | CAT1 | Course 3 | Course 3 | C3 |
521 | CAT1 | Course 4 | Course 4 | C4 |
522 | CAT1 | Course 5 | Course 5 | C5 |
523 And I log in as "admin"
524 And I go to the courses management page
525 And I should see the "Course categories" management page
526 And I click on "Cat 1" "link"
528 And I should see the "Course categories and courses" management page
529 And I click on "Sort courses" "link"
530 And I click on "By idnumber" "link" in the ".course-listing-actions" "css_element"
532 And I should see "Per page: 20" in the ".course-listing-actions" "css_element"
533 And I should see course listing "Course 1" before "Course 2"
534 And I should see course listing "Course 2" before "Course 3"
535 And I should see course listing "Course 3" before "Course 4"
536 And I should see course listing "Course 4" before "Course 5"
537 And "#course-listing .listing-pagination" "css_element" should not exist
538 And I click on "5" "link" in the ".course-listing-actions" "css_element"
540 And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
541 And I should see course listing "Course 1" before "Course 2"
542 And I should see course listing "Course 2" before "Course 3"
543 And I should see course listing "Course 3" before "Course 4"
544 And I should see course listing "Course 4" before "Course 5"
545 And "#course-listing .listing-pagination" "css_element" should not exist
547 # We need at least 30 courses for this next test.
549 Scenario: Test many course pagination
550 Given the following "categories" exist:
551 | name | category 0| idnumber |
553 And the following "courses" exist:
554 | category | fullname | shortname | idnumber |
555 | CAT1 | Course 1 | Course 1 | C1 |
556 | CAT1 | Course 2 | Course 2 | C2 |
557 | CAT1 | Course 3 | Course 3 | C3 |
558 | CAT1 | Course 4 | Course 4 | C4 |
559 | CAT1 | Course 5 | Course 5 | C5 |
560 | CAT1 | Course 6 | Course 6 | C6 |
561 | CAT1 | Course 7 | Course 7 | C7 |
562 | CAT1 | Course 8 | Course 8 | C8 |
563 | CAT1 | Course 9 | Course 9 | C9 |
564 | CAT1 | Course 10 | Course 10 | C10 |
565 | CAT1 | Course 11 | Course 11 | C11 |
566 | CAT1 | Course 12 | Course 12 | C12 |
567 | CAT1 | Course 13 | Course 13 | C13 |
568 | CAT1 | Course 14 | Course 14 | C14 |
569 | CAT1 | Course 15 | Course 15 | C15 |
570 | CAT1 | Course 16 | Course 16 | C16 |
571 | CAT1 | Course 17 | Course 17 | C17 |
572 | CAT1 | Course 18 | Course 18 | C18 |
573 | CAT1 | Course 19 | Course 19 | C19 |
574 | CAT1 | Course 20 | Course 20 | C20 |
575 | CAT1 | Course 21 | Course 21 | C21 |
576 | CAT1 | Course 22 | Course 22 | C22 |
577 | CAT1 | Course 23 | Course 23 | C23 |
578 | CAT1 | Course 24 | Course 24 | C24 |
579 | CAT1 | Course 25 | Course 25 | C25 |
580 | CAT1 | Course 26 | Course 26 | C26 |
581 | CAT1 | Course 27 | Course 27 | C27 |
582 | CAT1 | Course 28 | Course 28 | C28 |
583 | CAT1 | Course 29 | Course 29 | C29 |
584 | CAT1 | Course 30 | Course 30 | C30 |
585 | CAT1 | Course 31 | Course 31 | C31 |
586 | CAT1 | Course 32 | Course 32 | C32 |
588 And I log in as "admin"
589 And I go to the courses management page
590 And I should see the "Course categories" management page
591 And I click on "Cat 1" "link"
593 And I should see the "Course categories and courses" management page
594 And I click on "Sort courses" "link"
595 And I click on "By idnumber" "link" in the ".course-listing-actions" "css_element"
597 And I should see the "Course categories and courses" management page
598 And I should see "Per page: 20" in the ".course-listing-actions" "css_element"
599 And I should see course listing "Course 1" before "Course 2"
600 And I should see course listing "Course 19" before "Course 20"
601 And I should not see "Course 21"
602 And I should see "Showing courses 1 to 20 of 32 courses"
603 And I click on "Per page: 20" "link" in the ".course-listing-actions" "css_element"
604 And I click on "100" "link" in the ".courses-per-page" "css_element"
606 And I should see the "Course categories and courses" management page
607 And I should see "Per page: 100" in the ".course-listing-actions" "css_element"
608 And I should see course listing "Course 1" before "Course 2"
609 And I should see course listing "Course 19" before "Course 20"
610 And I should see course listing "Course 21" before "Course 22"
611 And I should see course listing "Course 31" before "Course 32"
612 And "#course-listing .listing-pagination" "css_element" should not exist
613 And I click on "Per page: 100" "link" in the ".course-listing-actions" "css_element"
614 And I click on "5" "link" in the ".courses-per-page" "css_element"
616 And I should see the "Course categories and courses" management page
617 And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
618 And I should see course listing "Course 1" before "Course 2"
619 And I should see course listing "Course 4" before "Course 5"
620 And I should not see "Course 6"
621 And I should see "Showing courses 1 to 5 of 32 courses"
622 And I should not see "First" in the "#course-listing .listing-pagination" "css_element"
623 And I should not see "Prev" in the "#course-listing .listing-pagination" "css_element"
624 And I should see "1" in the "#course-listing .listing-pagination" "css_element"
625 And I should see "2" in the "#course-listing .listing-pagination" "css_element"
626 And I should see "3" in the "#course-listing .listing-pagination" "css_element"
627 And I should see "4" in the "#course-listing .listing-pagination" "css_element"
628 And I should see "5" in the "#course-listing .listing-pagination" "css_element"
629 And I should not see "6" in the "#course-listing .listing-pagination" "css_element"
630 And I should not see "7" in the "#course-listing .listing-pagination" "css_element"
631 And I should see "Next" in the "#course-listing .listing-pagination" "css_element"
632 And I should see "Last" in the "#course-listing .listing-pagination" "css_element"
633 And I click on "Last" "link" in the "#course-listing .listing-pagination" "css_element"
635 And I should see the "Course categories and courses" management page
636 And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
637 And I should not see "Course 30"
638 And I should see course listing "Course 31" before "Course 32"
639 And I should see "Showing courses 31 to 32 of 32 courses"
640 And I should see "First" in the "#course-listing .listing-pagination" "css_element"
641 And I should see "Prev" in the "#course-listing .listing-pagination" "css_element"
642 And I should not see "1" in the "#course-listing .listing-pagination" "css_element"
643 And I should not see "2" in the "#course-listing .listing-pagination" "css_element"
644 And I should see "3" in the "#course-listing .listing-pagination" "css_element"
645 And I should see "4" in the "#course-listing .listing-pagination" "css_element"
646 And I should see "5" in the "#course-listing .listing-pagination" "css_element"
647 And I should see "6" in the "#course-listing .listing-pagination" "css_element"
648 And I should see "7" in the "#course-listing .listing-pagination" "css_element"
649 And I should not see "Next" in the "#course-listing .listing-pagination" "css_element"
650 And I should not see "Last" in the "#course-listing .listing-pagination" "css_element"
651 And I click on "4" "link" in the "#course-listing .listing-pagination" "css_element"
653 And I should see the "Course categories and courses" management page
654 And I should see "Per page: 5" in the ".course-listing-actions" "css_element"
655 And I should not see "Course 15"
656 And I should see course listing "Course 16" before "Course 17"
657 And I should see course listing "Course 17" before "Course 18"
658 And I should see course listing "Course 18" before "Course 19"
659 And I should see course listing "Course 19" before "Course 20"
660 And I should not see "Course 21"
661 And I should see "Showing courses 16 to 20 of 32 courses"
662 And I should see "First" in the "#course-listing .listing-pagination" "css_element"
663 And I should see "Prev" in the "#course-listing .listing-pagination" "css_element"
664 And I should not see "1" in the "#course-listing .listing-pagination" "css_element"
665 And I should see "2" in the "#course-listing .listing-pagination" "css_element"
666 And I should see "3" in the "#course-listing .listing-pagination" "css_element"
667 And I should see "4" in the "#course-listing .listing-pagination" "css_element"
668 And I should see "5" in the "#course-listing .listing-pagination" "css_element"
669 And I should see "6" in the "#course-listing .listing-pagination" "css_element"
670 And I should not see "7" in the "#course-listing .listing-pagination" "css_element"
671 And I should see "Next" in the "#course-listing .listing-pagination" "css_element"
672 And I should see "Last" in the "#course-listing .listing-pagination" "css_element"
674 Scenario: Test clicking to edit a course.
675 Given the following "categories" exist:
676 | name | category | idnumber |
678 And the following "courses" exist:
679 | category | fullname | shortname | idnumber |
680 | CAT1 | Course 1 | Course 1 | C1 |
682 And I log in as "admin"
683 And I go to the courses management page
684 And I should see the "Course categories" management page
685 And I click on category "Cat 1" in the management interface
686 And I click on "edit" action for "Course 1" in management course listing
688 And I should see "Edit course settings"
689 And I should see "Course 1"
692 Scenario: Test AJAX expanded categories stay open.
693 Given the following "categories" exist:
694 | name | category | idnumber |
697 | Cat 1-1 | CAT1 | CAT3 |
698 | Cat 1-2 | CAT1 | CAT4 |
699 | Cat 1-1-1 | CAT3 | CAT5 |
700 | Cat 1-1-2 | CAT3 | CAT6 |
701 | Cat 2-1 | CAT2 | CAT7 |
702 | Cat 2-1-1 | CAT7 | CAT8 |
703 | Cat 2-1-1-1 | CAT8 | CAT10 |
704 | Cat 2-1-2 | CAT7 | CAT9 |
705 | Cat 2-1-2-1 | CAT9 | CAT11 |
707 And I log in as "admin"
708 And I go to the courses management page
709 And I should see the "Course categories" management page
710 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
711 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
712 And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
713 And I should not see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
714 And I should not see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
715 And I click to expand category "CAT2" in the management interface
716 # AJAX action - no redirect.
717 And I click to expand category "CAT7" in the management interface
718 # AJAX action - no redirect.
719 And I click to expand category "CAT9" in the management interface
720 # AJAX action - no redirect.
721 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
722 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
723 And I should not see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
724 And I should not see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
725 And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
726 And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
727 And I should see "Cat 2-1-2" in the "#course-category-listings ul.ml" "css_element"
728 And I should not see "Cat 2-1-1-1" in the "#course-category-listings ul.ml" "css_element"
729 And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
730 And I click on "Cat 1" category in the management category listing
732 And I should see the "Course categories and courses" management page
733 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
734 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
735 And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
736 And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
737 And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
738 And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
739 And I should see "Cat 2-1-2" in the "#course-category-listings ul.ml" "css_element"
740 And I should not see "Cat 2-1-1-1" in the "#course-category-listings ul.ml" "css_element"
741 And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
742 And I click on "resortbyidnumber" action for "Cat 1" in management category listing
744 And I should see the "Course categories and courses" management page
745 And I should see "Cat 1" in the "#course-category-listings ul.ml" "css_element"
746 And I should see "Cat 2" in the "#course-category-listings ul.ml" "css_element"
747 And I should see "Cat 1-1" in the "#course-category-listings ul.ml" "css_element"
748 And I should see "Cat 1-2" in the "#course-category-listings ul.ml" "css_element"
749 And I should see "Cat 2-1" in the "#course-category-listings ul.ml" "css_element"
750 And I should see "Cat 2-1-1" in the "#course-category-listings ul.ml" "css_element"
751 And I should see "Cat 2-1-2" in the "#course-category-listings ul.ml" "css_element"
752 And I should not see "Cat 2-1-1-1" in the "#course-category-listings ul.ml" "css_element"
753 And I should see "Cat 2-1-2-1" in the "#course-category-listings ul.ml" "css_element"
756 Scenario: Test category expansion after deletion
757 Given the following "categories" exist:
758 | name | category | idnumber |
759 | Cat A (1) | 0 | CAT1 |
760 | Cat B (2) | 0 | CAT2 |
761 | Cat C (1-1) | CAT1 | CAT3 |
762 | Cat D (2-1) | CAT2 | CAT4 |
763 | Cat E (2-1-1) | CAT4 | CAT5 |
765 And I log in as "admin"
766 And I go to the courses management page
767 And I should see the "Course categories" management page
768 And I should see "Cat A (1)" in the "#course-category-listings ul.ml" "css_element"
769 And I should see "Cat B (2)" in the "#course-category-listings ul.ml" "css_element"
770 And I should not see "Cat C (1-1)" in the "#course-category-listings ul.ml" "css_element"
771 And I should not see "Cat D (2-1)" in the "#course-category-listings ul.ml" "css_element"
772 And I should not see "Cat E (2-1-1)" in the "#course-category-listings ul.ml" "css_element"
773 And I click to expand category "CAT1" in the management interface
774 And I should see "Cat C (1-1)" in the "#course-category-listings ul.ml" "css_element"
775 # AJAX action - no redirect.
776 And I click to expand category "CAT2" in the management interface
777 And I should see "Cat D (2-1)" in the "#course-category-listings ul.ml" "css_element"
778 # AJAX action - no redirect.
779 And I click to expand category "CAT4" in the management interface
780 And I should see "Cat E (2-1-1)" in the "#course-category-listings ul.ml" "css_element"
781 # AJAX action - no redirect.
782 And I click on "delete" action for "Cat B (2)" in management category listing
784 And I should see "Delete category: Cat B (2)"
785 And I should see "Contents of Cat B (2)"
788 And I should see "Delete category: Cat B (2)"
789 And I should see "Deleted course category Cat B (2)"
790 And I press "Continue"
792 And I should see the "Course categories and courses" management page
793 And I should see "Cat A (1)" in the "#course-category-listings ul.ml" "css_element"
794 And I should not see "Cat B (2)" in the "#course-category-listings ul.ml" "css_element"