[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/course/tests/behat/ -> category_management.feature (source)

   1  @core @core_course
   2  Feature: Test category management actions
   3    As a moodle admin
   4    Test we can create a category
   5    Test we can create a sub category
   6    Test we can edit a category
   7    Test we can delete a category
   8    Test we can move a category
   9    Test we can assign roles within a category
  10    Test we can set permissions on a category
  11    Test we can manage cohorts within a category
  12    Test we can manage filters for a category
  13  
  14    Scenario: Test editing a category through the management interface.
  15      Given the following "categories" exist:
  16        | name | category | idnumber |
  17        | Cat 1 | 0 | CAT1 |
  18      And the following "courses" exist:
  19        | category | fullname | shortname | idnumber |
  20        | CAT1 | Course 1 | Course 1 | C1 |
  21  
  22      And I log in as "admin"
  23      And I go to the courses management page
  24      And I should see the "Course categories and courses" management page
  25      And I click on "edit" action for "Cat 1" in management category listing
  26      # Redirect
  27      And I should see "Edit category settings"
  28      And I should see "Cat 1"
  29      And I press "Cancel"
  30      # Redirect
  31      And I should see the "Course categories and courses" management page
  32      And I click on "edit" action for "Cat 1" in management category listing
  33      # Redirect
  34      And I should see "Edit category settings"
  35      And I should see "Cat 1"
  36      And I set the following fields to these values:
  37        | Category name | Category 1 (edited) |
  38        | Category ID number | CAT1e |
  39      And I press "Save changes"
  40      # Redirect
  41      And I should see the "Course categories and courses" management page
  42      And I should see "Category 1 (edited)" in the "#category-listing" "css_element"
  43      And I should see "Category 1 (edited)" in the "#course-listing h3" "css_element"
  44  
  45    Scenario: Test deleting a categories through the management interface.
  46      Given the following "categories" exist:
  47        | name | category | idnumber |
  48        | Cat 1 | 0 | CAT1 |
  49        | Cat 2 | 0 | CAT2 |
  50        | Cat 3 | 0 | CAT3 |
  51  
  52      And the following "courses" exist:
  53        | category | fullname | shortname | idnumber |
  54        | CAT3 | Course 1 | Course 1 | C1 |
  55  
  56      And I log in as "admin"
  57      And I go to the courses management page
  58      And I should see the "Course categories and courses" management page
  59      And I should see "Cat 1" in the "#category-listing ul.ml" "css_element"
  60      And I should see "Cat 2" in the "#category-listing ul.ml" "css_element"
  61      And I should see "Cat 3" in the "#category-listing ul.ml" "css_element"
  62      And I click on "delete" action for "Cat 2" in management category listing
  63      # Redirect
  64      And I should see "Delete category: Cat 2"
  65      And I should see "Contents of Cat 2"
  66      And I should see "This category is empty"
  67      And I press "Cancel"
  68      # Redirect
  69      And I should see the "Course categories and courses" management page
  70      And I should see "Cat 1" in the "#category-listing ul.ml" "css_element"
  71      And I should see "Cat 2" in the "#category-listing ul.ml" "css_element"
  72      And I should see "Cat 3" in the "#category-listing ul.ml" "css_element"
  73      And I click on "delete" action for "Cat 2" in management category listing
  74      # Redirect
  75      And I should see "Delete category: Cat 2"
  76      And I should see "Contents of Cat 2"
  77      And I should see "This category is empty"
  78      And I press "Delete"
  79      # Redirect
  80      And I should see "Delete category: Cat 2"
  81      And I should see "Deleted course category Cat 2"
  82      And I press "Continue"
  83      # Redirect
  84      And I should see the "Course categories and courses" management page
  85      And I should see "Cat 1" in the "#category-listing ul.ml" "css_element"
  86      And I should not see "Cat 2" in the "#category-listing ul.ml" "css_element"
  87      And I should see "Cat 3" in the "#category-listing ul.ml" "css_element"
  88      And I click on "delete" action for "Cat 3" in management category listing
  89      # Redirect
  90      And I should see "Delete category: Cat 3"
  91      And I set the following fields to these values:
  92        | What to do | Move contents to another category |
  93        | Move into  | Cat 1                             |
  94      And I press "Delete"
  95      # Redirect
  96      And I should see "Delete category: Cat 3"
  97      And I should see "Deleted course category Cat 3"
  98      And I press "Continue"
  99      # Redirect
 100      And I should see the "Course categories and courses" management page
 101      And I should see "Cat 1" in the "#category-listing ul.ml" "css_element"
 102      And I should not see "Cat 2" in the "#category-listing ul.ml" "css_element"
 103      And I should not see "Cat 3" in the "#category-listing ul.ml" "css_element"
 104      And I should see "Course 1" in the "#course-listing ul.ml" "css_element"
 105  
 106    Scenario: Test I can assign roles for a category through the management interface.
 107      Given the following "categories" exist:
 108        | name | category | idnumber |
 109        | Cat 1 | 0 | CAT1 |
 110      And the following "courses" exist:
 111        | category | fullname | shortname | idnumber |
 112        | CAT1 | Course 1 | Course 1 | C1 |
 113  
 114      And I log in as "admin"
 115      And I go to the courses management page
 116      And I should see the "Course categories and courses" management page
 117      And I click on "assignroles" action for "Cat 1" in management category listing
 118      # Redirect
 119      And I should see "Assign roles in Category: Cat 1"
 120      And I should see "Please choose a role to assign"
 121      And I click on "Back to Category: Cat 1" "link"
 122      # Redirect
 123      And I should see the "Course categories and courses" management page
 124      And I should see "Cat 1" in the "#course-listing h3" "css_element"
 125  
 126    Scenario: Test I can set access permissions for a category through the management interface.
 127      Given the following "categories" exist:
 128        | name | category | idnumber |
 129        | Cat 1 | 0 | CAT1 |
 130      And the following "courses" exist:
 131        | category | fullname | shortname | idnumber |
 132        | CAT1 | Course 1 | Course 1 | C1 |
 133  
 134      And I log in as "admin"
 135      And I go to the courses management page
 136      And I should see the "Course categories and courses" management page
 137      And I click on "permissions" action for "Cat 1" in management category listing
 138      # Redirect
 139      And I should see "Permissions in Category: Cat 1"
 140      And I click on "Back to Category: Cat 1" "link"
 141      # Redirect
 142      And I should see the "Course categories and courses" management page
 143      And I should see "Cat 1" in the "#course-listing h3" "css_element"
 144  
 145    Scenario: Test clicking to manage cohorts for a category through the management interface.
 146      Given the following "categories" exist:
 147        | name | category | idnumber |
 148        | Cat 1 | 0 | CAT1 |
 149      And the following "courses" exist:
 150        | category | fullname | shortname | idnumber |
 151        | CAT1 | Course 1 | Course 1 | C1 |
 152  
 153      And I log in as "admin"
 154      And I go to the courses management page
 155      And I should see the "Course categories and courses" management page
 156      And I click on "cohorts" action for "Cat 1" in management category listing
 157      # Redirect
 158      And I should see "Category: Cat 1: available cohorts"
 159  
 160    Scenario: Test configuring filters for a category
 161      Given the following "categories" exist:
 162        | name | category | idnumber |
 163        | Cat 1 | 0 | CAT1 |
 164      And the following "courses" exist:
 165        | category | fullname | shortname | idnumber |
 166        | CAT1 | Course 1 | Course 1 | C1 |
 167  
 168      And I log in as "admin"
 169      And I go to the courses management page
 170      And I should see the "Course categories and courses" management page
 171      And I click on "filters" action for "Cat 1" in management category listing
 172      # Redirect
 173      And I should see "Filter settings in Category: Cat 1"
 174      And I click on "Back to Category: Cat 1" "link"
 175      # Redirect
 176      And I should see the "Course categories and courses" management page
 177      And I should see "Cat 1" in the "#course-listing h3" "css_element"
 178  
 179    @javascript
 180    Scenario: Test that I can create a category and view it in the management interface
 181      Given the following "categories" exist:
 182        | name | category | idnumber |
 183        | Cat 1 | 0 | CAT1 |
 184      And I log in as "admin"
 185      And I go to the courses management page
 186      And I should see the "Course categories and courses" management page
 187      And I click on "Create new category" "link" in the ".category-listing-actions" "css_element"
 188      # Redirect.
 189      And I should see "Add new category"
 190      And I set the following fields to these values:
 191        | Parent category | Top |
 192        | Category name | Test category 2 |
 193        | Category ID number | TC2 |
 194      And I press "Create category"
 195      # Redirect
 196      And I should see the "Course categories and courses" management page
 197      And I should see "Test category 2" in the "#course-listing h3" "css_element"
 198      And I should see category listing "Cat 1" before "Test category 2"
 199      And I should see "No courses in this category"
 200      And I click on "createnewsubcategory" action for "Test category 2" in management category listing
 201      # Redirect
 202      And I should see "Add new category"
 203      And I set the following fields to these values:
 204        | Parent category | Top |
 205        | Category name | Test category 3 |
 206        | Category ID number | TC3 |
 207      And I press "Create category"
 208      # Redirect
 209      And I should see the "Course categories and courses" management page
 210      And I should see "Test category 3" in the "#course-listing h3" "css_element"
 211      And I should see category listing "Cat 1" before "Test category 2"
 212      And I should see "No courses in this category"
 213  
 214    @javascript
 215    Scenario: Test moving a categories through the management interface.
 216      Given the following "categories" exist:
 217        | name | category | idnumber |
 218        | Cat 1 | 0 | CAT1 |
 219        | Cat 2 | 0 | CAT2 |
 220        | Cat 3 | 0 | CAT3 |
 221  
 222      And I log in as "admin"
 223      And I go to the courses management page
 224      And I should see the "Course categories and courses" management page
 225      And I should see "Cat 1" in the "#category-listing ul.ml" "css_element"
 226      And I should see "Cat 2" in the "#category-listing ul.ml" "css_element"
 227      And I should see "Cat 3" in the "#category-listing ul.ml" "css_element"
 228      And I select category "Cat 2" in the management interface
 229      And I select category "Cat 3" in the management interface
 230      And I set the field "menumovecategoriesto" to "Cat 1"
 231      When I press "bulkmovecategories"
 232      # Redirect
 233      And I click on category "Cat 1" in the management interface
 234      # Redirect
 235      Then I should see category "CAT3" as subcategory of "CAT1" in the management interface
 236      And I move category "Cat 3" to top level in the management interface
 237      # Redirect
 238      And I should not see category "CAT3" as subcategory of "CAT1" in the management interface
 239      Then I should see category "CAT2" as subcategory of "CAT1" in the management interface
 240  
 241    @javascript
 242    Scenario: Test bulk action is shown only when some category/course is selected
 243      Given the following "categories" exist:
 244        | name | category | idnumber |
 245        | Cat 1 | 0 | CAT1 |
 246        | Cat 2 | 0 | CAT2 |
 247        | Cat 3 | 0 | CAT3 |
 248      And the following "courses" exist:
 249        | category | fullname | shortname | idnumber |
 250        | CAT3 | Course 1 | Course 1 | C1 |
 251        | CAT3 | Course 2 | Course 2 | C2 |
 252  
 253      And I log in as "admin"
 254      And I go to the courses management page
 255      And I should see the "Course categories and courses" management page
 256      And I should see "Cat 1" in the "#category-listing ul.ml" "css_element"
 257      And I should see "Cat 2" in the "#category-listing ul.ml" "css_element"
 258      And I should see "Cat 3" in the "#category-listing ul.ml" "css_element"
 259      And the "movecategoriesto" "select" should be disabled
 260      And the "resortcategoriesby" "select" should be disabled
 261      And the "resortcoursesby" "select" should be disabled
 262      When I set the field "selectsortby" to "allcategories"
 263      Then the "resortcategoriesby" "select" should be enabled
 264      And the "resortcoursesby" "select" should be enabled
 265      And the "movecategoriesto" "select" should be disabled
 266      And I select category "Cat 2" in the management interface
 267      And the "movecategoriesto" "select" should be enabled
 268      And the "resortcategoriesby" "select" should be enabled
 269      And the "resortcoursesby" "select" should be enabled
 270      And I set the field "selectsortby" to "selectedcategories"
 271      And the "movecategoriesto" "select" should be enabled
 272      And the "resortcategoriesby" "select" should be enabled
 273      And the "resortcoursesby" "select" should be enabled
 274      And I unselect category "Cat 2" in the management interface
 275      And the "movecategoriesto" "select" should be disabled
 276      And the "resortcategoriesby" "select" should be disabled
 277      And the "resortcoursesby" "select" should be disabled
 278      And I select category "Cat 3" in the management interface
 279      And the "movecategoriesto" "select" should be enabled
 280      And the "resortcategoriesby" "select" should be enabled
 281      And the "resortcoursesby" "select" should be enabled
 282      And I select category "Cat 2" in the management interface
 283      And the "movecategoriesto" "select" should be enabled
 284      And the "resortcategoriesby" "select" should be enabled
 285      And the "resortcoursesby" "select" should be enabled
 286      And I unselect category "Cat 2" in the management interface
 287      And I unselect category "Cat 3" in the management interface
 288      And the "movecategoriesto" "select" should be disabled
 289      And the "resortcategoriesby" "select" should be disabled
 290      And the "resortcoursesby" "select" should be disabled
 291      And I click on category "Cat 1" in the management interface
 292      # Redirect.
 293      And I should see the "Course categories and courses" management page
 294      And the "movecategoriesto" "select" should be disabled
 295      And the "resortcategoriesby" "select" should be disabled
 296      And the "resortcoursesby" "select" should be disabled
 297      And the "movecoursesto" "select" should be disabled
 298      And I click on category "Cat 3" in the management interface
 299      #Redirect
 300      And I should see the "Course categories and courses" management page
 301      And I should see "Course 1" in the "#course-listing ul.ml" "css_element"
 302      And I should see "Course 2" in the "#course-listing ul.ml" "css_element"
 303      And the "movecategoriesto" "select" should be disabled
 304      And the "resortcategoriesby" "select" should be disabled
 305      And the "resortcoursesby" "select" should be disabled
 306      And the "movecoursesto" "select" should be disabled
 307      And I select course "Course 1" in the management interface
 308      And the "movecoursesto" "select" should be enabled
 309      And the "movecategoriesto" "select" should be disabled
 310      And the "resortcategoriesby" "select" should be disabled
 311      And the "resortcoursesby" "select" should be disabled
 312      And I select course "Course 2" in the management interface
 313      And the "movecoursesto" "select" should be enabled
 314      And the "movecategoriesto" "select" should be disabled
 315      And the "resortcategoriesby" "select" should be disabled
 316      And the "resortcoursesby" "select" should be disabled
 317      And I select category "Cat 3" in the management interface
 318      And the "movecoursesto" "select" should be enabled
 319      And the "movecategoriesto" "select" should be enabled
 320      And the "resortcategoriesby" "select" should be enabled
 321      And the "resortcoursesby" "select" should be enabled
 322      And I unselect course "Course 2" in the management interface
 323      And the "movecoursesto" "select" should be enabled
 324      And the "movecategoriesto" "select" should be enabled
 325      And the "resortcategoriesby" "select" should be enabled
 326      And the "resortcoursesby" "select" should be enabled
 327      And I unselect course "Course 1" in the management interface
 328      And the "movecoursesto" "select" should be disabled
 329      And the "movecategoriesto" "select" should be enabled
 330      And the "resortcategoriesby" "select" should be enabled
 331      And the "resortcoursesby" "select" should be enabled
 332      And I unselect category "Cat 3" in the management interface
 333      And the "movecoursesto" "select" should be disabled
 334      And the "movecategoriesto" "select" should be disabled
 335      And the "resortcategoriesby" "select" should be disabled
 336      And the "resortcoursesby" "select" should be disabled
 337  
 338    Scenario: Test that is not possible to create a course category with a duplicate idnumber
 339      Given the following "categories" exist:
 340        | name | category | idnumber |
 341        | Cat 1 | 0 | CAT1 |
 342      And I log in as "admin"
 343      And I expand "Site administration" node
 344      And I expand "Courses" node
 345      And I follow "Add a category"
 346      And I set the following fields to these values:
 347        | Category name | Test duplicate |
 348        | Category ID number | CAT1 |
 349      When I press "Create category"
 350      Then I should see "ID number is already used for another category"


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1