2 Feature: Test we can resort categories in the management interface.
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.
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 |
15 And I log in as "admin"
16 And I go to the courses management page
17 And I should see the "Course categories" management page
18 And I set the field "menuselectsortby" to "All categories"
19 And I set the field "menuresortcategoriesby" to <sortby>
22 And I should see the "Course categories" management page
23 And I should see category listing <cat1> before <cat2>
24 And I should see category listing <cat2> before <cat3>
27 | sortby | cat1 | cat2 | cat3 |
28 | "Sort categories by name" | "Applied sciences" | "Extended social studies" | "Social studies" |
29 | "Sort categories by ID number" | "Extended social studies" | "Social studies" | "Applied sciences" |
31 Scenario Outline: Test bulk sorting current category.
32 Given the following "categories" exist:
33 | category | name | idnumber | sortorder |
34 | 0 | Test category | Tes001 | 1 |
35 | Tes001 | Social studies | Ext003 | 2 |
36 | Tes001 | Applied sciences | Sci001 | 3 |
37 | Tes001 | Extended social studies | Ext002 | 4 |
39 And I log in as "admin"
40 And I go to the courses management page
41 And I should see the "Course categories" management page
42 And I click on "Test category" "link"
44 And I should see the "Course categories and courses" management page
45 And I set the field "menuselectsortby" to "This category"
46 And I set the field "menuresortcategoriesby" to <sortby>
49 And I should see the "Course categories and courses" management page
50 And I should see category listing <cat1> before <cat2>
51 And I should see category listing <cat2> before <cat3>
54 | sortby | cat1 | cat2 | cat3 |
55 | "Sort categories by name" | "Applied sciences" | "Extended social studies" | "Social studies" |
56 | "Sort categories by ID number" | "Extended social studies" | "Social studies" | "Applied sciences" |
58 Scenario Outline: Test resorting subcategories.
59 Given the following "categories" exist:
60 | category | name | idnumber | sortorder |
61 | 0 | Master cat | CAT1 | 1 |
62 | CAT1 | Social studies | Ext003 | 1 |
63 | CAT1 | Applied sciences | Sci001 | 2 |
64 | CAT1 | Extended social studies | Ext002 | 3 |
66 And I log in as "admin"
67 And I go to the courses management page
68 And I should see the "Course categories" management page
69 And I click on "Master cat" "link"
71 And I should see the "Course categories and courses" management page
72 And I click on <sortby> action for "Master cat" in management category listing
74 And I should see the "Course categories and courses" management page
75 And I should see category listing <cat1> before <cat2>
76 And I should see category listing <cat2> before <cat3>
79 | sortby | cat1 | cat2 | cat3 |
80 | "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
81 | "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
84 Scenario Outline: Test resorting subcategories with JS enabled.
85 Given the following "categories" exist:
86 | category | name | idnumber | sortorder |
87 | 0 | Master cat | CAT1 | 1 |
88 | CAT1 | Social studies | Ext003 | 1 |
89 | CAT1 | Applied sciences | Sci001 | 2 |
90 | CAT1 | Extended social studies | Ext002 | 3 |
92 And I log in as "admin"
93 And I go to the courses management page
94 And I should see the "Course categories" management page
95 And I click on "Master cat" category in the management category listing
97 And I should see the "Course categories and courses" management page
98 And I click on <sortby> action for "Master cat" in management category listing
100 And I should see the "Course categories and courses" management page
101 And I should see category listing <cat1> before <cat2>
102 And I should see category listing <cat2> before <cat3>
105 | sortby | cat1 | cat2 | cat3 |
106 | "resortbyname" | "Applied sciences" | "Extended social studies" | "Social studies" |
107 | "resortbyidnumber" | "Extended social studies" | "Social studies" | "Applied sciences" |
109 # The scenario below this is the same but with JS enabled.
110 Scenario: Test moving categories up and down by one.
111 Given the following "categories" exist:
112 | category | idnumber | name |
115 | CAT1 | CATA | Cat 1a |
116 | CAT1 | CATB | Cat 1b |
117 | CAT1 | CATC | Cat 1c |
119 And I log in as "admin"
120 And I go to the courses management page
121 And I should see the "Course categories" management page
122 And I click on category "Cat 1" in the management interface
123 # Redirect. We should a 1, 1a, 1b, 1c, 2.
124 And I should see the "Course categories and courses" management page
125 And I should see category listing "Cat 1" before "Cat 1a"
126 And I should see category listing "Cat 1a" before "Cat 1b"
127 And I should see category listing "Cat 1b" before "Cat 1c"
128 And I should see category listing "Cat 1c" before "Cat 2"
129 And I click to move category "CATA" down one
130 # Redirect.We should a 1, 1b, 1a, 1c, 2.
131 And I should see the "Course categories and courses" management page
132 And I should see category listing "Cat 1" before "Cat 1b"
133 And I should see category listing "Cat 1b" before "Cat 1a"
134 And I should see category listing "Cat 1a" before "Cat 1c"
135 And I should see category listing "Cat 1c" before "Cat 2"
136 And I click to move category "CATC" up one
137 # Redirect. We should a 1, 1b, 1c, 1a, 2.
138 And I should see the "Course categories and courses" management page
139 And I should see category listing "Cat 1" before "Cat 1b"
140 And I should see category listing "Cat 1b" before "Cat 1c"
141 And I should see category listing "Cat 1c" before "Cat 1a"
142 And I should see category listing "Cat 1a" before "Cat 2"
143 And I click to move category "CATA" down one
144 # Redirect. We should a 1, 1b, 1c, 1a, 2.
145 And I should see the "Course categories and courses" management page
146 And I should see category listing "Cat 1" before "Cat 1b"
147 And I should see category listing "Cat 1b" before "Cat 1c"
148 And I should see category listing "Cat 1c" before "Cat 1a"
149 And I should see category listing "Cat 1a" before "Cat 2"
150 And I click to move category "CATB" up one
151 # Redirect. We should a 1, 1b, 1c, 1a, 2.
152 And I should see the "Course categories and courses" management page
153 And I should see category listing "Cat 1" before "Cat 1b"
154 And I should see category listing "Cat 1b" before "Cat 1c"
155 And I should see category listing "Cat 1c" before "Cat 1a"
156 And I should see category listing "Cat 1a" before "Cat 2"
157 And I click to move category "CAT2" up one
158 # Redirect. We should a 2, 1.
159 And I should see the "Course categories and courses" management page
160 And I should see category listing "Cat 2" before "Cat 1"
161 And I click on category "Cat 1" in the management interface
162 # Redirect. We should a 2, 1, 1b, 1c, 1a.
163 And I should see the "Course categories and courses" management page
164 And I should see category listing "Cat 2" before "Cat 1"
165 And I should see category listing "Cat 1" before "Cat 1b"
166 And I should see category listing "Cat 1b" before "Cat 1c"
167 And I should see category listing "Cat 1c" before "Cat 1a"
169 @javascript @_cross_browser
170 Scenario: Test using AJAX to move categories up and down by one.
171 Given the following "categories" exist:
172 | category | idnumber | name |
175 | CAT1 | CATA | Cat 1a |
176 | CAT1 | CATB | Cat 1b |
177 | CAT1 | CATC | Cat 1c |
179 And I log in as "admin"
180 And I go to the courses management page
181 And I should see the "Course categories" management page
182 And I click on category "Cat 1" in the management interface
184 And I should see the "Course categories and courses" management page
185 And I should see category listing "Cat 1" before "Cat 1a"
186 And I should see category listing "Cat 1a" before "Cat 1b"
187 And I should see category listing "Cat 1b" before "Cat 1c"
188 And I should see category listing "Cat 1c" before "Cat 2"
189 And I click to move category "CATA" down one
190 # AJAX request. No redirect.We should a 1, 1b, 1a, 1c, 2.
191 And I should see category listing "Cat 1" before "Cat 1b"
192 And I should see category listing "Cat 1b" before "Cat 1a"
193 And I should see category listing "Cat 1a" before "Cat 1c"
194 And I should see category listing "Cat 1c" before "Cat 2"
195 And I click to move category "CATC" up one
196 # AJAX request. No redirect. We should a 1, 1b, 1c, 1a, 2.
197 And I should see category listing "Cat 1" before "Cat 1b"
198 And I should see category listing "Cat 1b" before "Cat 1c"
199 And I should see category listing "Cat 1c" before "Cat 1a"
200 And I should see category listing "Cat 1a" before "Cat 2"