1 |
efrain |
1 |
@core @core_course
|
|
|
2 |
Feature: Test we can resort categories in the management interface.
|
|
|
3 |
As a moodle admin
|
|
|
4 |
I need to test we can resort top level categories.
|
|
|
5 |
I need to test we can resort sub categories.
|
|
|
6 |
I need to test we can manually sort categories.
|
|
|
7 |
|
|
|
8 |
Scenario Outline: Test bulk sorting all categories.
|
|
|
9 |
Given the following "categories" exist:
|
|
|
10 |
| category | name | idnumber | sortorder |
|
|
|
11 |
| 0 | Social studies | Ext003 | 1 |
|
|
|
12 |
| 0 | Applied sciences | Sci001 | 2 |
|
|
|
13 |
| 0 | Extended social studies | Ext002 | 3 |
|
|
|
14 |
|
|
|
15 |
And I log in as "admin"
|
|
|
16 |
And I go to the courses management page
|
|
|
17 |
And I should see the "Course categories and courses" management page
|
|
|
18 |
And I set the field "menuselectsortby" to "All categories"
|
|
|
19 |
And I set the field "menuresortcategoriesby" to <sortby>
|
|
|
20 |
And I press "Sort"
|
|
|
21 |
# Redirect.
|
|
|
22 |
And I should see the "Course categories and courses" management page
|
|
|
23 |
And I should see category listing <cat1> before <cat2>
|
|
|
24 |
And I should see category listing <cat2> before <cat3>
|
|
|
25 |
|
|
|
26 |
Examples:
|
|
|
27 |
| sortby | cat1 | cat2 | cat3 |
|
|
|
28 |
| "Sort by Category name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
|
|
|
29 |
| "Sort by Category name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
|
|
|
30 |
| "Sort by Category ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
|
|
|
31 |
| "Sort by Category ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
|
|
|
32 |
|
|
|
33 |
Scenario Outline: Test bulk sorting current category.
|
|
|
34 |
Given the following "categories" exist:
|
|
|
35 |
| category | name | idnumber | sortorder |
|
|
|
36 |
| 0 | Test category | Tes001 | 1 |
|
|
|
37 |
| Tes001 | Social studies | Ext003 | 2 |
|
|
|
38 |
| Tes001 | Applied sciences | Sci001 | 3 |
|
|
|
39 |
| Tes001 | Extended social studies | Ext002 | 4 |
|
|
|
40 |
|
|
|
41 |
And I log in as "admin"
|
|
|
42 |
And I go to the courses management page
|
|
|
43 |
And I should see the "Course categories and courses" management page
|
|
|
44 |
And I click on "Test category" "link"
|
|
|
45 |
# Redirect.
|
|
|
46 |
And I should see the "Course categories and courses" management page
|
|
|
47 |
And I set the field "menuselectsortby" to "This category"
|
|
|
48 |
And I set the field "menuresortcategoriesby" to <sortby>
|
|
|
49 |
And I press "Sort"
|
|
|
50 |
# Redirect.
|
|
|
51 |
And I should see the "Course categories and courses" management page
|
|
|
52 |
And I should see category listing <cat1> before <cat2>
|
|
|
53 |
And I should see category listing <cat2> before <cat3>
|
|
|
54 |
|
|
|
55 |
Examples:
|
|
|
56 |
| sortby | cat1 | cat2 | cat3 |
|
|
|
57 |
| "Sort by Category name ascending" | "Applied sciences" | "Extended social studies" | "Social studies" |
|
|
|
58 |
| "Sort by Category name descending" | "Social studies" | "Extended social studies" | "Applied sciences" |
|
|
|
59 |
| "Sort by Category ID number ascending" | "Extended social studies" | "Social studies" | "Applied sciences" |
|
|
|
60 |
| "Sort by Category ID number descending" | "Applied sciences" | "Social studies" | "Extended social studies" |
|
|
|
61 |
|
|
|
62 |
Scenario Outline: Test resorting subcategories.
|
|
|
63 |
Given the following "categories" exist:
|
|
|
64 |
| category | name | idnumber | sortorder |
|
|
|
65 |
| 0 | Master cat | CAT1 | 1 |
|
|
|
66 |
| CAT1 | Social studies | Ext003 | 1 |
|
|
|
67 |
| CAT1 | Applied sciences | Sci001 | 2 |
|
|
|
68 |
| CAT1 | Extended social studies | Ext002 | 3 |
|
|
|
69 |
|
|
|
70 |
And I log in as "admin"
|
|
|
71 |
And I go to the courses management page
|
|
|
72 |
And I should see the "Course categories and courses" management page
|
|
|
73 |
And I click on "Master cat" "link"
|
|
|
74 |
# Redirect.
|
|
|
75 |
And I should see the "Course categories and courses" management page
|
|
|
76 |
And I click on <sortby> action for "Master cat" in management category listing
|
|
|
77 |
# Redirect.
|
|
|
78 |
And I should see the "Course categories and courses" management page
|
|
|
79 |
And I should see category listing <cat1> before <cat2>
|
|
|
80 |
And I should see category listing <cat2> before <cat3>
|
|
|
81 |
|
|
|
82 |
Examples:
|
|
|
83 |
| sortby | cat1 | cat2 | cat3 |
|
|
|
84 |
| "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
|
|
|
85 |
| "resortbynamedesc" | "Social studies" | "Extended social studies" | "Applied sciences" |
|
|
|
86 |
| "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
|
|
|
87 |
| "resortbyidnumberdesc" | "Applied sciences" | "Social studies" | "Extended social studies" |
|
|
|
88 |
|
|
|
89 |
@javascript
|
|
|
90 |
Scenario Outline: Test resorting subcategories with JS enabled.
|
|
|
91 |
Given the following "categories" exist:
|
|
|
92 |
| category | name | idnumber | sortorder |
|
|
|
93 |
| 0 | Master cat | CAT1 | 1 |
|
|
|
94 |
| CAT1 | Social studies | Ext003 | 1 |
|
|
|
95 |
| CAT1 | Applied sciences | Sci001 | 2 |
|
|
|
96 |
| CAT1 | Extended social studies | Ext002 | 3 |
|
|
|
97 |
|
|
|
98 |
And I log in as "admin"
|
|
|
99 |
And I go to the courses management page
|
|
|
100 |
And I start watching to see if a new page loads
|
|
|
101 |
And I should see the "Course categories and courses" management page
|
|
|
102 |
And I click on "Master cat" category in the management category listing
|
|
|
103 |
And a new page should have loaded since I started watching
|
|
|
104 |
And I start watching to see if a new page loads
|
|
|
105 |
And I should see the "Course categories and courses" management page
|
|
|
106 |
And I click on <sortby> action for "Master cat" in management category listing
|
|
|
107 |
And a new page should have loaded since I started watching
|
|
|
108 |
And I should see the "Course categories and courses" management page
|
|
|
109 |
And I should see category listing <cat1> before <cat2>
|
|
|
110 |
And I should see category listing <cat2> before <cat3>
|
|
|
111 |
|
|
|
112 |
Examples:
|
|
|
113 |
| sortby | cat1 | cat2 | cat3 |
|
|
|
114 |
| "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
|
|
|
115 |
| "resortbynamedesc" | "Social studies" | "Extended social studies" | "Applied sciences" |
|
|
|
116 |
| "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
|
|
|
117 |
| "resortbyidnumberdesc" | "Applied sciences" | "Social studies" | "Extended social studies" |
|
|
|
118 |
|
|
|
119 |
# The scenario below this is the same but with JS enabled.
|
|
|
120 |
Scenario: Test moving categories up and down by one.
|
|
|
121 |
Given the following "categories" exist:
|
|
|
122 |
| category | idnumber | name |
|
|
|
123 |
| 0 | CAT1 | Cat 1 |
|
|
|
124 |
| 0 | CAT2 | Cat 2 |
|
|
|
125 |
| CAT1 | CATA | Cat 1a |
|
|
|
126 |
| CAT1 | CATB | Cat 1b |
|
|
|
127 |
| CAT1 | CATC | Cat 1c |
|
|
|
128 |
|
|
|
129 |
And I log in as "admin"
|
|
|
130 |
And I go to the courses management page
|
|
|
131 |
And I should see the "Course categories and courses" management page
|
|
|
132 |
And I click on category "Cat 1" in the management interface
|
|
|
133 |
# Redirect. We should a 1, 1a, 1b, 1c, 2.
|
|
|
134 |
And I should see the "Course categories and courses" management page
|
|
|
135 |
And I should see category listing "Cat 1" before "Cat 1a"
|
|
|
136 |
And I should see category listing "Cat 1a" before "Cat 1b"
|
|
|
137 |
And I should see category listing "Cat 1b" before "Cat 1c"
|
|
|
138 |
And I should see category listing "Cat 1c" before "Cat 2"
|
|
|
139 |
And I click to move category "CATA" down one
|
|
|
140 |
# Redirect.We should a 1, 1b, 1a, 1c, 2.
|
|
|
141 |
And I should see the "Course categories and courses" management page
|
|
|
142 |
And I should see category listing "Cat 1" before "Cat 1b"
|
|
|
143 |
And I should see category listing "Cat 1b" before "Cat 1a"
|
|
|
144 |
And I should see category listing "Cat 1a" before "Cat 1c"
|
|
|
145 |
And I should see category listing "Cat 1c" before "Cat 2"
|
|
|
146 |
And I click to move category "CATC" up one
|
|
|
147 |
# Redirect. We should a 1, 1b, 1c, 1a, 2.
|
|
|
148 |
And I should see the "Course categories and courses" management page
|
|
|
149 |
And I should see category listing "Cat 1" before "Cat 1b"
|
|
|
150 |
And I should see category listing "Cat 1b" before "Cat 1c"
|
|
|
151 |
And I should see category listing "Cat 1c" before "Cat 1a"
|
|
|
152 |
And I should see category listing "Cat 1a" before "Cat 2"
|
|
|
153 |
And I click to move category "CATA" down one
|
|
|
154 |
# Redirect. We should a 1, 1b, 1c, 1a, 2.
|
|
|
155 |
And I should see the "Course categories and courses" management page
|
|
|
156 |
And I should see category listing "Cat 1" before "Cat 1b"
|
|
|
157 |
And I should see category listing "Cat 1b" before "Cat 1c"
|
|
|
158 |
And I should see category listing "Cat 1c" before "Cat 1a"
|
|
|
159 |
And I should see category listing "Cat 1a" before "Cat 2"
|
|
|
160 |
And I click to move category "CATB" up one
|
|
|
161 |
# Redirect. We should a 1, 1b, 1c, 1a, 2.
|
|
|
162 |
And I should see the "Course categories and courses" management page
|
|
|
163 |
And I should see category listing "Cat 1" before "Cat 1b"
|
|
|
164 |
And I should see category listing "Cat 1b" before "Cat 1c"
|
|
|
165 |
And I should see category listing "Cat 1c" before "Cat 1a"
|
|
|
166 |
And I should see category listing "Cat 1a" before "Cat 2"
|
|
|
167 |
And I click to move category "CAT2" up one
|
|
|
168 |
# Redirect. We should a 2, 1.
|
|
|
169 |
And I should see the "Course categories and courses" management page
|
|
|
170 |
And I should see category listing "Cat 2" before "Cat 1"
|
|
|
171 |
And I click on category "Cat 1" in the management interface
|
|
|
172 |
# Redirect. We should a 2, 1, 1b, 1c, 1a.
|
|
|
173 |
And I should see the "Course categories and courses" management page
|
|
|
174 |
And I should see category listing "Cat 2" before "Cat 1"
|
|
|
175 |
And I should see category listing "Cat 1" before "Cat 1b"
|
|
|
176 |
And I should see category listing "Cat 1b" before "Cat 1c"
|
|
|
177 |
And I should see category listing "Cat 1c" before "Cat 1a"
|
|
|
178 |
|
|
|
179 |
@javascript @_cross_browser
|
|
|
180 |
Scenario: Test using AJAX to move categories up and down by one.
|
|
|
181 |
Given the following "categories" exist:
|
|
|
182 |
| category | idnumber | name |
|
|
|
183 |
| 0 | CAT1 | Cat 1 |
|
|
|
184 |
| 0 | CAT2 | Cat 2 |
|
|
|
185 |
| CAT1 | CATA | Cat 1a |
|
|
|
186 |
| CAT1 | CATB | Cat 1b |
|
|
|
187 |
| CAT1 | CATC | Cat 1c |
|
|
|
188 |
|
|
|
189 |
And I log in as "admin"
|
|
|
190 |
And I go to the courses management page
|
|
|
191 |
And I start watching to see if a new page loads
|
|
|
192 |
And I should see the "Course categories and courses" management page
|
|
|
193 |
And I click on category "Cat 1" in the management interface
|
|
|
194 |
And a new page should have loaded since I started watching
|
|
|
195 |
And I start watching to see if a new page loads
|
|
|
196 |
And I should see the "Course categories and courses" management page
|
|
|
197 |
And I should see category listing "Cat 1" before "Cat 1a"
|
|
|
198 |
And I should see category listing "Cat 1a" before "Cat 1b"
|
|
|
199 |
And I should see category listing "Cat 1b" before "Cat 1c"
|
|
|
200 |
And I should see category listing "Cat 1c" before "Cat 2"
|
|
|
201 |
And I click to move category "CATA" down one
|
|
|
202 |
And a new page should not have loaded since I started watching
|
|
|
203 |
And I should see category listing "Cat 1" before "Cat 1b"
|
|
|
204 |
And I should see category listing "Cat 1b" before "Cat 1a"
|
|
|
205 |
And I should see category listing "Cat 1a" before "Cat 1c"
|
|
|
206 |
And I should see category listing "Cat 1c" before "Cat 2"
|
|
|
207 |
And I click to move category "CATC" up one
|
|
|
208 |
And a new page should not have loaded since I started watching
|
|
|
209 |
And I should see category listing "Cat 1" before "Cat 1b"
|
|
|
210 |
And I should see category listing "Cat 1b" before "Cat 1c"
|
|
|
211 |
And I should see category listing "Cat 1c" before "Cat 1a"
|
|
|
212 |
And I should see category listing "Cat 1a" before "Cat 2"
|