AutorÃa | Ultima modificación | Ver Log |
@core @core_courseFeature: Test category management actionsAs a moodle adminTest we can create a categoryTest we can create a sub categoryTest we can edit a categoryTest we can delete a categoryTest deleting categories interface when user permissions are restrictedTest we can move a categoryTest we can assign roles within a categoryTest we can set permissions on a categoryTest we can manage cohorts within a categoryTest we can manage filters for a categoryScenario: Test editing a category through the management interface.Given the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 |And the following "courses" exist:| category | fullname | shortname | idnumber || CAT1 | Course 1 | Course 1 | C1 |And I log in as "admin"And I go to the courses management pageAnd I should see the "Course categories and courses" management pageAnd I click on "edit" action for "Cat 1" in management category listing# RedirectAnd I should see "Edit category settings"And I should see "Cat 1"And I press "Cancel"# RedirectAnd I should see the "Course categories and courses" management pageAnd I click on "edit" action for "Cat 1" in management category listing# RedirectAnd I should see "Edit category settings"And I should see "Cat 1"And I set the following fields to these values:| Category name | Category 1 (edited) || Category ID number | CAT1e |And I press "Save changes"# RedirectAnd I should see the "Course categories and courses" management pageAnd I should see "Category 1 (edited)" in the "#category-listing" "css_element"And I should see "Category 1 (edited)" in the "#course-listing h3" "css_element"@javascriptScenario: Test deleting a categories through the management interface.Given the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 || Cat 2 | 0 | CAT2 || Cat 3 | 0 | CAT3 |And the following "courses" exist:| category | fullname | shortname | idnumber || CAT3 | Course 1 | Course 1 | C1 |And I log in as "admin"And I go to the courses management pageAnd I should see the "Course categories and courses" management pageAnd I should see "Cat 1" in the "#category-listing ul" "css_element"And I should see "Cat 2" in the "#category-listing ul" "css_element"And I should see "Cat 3" in the "#category-listing ul" "css_element"And I click on "delete" action for "Cat 2" in management category listing# RedirectAnd I should see "Delete category: Cat 2"And I should see "Contents of Cat 2"And I should see "This category is empty"And I press "Cancel"# RedirectAnd I should see the "Course categories and courses" management pageAnd I should see "Cat 1" in the "#category-listing ul" "css_element"And I should see "Cat 2" in the "#category-listing ul" "css_element"And I should see "Cat 3" in the "#category-listing ul" "css_element"And I click on "delete" action for "Cat 2" in management category listing# RedirectAnd I should see "Delete category: Cat 2"And I should see "Contents of Cat 2"And I should see "This category is empty"And I press "Delete"# RedirectAnd I should see "Delete category: Cat 2"And I should see "Deleted course category Cat 2"And I press "Continue"# RedirectAnd I should see the "Course categories and courses" management pageAnd I should see "Cat 1" in the "#category-listing ul" "css_element"And I should not see "Cat 2" in the "#category-listing ul" "css_element"And I should see "Cat 3" in the "#category-listing ul" "css_element"And I click on "delete" action for "Cat 3" in management category listing# RedirectAnd I should see "Delete category: Cat 3"And I set the following fields to these values:| What to do | Move contents to another category || Move into | Cat 1 |And I press "Delete"# RedirectAnd I should see "Delete category: Cat 3"And I should see "Deleted course category Cat 3"And I press "Continue"# RedirectAnd I should see the "Course categories and courses" management pageAnd I should see "Cat 1" in the "#category-listing ul" "css_element"And I should not see "Cat 2" in the "#category-listing ul" "css_element"And I should not see "Cat 3" in the "#category-listing ul" "css_element"And I should see "Course 1" in the "#course-listing ul.course-list" "css_element"Scenario: Test deleting categories action is not listed when permissions are restricted.Given the following "users" exist:| username | firstname | lastname || manager | Manager | Manager |And the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 || Cat 2 | 0 | CAT2 |And the following "courses" exist:| category | fullname | shortname || CAT1 | Course 1 | C1 |And the following "system role assigns" exist:| user | role | contextlevel || manager | manager | System |And the following "permission overrides" exist:| capability | permission | role | contextlevel | reference || moodle/course:delete | Prevent | manager | Course | C1 || moodle/course:create | Prevent | manager | System | |When I log in as "manager"And I go to the courses management pageThen I should see the "Course categories and courses" management pageAnd I should see "Cat 1" in the "#category-listing ul" "css_element"And I should see "Cat 2" in the "#category-listing ul" "css_element"And I open the action menu for "Cat 1" in management category listingAnd "Cat 1" category actions menu should not have "Delete" itemScenario: Test deleting categories interface when course create permission is restricted in system.Given the following "users" exist:| username | firstname | lastname || manager | Manager | Manager |And the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 || Cat 2 | 0 | CAT2 |And the following "courses" exist:| category | fullname | shortname || CAT1 | Course 1 | C1 |And the following "system role assigns" exist:| user | role | contextlevel || manager | manager | System |And the following "permission overrides" exist:| capability | permission | role | contextlevel | reference || moodle/course:delete | Allow | manager | Course | C1 || moodle/course:create | Prevent | manager | System | |When I log in as "manager"And I go to the courses management pageAnd I open the action menu for "Cat 1" in management category listingThen "Cat 1" category actions menu should have "Delete" itemAnd I click on "delete" action for "Cat 1" in management category listing# RedirectAnd I should see "Delete category: Cat 1"And I should see "Contents of Cat 1"And I should see "Delete all - cannot be undone"And "What to do" "select" should not existAnd "Move into" "select" should not existAnd I press "Cancel"Scenario: Test deleting categories interface when course delete permission is restricted for category.Given the following "users" exist:| username | firstname | lastname || manager | Manager | Manager |And the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 || Cat 2 | 0 | CAT2 |And the following "courses" exist:| category | fullname | shortname || CAT1 | Course 1 | C1 |And the following "system role assigns" exist:| user | role | contextlevel || manager | manager | System |And the following "permission overrides" exist:| capability | permission | role | contextlevel | reference || moodle/course:delete | Prevent | manager | Course | C1 || moodle/course:create | Allow | manager | System | |When I log in as "manager"And I go to the courses management pageAnd I open the action menu for "Cat 1" in management category listingThen "Cat 1" category actions menu should have "Delete" itemAnd I click on "delete" action for "Cat 1" in management category listing# RedirectAnd I should see "Delete category: Cat 1"And I should see "Contents of Cat 1"And I should see "Move contents to another category"And "What to do" "select" should not existAnd "Move into" "select" should existAnd the "Move into" select box should contain "Cat 2"And the "Move into" select box should contain "Category 1"And I press "Cancel"@javascriptScenario: Test deleting categories interface when course create permissions are restricted for some categories.Given the following "users" exist:| username | firstname | lastname || manager | Manager | Manager |And the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 || Cat 2 | 0 | CAT2 |And the following "courses" exist:| category | fullname | shortname || CAT1 | Course 1 | C1 |And the following "system role assigns" exist:| user | role | contextlevel || manager | manager | System |And the following "permission overrides" exist:| capability | permission | role | contextlevel | reference || moodle/course:delete | Allow | manager | Course | C1 || moodle/course:create | Allow | manager | System | || moodle/course:create | Prevent | manager | Category | CAT2 |When I log in as "manager"And I go to the courses management pageAnd I open the action menu for "Cat 1" in management category listingThen "Cat 1" category actions menu should have "Delete" itemAnd I click on "delete" action for "Cat 1" in management category listing# RedirectAnd I should see "Delete category: Cat 1"And I should see "Contents of Cat 1"And "What to do" "select" should existAnd I expand the "Move into" autocompleteAnd "Cat 2" "autocomplete_suggestions" should not existAnd "Category 1" "autocomplete_selection" should be visibleAnd I set the field "What to do" to "Delete all - cannot be undone"And "Move into" "select" should not be visibleAnd I press "Cancel"@javascriptScenario: Test I can assign roles for a category through the management interface.Given the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 |And the following "courses" exist:| category | fullname | shortname | idnumber || CAT1 | Course 1 | Course 1 | C1 |And I log in as "admin"And I go to the courses management pageAnd I should see the "Course categories and courses" management pageAnd I click on "permissions" action for "Cat 1" in management category listingAnd I set the field "Participants tertiary navigation" to "Assign roles"# RedirectAnd I should see "Assign roles in Category: Cat 1"And I should see "Please choose a role to assign"Scenario: Test I can set access permissions for a category through the management interface.Given the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 |And the following "courses" exist:| category | fullname | shortname | idnumber || CAT1 | Course 1 | Course 1 | C1 |And I log in as "admin"And I go to the courses management pageAnd I should see the "Course categories and courses" management pageAnd I click on "permissions" action for "Cat 1" in management category listing# RedirectAnd I should see "Permissions in Category: Cat 1"And I click on "Back to Category: Cat 1" "link"# RedirectAnd I should see "Cat 1" in the "h1" "css_element"Scenario: Test clicking to manage cohorts for a category through the management interface.Given the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 |And the following "courses" exist:| category | fullname | shortname | idnumber || CAT1 | Course 1 | Course 1 | C1 |And I log in as "admin"And I go to the courses management pageAnd I should see the "Course categories and courses" management pageAnd I click on "cohorts" action for "Cat 1" in management category listing# RedirectAnd I should see "Cohorts"Scenario: Test configuring filters for a categoryGiven the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 |And the following "courses" exist:| category | fullname | shortname | idnumber || CAT1 | Course 1 | Course 1 | C1 |And I log in as "admin"And I go to the courses management pageAnd I should see the "Course categories and courses" management pageAnd I click on "filters" action for "Cat 1" in management category listing# RedirectAnd I should see "Filter settings in Category: Cat 1"And I click on "Back to Category: Cat 1" "link"# RedirectAnd I should see the "Course categories and courses" management pageAnd I should see "Cat 1" in the "#course-listing h3" "css_element"@javascriptScenario: Test that I can create a category and view it in the management interfaceGiven the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 |And I log in as "admin"And I go to the courses management pageAnd I should see the "Course categories and courses" management pageAnd I click on "Create new category" "link" in the ".category-listing-actions" "css_element"# Redirect.And I should see "Add new category"And I set the following fields to these values:| Parent category | Top || Category name | Test category 2 || Category ID number | TC2 |And I press "Create category"# RedirectAnd I should see the "Course categories and courses" management pageAnd I should see "Test category 2" in the "#course-listing h3" "css_element"And I should see category listing "Cat 1" before "Test category 2"And I should see "No courses in this category"And I click on "createnewsubcategory" action for "Test category 2" in management category listing# RedirectAnd I should see "Add new category"And I set the following fields to these values:| Parent category | Top || Category name | Test category 3 || Category ID number | TC3 |And I press "Create category"# RedirectAnd I should see the "Course categories and courses" management pageAnd I should see "Test category 3" in the "#course-listing h3" "css_element"And I should see category listing "Cat 1" before "Test category 2"And I should see "No courses in this category"@javascriptScenario: Test moving a categories through the management interface.Given the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 || Cat 2 | 0 | CAT2 || Cat 3 | 0 | CAT3 |And I log in as "admin"And I go to the courses management pageAnd I should see the "Course categories and courses" management pageAnd I should see "Cat 1" in the "#category-listing ul" "css_element"And I should see "Cat 2" in the "#category-listing ul" "css_element"And I should see "Cat 3" in the "#category-listing ul" "css_element"And I select category "Cat 2" in the management interfaceAnd I select category "Cat 3" in the management interfaceAnd I set the field "menumovecategoriesto" to "Cat 1"When I press "bulkmovecategories"# RedirectAnd I click on category "Cat 1" in the management interface# RedirectThen I should see category "CAT3" as subcategory of "CAT1" in the management interfaceAnd I move category "Cat 3" to top level in the management interface# RedirectAnd I should not see category "CAT3" as subcategory of "CAT1" in the management interfaceThen I should see category "CAT2" as subcategory of "CAT1" in the management interface@javascriptScenario: Test bulk action is shown only when some category/course is selectedGiven the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 || Cat 2 | 0 | CAT2 || Cat 3 | 0 | CAT3 |And the following "courses" exist:| category | fullname | shortname | idnumber || CAT3 | Course 1 | Course 1 | C1 || CAT3 | Course 2 | Course 2 | C2 |And I log in as "admin"And I go to the courses management pageAnd I should see the "Course categories and courses" management pageAnd I should see "Cat 1" in the "#category-listing ul" "css_element"And I should see "Cat 2" in the "#category-listing ul" "css_element"And I should see "Cat 3" in the "#category-listing ul" "css_element"And the "movecategoriesto" "select" should be disabledAnd the "resortcategoriesby" "select" should be disabledAnd the "resortcoursesby" "select" should be disabledWhen I set the field "selectsortby" to "allcategories"Then the "resortcategoriesby" "select" should be enabledAnd the "resortcoursesby" "select" should be enabledAnd the "movecategoriesto" "select" should be disabledAnd I select category "Cat 2" in the management interfaceAnd the "movecategoriesto" "select" should be enabledAnd the "resortcategoriesby" "select" should be enabledAnd the "resortcoursesby" "select" should be enabledAnd I set the field "selectsortby" to "selectedcategories"And the "movecategoriesto" "select" should be enabledAnd the "resortcategoriesby" "select" should be enabledAnd the "resortcoursesby" "select" should be enabledAnd I unselect category "Cat 2" in the management interfaceAnd the "movecategoriesto" "select" should be disabledAnd the "resortcategoriesby" "select" should be disabledAnd the "resortcoursesby" "select" should be disabledAnd I select category "Cat 3" in the management interfaceAnd the "movecategoriesto" "select" should be enabledAnd the "resortcategoriesby" "select" should be enabledAnd the "resortcoursesby" "select" should be enabledAnd I select category "Cat 2" in the management interfaceAnd the "movecategoriesto" "select" should be enabledAnd the "resortcategoriesby" "select" should be enabledAnd the "resortcoursesby" "select" should be enabledAnd I unselect category "Cat 2" in the management interfaceAnd I unselect category "Cat 3" in the management interfaceAnd the "movecategoriesto" "select" should be disabledAnd the "resortcategoriesby" "select" should be disabledAnd the "resortcoursesby" "select" should be disabledAnd I click on category "Cat 1" in the management interface# Redirect.And I should see the "Course categories and courses" management pageAnd the "movecategoriesto" "select" should be disabledAnd the "resortcategoriesby" "select" should be disabledAnd the "resortcoursesby" "select" should be disabledAnd the "movecoursesto" "select" should be disabledAnd I click on category "Cat 3" in the management interface#RedirectAnd I should see the "Course categories and courses" management pageAnd I should see "Course 1" in the "#course-listing ul.course-list" "css_element"And I should see "Course 2" in the "#course-listing ul.course-list" "css_element"And the "movecategoriesto" "select" should be disabledAnd the "resortcategoriesby" "select" should be disabledAnd the "resortcoursesby" "select" should be disabledAnd the "movecoursesto" "select" should be disabledAnd I select course "Course 1" in the management interfaceAnd the "movecoursesto" "select" should be enabledAnd the "movecategoriesto" "select" should be disabledAnd the "resortcategoriesby" "select" should be disabledAnd the "resortcoursesby" "select" should be disabledAnd I select course "Course 2" in the management interfaceAnd the "movecoursesto" "select" should be enabledAnd the "movecategoriesto" "select" should be disabledAnd the "resortcategoriesby" "select" should be disabledAnd the "resortcoursesby" "select" should be disabledAnd I select category "Cat 3" in the management interfaceAnd the "movecoursesto" "select" should be enabledAnd the "movecategoriesto" "select" should be enabledAnd the "resortcategoriesby" "select" should be enabledAnd the "resortcoursesby" "select" should be enabledAnd I unselect course "Course 2" in the management interfaceAnd the "movecoursesto" "select" should be enabledAnd the "movecategoriesto" "select" should be enabledAnd the "resortcategoriesby" "select" should be enabledAnd the "resortcoursesby" "select" should be enabledAnd I unselect course "Course 1" in the management interfaceAnd the "movecoursesto" "select" should be disabledAnd the "movecategoriesto" "select" should be enabledAnd the "resortcategoriesby" "select" should be enabledAnd the "resortcoursesby" "select" should be enabledAnd I unselect category "Cat 3" in the management interfaceAnd the "movecoursesto" "select" should be disabledAnd the "movecategoriesto" "select" should be disabledAnd the "resortcategoriesby" "select" should be disabledAnd the "resortcoursesby" "select" should be disabledScenario: Test that is not possible to create a course category with a duplicate idnumberGiven the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 |And I log in as "admin"And I navigate to "Courses > Add a category" in site administrationAnd I set the following fields to these values:| Category name | Test duplicate || Category ID number | CAT1 |When I press "Create category"Then I should see "ID number is already used for another category"Scenario: Test that is possible to remove an idnumber from a course categoryGiven the following "categories" exist:| name | category | idnumber || Cat 1 | 0 | CAT1 || Cat 2 | 0 ||And I log in as "admin"And I go to the courses management pageAnd I should see "CAT1" in the "#category-listing" "css_element"When I click on "edit" action for "Cat 1" in management category listingAnd I set the following fields to these values:| Category name | Category 1 (edited) || Category ID number ||And I press "Save changes"# RedirectThen I should see "Category 1 (edited)" in the "#category-listing" "css_element"And I should not see "CAT1" in the "#course-listing" "css_element"