| 1 | efrain | 1 | @core @core_course
 | 
        
           |  |  | 2 | Feature: Test we can both create and delete a course.
 | 
        
           |  |  | 3 |   As a Moodle admin
 | 
        
           |  |  | 4 |   I need to test I can create a course
 | 
        
           |  |  | 5 |   I need to test I can delete a course
 | 
        
           |  |  | 6 |   | 
        
           |  |  | 7 |   Scenario: Create a course
 | 
        
           |  |  | 8 |     Given the following "categories" exist:
 | 
        
           |  |  | 9 |       | name | category 0| idnumber |
 | 
        
           |  |  | 10 |       | Cat 1 | 0 | CAT1 |
 | 
        
           |  |  | 11 |   | 
        
           |  |  | 12 |     And I log in as "admin"
 | 
        
           |  |  | 13 |     And I go to the courses management page
 | 
        
           |  |  | 14 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 15 |     And I click on category "Cat 1" in the management interface
 | 
        
           |  |  | 16 |     # Redirect
 | 
        
           |  |  | 17 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 18 |     And I should see "Cat 1" in the "#category-listing" "css_element"
 | 
        
           |  |  | 19 |     And I should see "No courses in this category" in the "#course-listing" "css_element"
 | 
        
           |  |  | 20 |     And I click on "Create new course" "link" in the ".course-listing-actions" "css_element"
 | 
        
           |  |  | 21 |     And I set the following fields to these values:
 | 
        
           |  |  | 22 |       | Course full name | Test course: create a course |
 | 
        
           |  |  | 23 |       | Course short name | TCCAC |
 | 
        
           |  |  | 24 |       | Course ID number | TC3401 |
 | 
        
           |  |  | 25 |       | Course summary | This course has been created by automated tests. |
 | 
        
           |  |  | 26 |     And I press "Save and return"
 | 
        
           |  |  | 27 |     # Redirect
 | 
        
           |  |  | 28 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 29 |     And I click on category "Cat 1" in the management interface
 | 
        
           |  |  | 30 |     # Redirect
 | 
        
           |  |  | 31 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 32 |     And I should see "Cat 1" in the "#category-listing" "css_element"
 | 
        
           |  |  | 33 |     And I should see "Test course: create a course" in the "#course-listing" "css_element"
 | 
        
           |  |  | 34 |   | 
        
           |  |  | 35 |   @javascript
 | 
        
           |  |  | 36 |   Scenario: Delete a course via its management listing
 | 
        
           |  |  | 37 |     Given the following "categories" exist:
 | 
        
           |  |  | 38 |       | name | category 0| idnumber |
 | 
        
           |  |  | 39 |       | Cat 1 | 0 | CAT1 |
 | 
        
           |  |  | 40 |     And the following "courses" exist:
 | 
        
           |  |  | 41 |       | category | fullname | shortname | idnumber |
 | 
        
           |  |  | 42 |       | CAT1 | Test course: create a course | TCCAC | TC3401 |
 | 
        
           |  |  | 43 |       | CAT1 | Test course 2: create another course | TC2CAC | TC3402 |
 | 
        
           |  |  | 44 |   | 
        
           |  |  | 45 |     And I log in as "admin"
 | 
        
           |  |  | 46 |     And I go to the courses management page
 | 
        
           |  |  | 47 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 48 |     And I click on category "Cat 1" in the management interface
 | 
        
           |  |  | 49 |     # Redirect
 | 
        
           |  |  | 50 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 51 |     And I should see "Cat 1" in the "#category-listing" "css_element"
 | 
        
           |  |  | 52 |     And I should see "Test course: create a course" in the "#course-listing" "css_element"
 | 
        
           |  |  | 53 |     And I should see "Test course 2: create another course" in the "#course-listing" "css_element"
 | 
        
           |  |  | 54 |     And I click on "delete" action for "Test course: create a course" in management course listing
 | 
        
           |  |  | 55 |     # Redirect
 | 
        
           |  |  | 56 |     And I should see "Delete TCCAC"
 | 
        
           |  |  | 57 |     And I should see "Test course: create a course (TCCAC)"
 | 
        
           |  |  | 58 |     And I press "Delete"
 | 
        
           |  |  | 59 |     # Redirect
 | 
        
           |  |  | 60 |     And I should see "Deleting TCCAC"
 | 
        
           |  |  | 61 |     And I should see "TCCAC has been completely deleted"
 | 
        
           |  |  | 62 |     And I press "Continue"
 | 
        
           |  |  | 63 |     # Redirect
 | 
        
           |  |  | 64 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 65 |     And I should see "Cat 1" in the "#category-listing" "css_element"
 | 
        
           |  |  | 66 |     And I should see "Test course 2: create another course" in the "#course-listing" "css_element"
 | 
        
           |  |  | 67 |   | 
        
           |  |  | 68 |   @javascript
 | 
        
           |  |  | 69 |   Scenario: Delete a course via its management details page
 | 
        
           |  |  | 70 |     Given the following "categories" exist:
 | 
        
           |  |  | 71 |       | name | category 0| idnumber |
 | 
        
           |  |  | 72 |       | Cat 1 | 0 | CAT1 |
 | 
        
           |  |  | 73 |     And the following "courses" exist:
 | 
        
           |  |  | 74 |       | category | fullname | shortname | idnumber |
 | 
        
           |  |  | 75 |       | CAT1 | Test course: create a course | TCCAC | TC3401 |
 | 
        
           |  |  | 76 |       | CAT1 | Test course 2: create another course | TC2CAC | TC3402 |
 | 
        
           |  |  | 77 |   | 
        
           |  |  | 78 |     And I log in as "admin"
 | 
        
           |  |  | 79 |     And I go to the courses management page
 | 
        
           |  |  | 80 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 81 |     And I click on category "Cat 1" in the management interface
 | 
        
           |  |  | 82 |     # Redirect
 | 
        
           |  |  | 83 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 84 |     And I should see "Cat 1" in the "#category-listing" "css_element"
 | 
        
           |  |  | 85 |     And I should see "Test course: create a course" in the "#course-listing" "css_element"
 | 
        
           |  |  | 86 |     And I should see "Test course 2: create another course" in the "#course-listing" "css_element"
 | 
        
           |  |  | 87 |     And I click on course "Test course: create a course" in the management interface
 | 
        
           |  |  | 88 |     # Redirect
 | 
        
           |  |  | 89 |     And I should see the "Course categories and courses" management page with a course selected
 | 
        
           |  |  | 90 |     And I should see "Cat 1" in the "#category-listing" "css_element"
 | 
        
           |  |  | 91 |     And I should see "Test course: create a course" in the "#course-listing" "css_element"
 | 
        
           |  |  | 92 |     And I should see "Test course 2: create another course" in the "#course-listing" "css_element"
 | 
        
           |  |  | 93 |     And I should see "Test course: create a course" in the "#course-detail" "css_element"
 | 
        
           |  |  | 94 |     And I click on "Delete" "link" in the ".course-detail-listing-actions" "css_element"
 | 
        
           |  |  | 95 |     # Redirect
 | 
        
           |  |  | 96 |     And I should see "Delete TCCAC"
 | 
        
           |  |  | 97 |     And I should see "Test course: create a course (TCCAC)"
 | 
        
           |  |  | 98 |     And I press "Delete"
 | 
        
           |  |  | 99 |     # Redirect
 | 
        
           |  |  | 100 |     And I should see "Deleting TCCAC"
 | 
        
           |  |  | 101 |     And I should see "TCCAC has been completely deleted"
 | 
        
           |  |  | 102 |     And I press "Continue"
 | 
        
           |  |  | 103 |     # Redirect
 | 
        
           |  |  | 104 |     And I should see the "Course categories and courses" management page
 | 
        
           |  |  | 105 |     And I should see "Cat 1" in the "#category-listing" "css_element"
 | 
        
           |  |  | 106 |     And I should see "Test course 2: create another course" in the "#course-listing" "css_element"
 |