| 1 | efrain | 1 | @core @core_course
 | 
        
           |  |  | 2 | Feature: We can change the visibility of categories in the management interface.
 | 
        
           |  |  | 3 |   As a moodle admin
 | 
        
           |  |  | 4 |   I need to test hiding and showing a category.
 | 
        
           |  |  | 5 |   I need to test hiding and showing a sub category.
 | 
        
           |  |  | 6 |   I need to test visibility is applied to sub categories.
 | 
        
           |  |  | 7 |   I need to test visibility is applied to courses.
 | 
        
           |  |  | 8 |   I need to test visibility of children is reset when changing back.
 | 
        
           |  |  | 9 |   | 
        
           |  |  | 10 |   # Tests hiding and then showing a single category.
 | 
        
           |  |  | 11 |   Scenario: Test making a category hidden and then visible again.
 | 
        
           |  |  | 12 |     Given the following "categories" exist:
 | 
        
           |  |  | 13 |       | name | category | idnumber |
 | 
        
           |  |  | 14 |       | Cat 1 | 0 | CAT1 |
 | 
        
           |  |  | 15 |   | 
        
           |  |  | 16 |     And I log in as "admin"
 | 
        
           |  |  | 17 |     And I go to the courses management page
 | 
        
           |  |  | 18 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 19 |     And I should see "Cat 1" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 20 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 21 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 22 |     # Redirect.
 | 
        
           |  |  | 23 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 24 |     And category in management listing should be dimmed "CAT1"
 | 
        
           |  |  | 25 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 26 |     # Redirect.
 | 
        
           |  |  | 27 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 28 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 29 |   | 
        
           |  |  | 30 |   # Tests hiding and then showing a single category.
 | 
        
           |  |  | 31 |   @javascript
 | 
        
           |  |  | 32 |   Scenario: Test using AJAX to make a category hidden and then visible again.
 | 
        
           |  |  | 33 |     Given the following "categories" exist:
 | 
        
           |  |  | 34 |       | name | category | idnumber |
 | 
        
           |  |  | 35 |       | Cat 1 | 0 | CAT1 |
 | 
        
           |  |  | 36 |   | 
        
           |  |  | 37 |     And I log in as "admin"
 | 
        
           |  |  | 38 |     And I go to the courses management page
 | 
        
           |  |  | 39 |     And I start watching to see if a new page loads
 | 
        
           |  |  | 40 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 41 |     And I should see "Cat 1" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 42 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 43 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 44 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 45 |     And category in management listing should be dimmed "CAT1"
 | 
        
           |  |  | 46 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 47 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 48 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 49 |   | 
        
           |  |  | 50 |   # Tests hiding and then showing a subcategory.
 | 
        
           |  |  | 51 |   Scenario: Test making a subcategory hidden and then visible again.
 | 
        
           |  |  | 52 |     Given the following "categories" exist:
 | 
        
           |  |  | 53 |       | name | category | idnumber |
 | 
        
           |  |  | 54 |       | Cat 1 | 0 | CAT1 |
 | 
        
           |  |  | 55 |       | Cat 2 | CAT1 | CAT2 |
 | 
        
           |  |  | 56 |   | 
        
           |  |  | 57 |     And I log in as "admin"
 | 
        
           |  |  | 58 |     And I go to the courses management page
 | 
        
           |  |  | 59 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 60 |     And I should see "Cat 1" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 61 |     And I should not see "Cat 2" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 62 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 63 |     And I click on category "Cat 1" in the management interface
 | 
        
           |  |  | 64 |     # Redirect.
 | 
        
           |  |  | 65 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 66 |     And I should see "Cat 1" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 67 |     And I should see "Cat 2" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 68 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 69 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 70 |     And I toggle visibility of category "CAT2" in management listing
 | 
        
           |  |  | 71 |     # Redirect.
 | 
        
           |  |  | 72 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 73 |     And I should see "Cat 1" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 74 |     And I should see "Cat 2" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 75 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 76 |     And category in management listing should be dimmed "CAT2"
 | 
        
           |  |  | 77 |     And I toggle visibility of category "CAT2" in management listing
 | 
        
           |  |  | 78 |     # Redirect.
 | 
        
           |  |  | 79 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 80 |     And I should see "Cat 1" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 81 |     And I should see "Cat 2" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 82 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 83 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 84 |   | 
        
           |  |  | 85 |   # Tests hiding and then showing a subcategory.
 | 
        
           |  |  | 86 |   @javascript
 | 
        
           |  |  | 87 |   Scenario: Test using AJAX to make a subcategory hidden and then visible again.
 | 
        
           |  |  | 88 |     Given the following "categories" exist:
 | 
        
           |  |  | 89 |       | name | category | idnumber |
 | 
        
           |  |  | 90 |       | Cat 1 | 0 | CAT1 |
 | 
        
           |  |  | 91 |       | Cat 2 | CAT1 | CAT2 |
 | 
        
           |  |  | 92 |   | 
        
           |  |  | 93 |     And I log in as "admin"
 | 
        
           |  |  | 94 |     And I go to the courses management page
 | 
        
           |  |  | 95 |     And I start watching to see if a new page loads
 | 
        
           |  |  | 96 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 97 |     And I should see "Cat 1" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 98 |     And I should not see "Cat 2" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 99 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 100 |     And I click to expand category "CAT1" in the management interface
 | 
        
           |  |  | 101 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 102 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 103 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 104 |     And I toggle visibility of category "CAT2" in management listing
 | 
        
           |  |  | 105 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 106 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 107 |     And category in management listing should be dimmed "CAT2"
 | 
        
           |  |  | 108 |     And I toggle visibility of category "CAT2" in management listing
 | 
        
           |  |  | 109 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 110 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 111 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 112 |   | 
        
           |  |  | 113 |   # The test below this is identical except with JavaScript enabled.
 | 
        
           |  |  | 114 |   Scenario: Test relation between category and course when changing visibility.
 | 
        
           |  |  | 115 |     Given the following "categories" exist:
 | 
        
           |  |  | 116 |       | name | category | idnumber |
 | 
        
           |  |  | 117 |       | Cat 1 | 0 | CAT1 |
 | 
        
           |  |  | 118 |       | Cat 2 | 0 | CAT2 |
 | 
        
           |  |  | 119 |       | Cat 3 | CAT1 | CAT3 |
 | 
        
           |  |  | 120 |       | Cat 4 | CAT1 | CAT4 |
 | 
        
           |  |  | 121 |     And the following "courses" exist:
 | 
        
           |  |  | 122 |       | category | fullname | shortname | idnumber |
 | 
        
           |  |  | 123 |       | CAT1 | Course 1 | Course 1 | C1 |
 | 
        
           |  |  | 124 |       | CAT1 | Course 2 | Course 2 | C2 |
 | 
        
           |  |  | 125 |       | CAT1 | Course 3 | Course 3 | C3 |
 | 
        
           |  |  | 126 |   | 
        
           |  |  | 127 |     And I log in as "admin"
 | 
        
           |  |  | 128 |     And I go to the courses management page
 | 
        
           |  |  | 129 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 130 |     And I click on category "Cat 1" in the management interface
 | 
        
           |  |  | 131 |     # Redirect.
 | 
        
           |  |  | 132 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 133 |     And I should see "Cat 1" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 134 |     And I should see "Cat 2" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 135 |     And I should see "Cat 3" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 136 |     And I should see "Cat 4" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 137 |     And I should see "Course 1" in the "#course-listing ul.course-list" "css_element"
 | 
        
           |  |  | 138 |     And I should see "Course 2" in the "#course-listing ul.course-list" "css_element"
 | 
        
           |  |  | 139 |     And I should see "Course 3" in the "#course-listing ul.course-list" "css_element"
 | 
        
           |  |  | 140 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 141 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 142 |     And category in management listing should be visible "CAT3"
 | 
        
           |  |  | 143 |     And category in management listing should be visible "CAT4"
 | 
        
           |  |  | 144 |     And course in management listing should be visible "C1"
 | 
        
           |  |  | 145 |     And course in management listing should be visible "C2"
 | 
        
           |  |  | 146 |     And course in management listing should be visible "C3"
 | 
        
           |  |  | 147 |     And I toggle visibility of course "C2" in management listing
 | 
        
           |  |  | 148 |     # Redirect.
 | 
        
           |  |  | 149 |     And I should see the "Course categories and courses" management page with a course selected
 | 
        
           |  |  | 150 |     And course in management listing should be visible "C1"
 | 
        
           |  |  | 151 |     And course in management listing should be dimmed "C2"
 | 
        
           |  |  | 152 |     And course in management listing should be visible "C3"
 | 
        
           |  |  | 153 |     And I toggle visibility of category "CAT3" in management listing
 | 
        
           |  |  | 154 |     # Redirect.
 | 
        
           |  |  | 155 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 156 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 157 |     # Redirect.
 | 
        
           |  |  | 158 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 159 |     And category in management listing should be dimmed "CAT1"
 | 
        
           |  |  | 160 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 161 |     And category in management listing should be dimmed "CAT3"
 | 
        
           |  |  | 162 |     And category in management listing should be dimmed "CAT4"
 | 
        
           |  |  | 163 |     And course in management listing should be dimmed "C1"
 | 
        
           |  |  | 164 |     And course in management listing should be dimmed "C2"
 | 
        
           |  |  | 165 |     And course in management listing should be dimmed "C3"
 | 
        
           |  |  | 166 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 167 |     # Redirect.
 | 
        
           |  |  | 168 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 169 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 170 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 171 |     And category in management listing should be dimmed "CAT3"
 | 
        
           |  |  | 172 |     And category in management listing should be visible "CAT4"
 | 
        
           |  |  | 173 |     And course in management listing should be visible "C1"
 | 
        
           |  |  | 174 |     And course in management listing should be dimmed "C2"
 | 
        
           |  |  | 175 |     And course in management listing should be visible "C3"
 | 
        
           |  |  | 176 |   | 
        
           |  |  | 177 |   # The test above this is identical except without JavaScript enabled.
 | 
        
           |  |  | 178 |   @javascript @_cross_browser
 | 
        
           |  |  | 179 |   Scenario: Test the relation between category and course when changing visibility with AJAX
 | 
        
           |  |  | 180 |     Given the following "categories" exist:
 | 
        
           |  |  | 181 |       | name | category | idnumber |
 | 
        
           |  |  | 182 |       | Cat 1 | 0 | CAT1 |
 | 
        
           |  |  | 183 |       | Cat 2 | 0 | CAT2 |
 | 
        
           |  |  | 184 |       | Cat 3 | CAT1 | CAT3 |
 | 
        
           |  |  | 185 |       | Cat 4 | CAT1 | CAT4 |
 | 
        
           |  |  | 186 |     And the following "courses" exist:
 | 
        
           |  |  | 187 |       | category | fullname | shortname | idnumber |
 | 
        
           |  |  | 188 |       | CAT1 | Course 1 | Course 1 | C1 |
 | 
        
           |  |  | 189 |       | CAT1 | Course 2 | Course 2 | C2 |
 | 
        
           |  |  | 190 |       | CAT1 | Course 3 | Course 3 | C3 |
 | 
        
           |  |  | 191 |   | 
        
           |  |  | 192 |     And I log in as "admin"
 | 
        
           |  |  | 193 |     And I go to the courses management page
 | 
        
           |  |  | 194 |     And I start watching to see if a new page loads
 | 
        
           |  |  | 195 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 196 |     And I click on category "Cat 1" in the management interface
 | 
        
           |  |  | 197 |     And a new page should have loaded since I started watching
 | 
        
           |  |  | 198 |     And I start watching to see if a new page loads
 | 
        
           |  |  | 199 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 200 |     And I should see "Cat 1" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 201 |     And I should see "Cat 2" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 202 |     And I should see "Cat 3" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 203 |     And I should see "Cat 4" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 204 |     And I should see "Course 1" in the "#course-listing ul.course-list" "css_element"
 | 
        
           |  |  | 205 |     And I should see "Course 2" in the "#course-listing ul.course-list" "css_element"
 | 
        
           |  |  | 206 |     And I should see "Course 3" in the "#course-listing ul.course-list" "css_element"
 | 
        
           |  |  | 207 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 208 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 209 |     And category in management listing should be visible "CAT3"
 | 
        
           |  |  | 210 |     And category in management listing should be visible "CAT4"
 | 
        
           |  |  | 211 |     And course in management listing should be visible "C1"
 | 
        
           |  |  | 212 |     And course in management listing should be visible "C2"
 | 
        
           |  |  | 213 |     And course in management listing should be visible "C3"
 | 
        
           |  |  | 214 |     And I toggle visibility of course "C2" in management listing
 | 
        
           |  |  | 215 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 216 |     And I should see "Cat 3" in the "#category-listing ul" "css_element"
 | 
        
           |  |  | 217 |     And course in management listing should be visible "C1"
 | 
        
           |  |  | 218 |     And course in management listing should be dimmed "C2"
 | 
        
           |  |  | 219 |     And course in management listing should be visible "C3"
 | 
        
           |  |  | 220 |     And I toggle visibility of category "CAT3" in management listing
 | 
        
           |  |  | 221 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 222 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 223 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 224 |     And category in management listing should be dimmed "CAT3"
 | 
        
           |  |  | 225 |     And category in management listing should be visible "CAT4"
 | 
        
           |  |  | 226 |     And course in management listing should be visible "C1"
 | 
        
           |  |  | 227 |     And course in management listing should be dimmed "C2"
 | 
        
           |  |  | 228 |     And course in management listing should be visible "C3"
 | 
        
           |  |  | 229 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           | 1441 | ariadna | 230 |     And I click on "Hide" "button" in the "Hide category?" "dialogue"
 | 
        
           | 1 | efrain | 231 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 232 |     And category in management listing should be dimmed "CAT1"
 | 
        
           |  |  | 233 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 234 |     And category in management listing should be dimmed "CAT3"
 | 
        
           |  |  | 235 |     And category in management listing should be dimmed "CAT4"
 | 
        
           |  |  | 236 |     And course in management listing should be dimmed "C1"
 | 
        
           |  |  | 237 |     And course in management listing should be dimmed "C2"
 | 
        
           |  |  | 238 |     And course in management listing should be dimmed "C3"
 | 
        
           |  |  | 239 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 240 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 241 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 242 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 243 |     And category in management listing should be dimmed "CAT3"
 | 
        
           |  |  | 244 |     And category in management listing should be visible "CAT4"
 | 
        
           |  |  | 245 |     And course in management listing should be visible "C1"
 | 
        
           |  |  | 246 |     And course in management listing should be dimmed "C2"
 | 
        
           |  |  | 247 |     And course in management listing should be visible "C3"
 | 
        
           |  |  | 248 |   | 
        
           |  |  | 249 |   @javascript @_cross_browser
 | 
        
           |  |  | 250 |   Scenario: Test courses are hidden when selected category parent is hidden.
 | 
        
           |  |  | 251 |     Given the following "categories" exist:
 | 
        
           |  |  | 252 |       | name | category | idnumber |
 | 
        
           |  |  | 253 |       | Cat 1 | 0 | CAT1 |
 | 
        
           |  |  | 254 |       | Cat 2 | CAT1 | CAT2 |
 | 
        
           |  |  | 255 |       | Cat 3 | CAT2 | CAT3 |
 | 
        
           |  |  | 256 |     And the following "courses" exist:
 | 
        
           |  |  | 257 |       | category | fullname | shortname | idnumber |
 | 
        
           |  |  | 258 |       | CAT3 | Course 1 | Course 1 | C1 |
 | 
        
           |  |  | 259 |   | 
        
           |  |  | 260 |     And I log in as "admin"
 | 
        
           |  |  | 261 |     And I go to the courses management page
 | 
        
           |  |  | 262 |     And I start watching to see if a new page loads
 | 
        
           |  |  | 263 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 264 |     And I click on category "Cat 1" in the management interface
 | 
        
           |  |  | 265 |     And a new page should have loaded since I started watching
 | 
        
           |  |  | 266 |     And I start watching to see if a new page loads
 | 
        
           |  |  | 267 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 268 |     And I click on category "Cat 2" in the management interface
 | 
        
           |  |  | 269 |     And a new page should have loaded since I started watching
 | 
        
           |  |  | 270 |     And I start watching to see if a new page loads
 | 
        
           |  |  | 271 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 272 |     And I click on category "Cat 3" in the management interface
 | 
        
           |  |  | 273 |     And a new page should have loaded since I started watching
 | 
        
           |  |  | 274 |     And I start watching to see if a new page loads
 | 
        
           |  |  | 275 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 276 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 277 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 278 |     And category in management listing should be visible "CAT3"
 | 
        
           |  |  | 279 |     And course in management listing should be visible "C1"
 | 
        
           |  |  | 280 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           | 1441 | ariadna | 281 |     And I click on "Hide" "button" in the "Hide category?" "dialogue"
 | 
        
           | 1 | efrain | 282 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 283 |     And category in management listing should be dimmed "CAT1"
 | 
        
           |  |  | 284 |     And category in management listing should be dimmed "CAT2"
 | 
        
           |  |  | 285 |     And category in management listing should be dimmed "CAT3"
 | 
        
           |  |  | 286 |     And course in management listing should be dimmed "C1"
 | 
        
           |  |  | 287 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 288 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 289 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 290 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 291 |     And category in management listing should be visible "CAT3"
 | 
        
           |  |  | 292 |     And course in management listing should be visible "C1"
 | 
        
           |  |  | 293 |     And I toggle visibility of course "C1" in management listing
 | 
        
           |  |  | 294 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 295 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 296 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 297 |     And category in management listing should be visible "CAT3"
 | 
        
           |  |  | 298 |     And course in management listing should be dimmed "C1"
 | 
        
           |  |  | 299 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           | 1441 | ariadna | 300 |     And I click on "Hide" "button" in the "Hide category?" "dialogue"
 | 
        
           | 1 | efrain | 301 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 302 |     And category in management listing should be dimmed "CAT1"
 | 
        
           |  |  | 303 |     And category in management listing should be dimmed "CAT2"
 | 
        
           |  |  | 304 |     And category in management listing should be dimmed "CAT3"
 | 
        
           |  |  | 305 |     And course in management listing should be dimmed "C1"
 | 
        
           |  |  | 306 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 307 |     And a new page should not have loaded since I started watching
 | 
        
           |  |  | 308 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 309 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 310 |     And category in management listing should be visible "CAT3"
 | 
        
           |  |  | 311 |     And course in management listing should be dimmed "C1"
 | 
        
           | 1441 | ariadna | 312 |   | 
        
           |  |  | 313 |   @javascript
 | 
        
           |  |  | 314 |   Scenario: Test confirm popup when hiding a category
 | 
        
           |  |  | 315 |     Given the following "categories" exist:
 | 
        
           |  |  | 316 |       | name   | category | idnumber |
 | 
        
           |  |  | 317 |       | Cat 1  | 0        | CAT1     |
 | 
        
           |  |  | 318 |       | Cat 1b | CAT1     | CAT1B    |
 | 
        
           |  |  | 319 |       | Cat 1c | CAT1     | CAT1C    |
 | 
        
           |  |  | 320 |       | Cat 2  | 0        | CAT2     |
 | 
        
           |  |  | 321 |     And the following "courses" exist:
 | 
        
           |  |  | 322 |       | category | fullname | shortname | idnumber |
 | 
        
           |  |  | 323 |       | CAT1B    | Course 1 | Course 1  | C1       |
 | 
        
           |  |  | 324 |       | CAT1B    | Course 2 | Course 2  | C2       |
 | 
        
           |  |  | 325 |       | CAT1C    | Course 3 | Course 3  | C3       |
 | 
        
           |  |  | 326 |     And I log in as "admin"
 | 
        
           |  |  | 327 |     And I go to the courses management page
 | 
        
           |  |  | 328 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 329 |     And I click on category "Cat 1" in the management interface
 | 
        
           |  |  | 330 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 331 |     And category in management listing should be visible "CAT1B"
 | 
        
           |  |  | 332 |     And category in management listing should be visible "CAT1C"
 | 
        
           |  |  | 333 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 334 |   | 
        
           |  |  | 335 |     # Category should not be hidden if the dialogue is cancelled.
 | 
        
           |  |  | 336 |     And I toggle visibility of category "CAT1C" in management listing
 | 
        
           |  |  | 337 |     And I should see "The category Cat 1c contains 1 course" in the "Hide category?" "dialogue"
 | 
        
           |  |  | 338 |     And I click on "Cancel" "button" in the "Hide category?" "dialogue"
 | 
        
           |  |  | 339 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 340 |     And category in management listing should be visible "CAT1B"
 | 
        
           |  |  | 341 |     And category in management listing should be visible "CAT1C"
 | 
        
           |  |  | 342 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 343 |   | 
        
           |  |  | 344 |     # Hide CAT1 - course count should include courses all subcategories.
 | 
        
           |  |  | 345 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 346 |     And I should see "The category Cat 1 contains 3 courses" in the "Hide category?" "dialogue"
 | 
        
           |  |  | 347 |     And I click on "Hide" "button" in the "Hide category?" "dialogue"
 | 
        
           |  |  | 348 |     And category in management listing should be dimmed "CAT1"
 | 
        
           |  |  | 349 |     And category in management listing should be dimmed "CAT1B"
 | 
        
           |  |  | 350 |     And category in management listing should be dimmed "CAT1C"
 | 
        
           |  |  | 351 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 352 |   | 
        
           |  |  | 353 |     # Dialogue should not show when showing a category.
 | 
        
           |  |  | 354 |     And I toggle visibility of category "CAT1" in management listing
 | 
        
           |  |  | 355 |     And "Hide category?" "dialogue" should not exist
 | 
        
           |  |  | 356 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 357 |     And category in management listing should be visible "CAT1B"
 | 
        
           |  |  | 358 |     And category in management listing should be visible "CAT1C"
 | 
        
           |  |  | 359 |     And category in management listing should be visible "CAT2"
 | 
        
           |  |  | 360 |   | 
        
           |  |  | 361 |     # Dialogue should not show when hiding a category that contains no courses.
 | 
        
           |  |  | 362 |     And I toggle visibility of category "CAT2" in management listing
 | 
        
           |  |  | 363 |     And "Hide category?" "dialogue" should not exist
 | 
        
           |  |  | 364 |     And category in management listing should be visible "CAT1"
 | 
        
           |  |  | 365 |     And category in management listing should be visible "CAT1B"
 | 
        
           |  |  | 366 |     And category in management listing should be visible "CAT1C"
 | 
        
           |  |  | 367 |     And category in management listing should be dimmed "CAT2"
 |