| 1 | 
           efrain | 
           1 | 
           @tool @tool_recyclebin
  | 
        
        
            | 
            | 
           2 | 
           Feature: Basic recycle bin functionality
  | 
        
        
            | 
            | 
           3 | 
             As a teacher
  | 
        
        
            | 
            | 
           4 | 
             I want be able to recover deleted content and manage the recycle bin content
  | 
        
        
            | 
            | 
           5 | 
             So that I can fix an accidental deletion and clean the recycle bin
  | 
        
        
            | 
            | 
           6 | 
              | 
        
        
            | 
            | 
           7 | 
             Background: Course with teacher exists.
  | 
        
        
            | 
            | 
           8 | 
               Given the following "users" exist:
  | 
        
        
            | 
            | 
           9 | 
                 | username | firstname | lastname | email |
  | 
        
        
            | 
            | 
           10 | 
                 | teacher1 | Teacher | 1 | teacher@asd.com |
  | 
        
        
            | 
            | 
           11 | 
                 | student1 | Student | 1 | student@asd.com |
  | 
        
        
            | 
            | 
           12 | 
                 | student2 | Student | 2 | student2@asd.com |
  | 
        
        
            | 
            | 
           13 | 
               And the following "courses" exist:
  | 
        
        
            | 
            | 
           14 | 
                 | fullname | shortname | initsections |
  | 
        
        
            | 
            | 
           15 | 
                 | Course 1 | C1        | 1            |
  | 
        
        
            | 
            | 
           16 | 
                 | Course 2 | C2        | 0            |
  | 
        
        
            | 
            | 
           17 | 
               And the following "activities" exist:
  | 
        
        
            | 
            | 
           18 | 
                 | activity | course | section | name          | intro  |
  | 
        
        
            | 
            | 
           19 | 
                 | assign   | C1     | 1       | Test assign 1 | Test 1 |
  | 
        
        
            | 
            | 
           20 | 
                 | assign   | C1     | 1       | Test assign 2 | Test 2 |
  | 
        
        
            | 
            | 
           21 | 
               And the following "course enrolments" exist:
  | 
        
        
            | 
            | 
           22 | 
                 | user | course | role |
  | 
        
        
            | 
            | 
           23 | 
                 | teacher1 | C1 | editingteacher |
  | 
        
        
            | 
            | 
           24 | 
                 | student1 | C1 | student |
  | 
        
        
            | 
            | 
           25 | 
                 | student2 | C1 | student |
  | 
        
        
            | 
            | 
           26 | 
                 | teacher1 | C2 | editingteacher |
  | 
        
        
            | 
            | 
           27 | 
                 | student1 | C2 | student |
  | 
        
        
            | 
            | 
           28 | 
                 | student2 | C2 | student |
  | 
        
        
            | 
            | 
           29 | 
               And the following "groups" exist:
  | 
        
        
            | 
            | 
           30 | 
                 | name | course | idnumber |
  | 
        
        
            | 
            | 
           31 | 
                 | Group A | C2 | G1 |
  | 
        
        
            | 
            | 
           32 | 
                 | Group B | C2 | G2 |
  | 
        
        
            | 
            | 
           33 | 
                 | Group C | C2 | G3 |
  | 
        
        
            | 
            | 
           34 | 
               And the following "group members" exist:
  | 
        
        
            | 
            | 
           35 | 
                 | user | group |
  | 
        
        
            | 
            | 
           36 | 
                 | teacher1 | G1 |
  | 
        
        
            | 
            | 
           37 | 
                 | teacher1 | G2 |
  | 
        
        
            | 
            | 
           38 | 
                 | student1 | G1 |
  | 
        
        
            | 
            | 
           39 | 
                 | student2 | G1 |
  | 
        
        
            | 
            | 
           40 | 
                 | student2 | G2 |
  | 
        
        
            | 
            | 
           41 | 
               And the following config values are set as admin:
  | 
        
        
            | 
            | 
           42 | 
                 | coursebinenable | 1 | tool_recyclebin |
  | 
        
        
            | 
            | 
           43 | 
                 | categorybinenable | 1 | tool_recyclebin |
  | 
        
        
            | 
            | 
           44 | 
                 | coursebinexpiry | 604800 | tool_recyclebin |
  | 
        
        
            | 
            | 
           45 | 
                 | categorybinexpiry | 1209600 | tool_recyclebin |
  | 
        
        
            | 
            | 
           46 | 
                 | autohide | 0 | tool_recyclebin |
  | 
        
        
            | 
            | 
           47 | 
              | 
        
        
            | 
            | 
           48 | 
             Scenario: Restore a deleted assignment
  | 
        
        
            | 
            | 
           49 | 
               Given I log in as "teacher1"
  | 
        
        
            | 
            | 
           50 | 
               And I am on "Course 1" course homepage with editing mode on
  | 
        
        
            | 
            | 
           51 | 
               And I delete "Test assign 1" activity
  | 
        
        
           | 1441 | 
           ariadna | 
           52 | 
               And I run all adhoc tasks
  | 
        
        
           | 1 | 
           efrain | 
           53 | 
               When I navigate to "Recycle bin" in current page administration
  | 
        
        
            | 
            | 
           54 | 
               Then I should see "Test assign 1"
  | 
        
        
            | 
            | 
           55 | 
               And I should see "Contents will be permanently deleted after 7 days"
  | 
        
        
            | 
            | 
           56 | 
               And I click on "Restore" "link" in the "region-main" "region"
  | 
        
        
            | 
            | 
           57 | 
               And I should see "'Test assign 1' has been restored"
  | 
        
        
            | 
            | 
           58 | 
               And I wait to be redirected
  | 
        
        
            | 
            | 
           59 | 
               And I am on "Course 1" course homepage
  | 
        
        
            | 
            | 
           60 | 
               And I should see "Test assign 1" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           61 | 
              | 
        
        
            | 
            | 
           62 | 
             @javascript
  | 
        
        
            | 
            | 
           63 | 
             Scenario: Restore a deleted course
  | 
        
        
            | 
            | 
           64 | 
               Given I log in as "admin"
  | 
        
        
            | 
            | 
           65 | 
               And I go to the courses management page
  | 
        
        
            | 
            | 
           66 | 
               And I click on "delete" action for "Course 2" in management course listing
  | 
        
        
            | 
            | 
           67 | 
               And I press "Delete"
  | 
        
        
            | 
            | 
           68 | 
               And I should see "Deleting C2"
  | 
        
        
            | 
            | 
           69 | 
               And I should see "C2 has been completely deleted"
  | 
        
        
            | 
            | 
           70 | 
               And I press "Continue"
  | 
        
        
            | 
            | 
           71 | 
               And I am on course index
  | 
        
        
            | 
            | 
           72 | 
               And I should see "Course 1"
  | 
        
        
            | 
            | 
           73 | 
               And I should not see "Course 2"
  | 
        
        
            | 
            | 
           74 | 
               When I navigate to "Recycle bin" in current page administration
  | 
        
        
            | 
            | 
           75 | 
               Then I should see "Course 2"
  | 
        
        
            | 
            | 
           76 | 
               And I should see "Contents will be permanently deleted after 14 days"
  | 
        
        
            | 
            | 
           77 | 
               And I click on "Restore" "link" in the "region-main" "region"
  | 
        
        
            | 
            | 
           78 | 
               And I should see "'Course 2' has been restored"
  | 
        
        
            | 
            | 
           79 | 
               And I wait to be redirected
  | 
        
        
            | 
            | 
           80 | 
               And I go to the courses management page
  | 
        
        
            | 
            | 
           81 | 
               And I should see "Course 2" in the "#course-listing" "css_element"
  | 
        
        
            | 
            | 
           82 | 
               And I am on the "Course 2" "groups overview" page
  | 
        
        
            | 
            | 
           83 | 
               And "Student 1" "text" should exist in the "Group A" "table_row"
  | 
        
        
            | 
            | 
           84 | 
               And "Student 2" "text" should exist in the "Group A" "table_row"
  | 
        
        
            | 
            | 
           85 | 
               And "Student 2" "text" should exist in the "Group B" "table_row"
  | 
        
        
            | 
            | 
           86 | 
              | 
        
        
            | 
            | 
           87 | 
             @javascript
  | 
        
        
            | 
            | 
           88 | 
             Scenario: Deleting a single item from the recycle bin
  | 
        
        
            | 
            | 
           89 | 
               Given I log in as "teacher1"
  | 
        
        
            | 
            | 
           90 | 
               And I am on "Course 1" course homepage with editing mode on
  | 
        
        
            | 
            | 
           91 | 
               And I delete "Test assign 1" activity
  | 
        
        
            | 
            | 
           92 | 
               And I run all adhoc tasks
  | 
        
        
            | 
            | 
           93 | 
               And I navigate to "Recycle bin" in current page administration
  | 
        
        
            | 
            | 
           94 | 
               When I click on "Delete" "link"
  | 
        
        
            | 
            | 
           95 | 
               Then I should see "Are you sure you want to delete the selected item from the recycle bin?"
  | 
        
        
            | 
            | 
           96 | 
               And I click on "Cancel" "button" in the "Confirmation" "dialogue"
  | 
        
        
            | 
            | 
           97 | 
               And I should see "Test assign 1"
  | 
        
        
            | 
            | 
           98 | 
               And I click on "Delete" "link"
  | 
        
        
            | 
            | 
           99 | 
               And I press "Yes"
  | 
        
        
            | 
            | 
           100 | 
               And I should see "'Test assign 1' has been deleted"
  | 
        
        
            | 
            | 
           101 | 
               And I should see "There are no items in the recycle bin."
  | 
        
        
            | 
            | 
           102 | 
              | 
        
        
            | 
            | 
           103 | 
             @javascript
  | 
        
        
            | 
            | 
           104 | 
             Scenario: Deleting all the items from the recycle bin
  | 
        
        
            | 
            | 
           105 | 
               Given I log in as "teacher1"
  | 
        
        
            | 
            | 
           106 | 
               And I am on "Course 1" course homepage with editing mode on
  | 
        
        
            | 
            | 
           107 | 
               And I delete "Test assign 1" activity
  | 
        
        
            | 
            | 
           108 | 
               And I delete "Test assign 2" activity
  | 
        
        
            | 
            | 
           109 | 
               And I run all adhoc tasks
  | 
        
        
            | 
            | 
           110 | 
               And I navigate to "Recycle bin" in current page administration
  | 
        
        
            | 
            | 
           111 | 
               And I should see "Test assign 1"
  | 
        
        
            | 
            | 
           112 | 
               And I should see "Test assign 2"
  | 
        
        
            | 
            | 
           113 | 
               When I click on "Delete all" "link"
  | 
        
        
            | 
            | 
           114 | 
               Then I should see "Are you sure you want to delete all items from the recycle bin?"
  | 
        
        
            | 
            | 
           115 | 
               And I click on "Cancel" "button" in the "Confirmation" "dialogue"
  | 
        
        
            | 
            | 
           116 | 
               And I should see "Test assign 1"
  | 
        
        
            | 
            | 
           117 | 
               And I should see "Test assign 2"
  | 
        
        
            | 
            | 
           118 | 
               And I click on "Delete all" "link"
  | 
        
        
            | 
            | 
           119 | 
               And I press "Yes"
  | 
        
        
            | 
            | 
           120 | 
               And I should see "Recycle bin has been emptied"
  | 
        
        
            | 
            | 
           121 | 
               And I should see "There are no items in the recycle bin."
  | 
        
        
            | 
            | 
           122 | 
              | 
        
        
            | 
            | 
           123 | 
             @javascript
  | 
        
        
            | 
            | 
           124 | 
             Scenario: Show recycle bin on category action menu
  | 
        
        
            | 
            | 
           125 | 
               Given I log in as "admin"
  | 
        
        
            | 
            | 
           126 | 
               And I navigate to "Courses >  Manage courses and categories" in site administration
  | 
        
        
            | 
            | 
           127 | 
               And I navigate to "Recycle bin" in current page administration
  | 
        
        
            | 
            | 
           128 | 
               Then I should see "There are no items in the recycle bin."
  | 
        
        
            | 
            | 
           129 | 
              | 
        
        
            | 
            | 
           130 | 
             @javascript
  | 
        
        
            | 
            | 
           131 | 
             Scenario: Not show recycle bin empty on category action menu whit autohide enable
  | 
        
        
            | 
            | 
           132 | 
               Given I log in as "admin"
  | 
        
        
            | 
            | 
           133 | 
               And the following config values are set as admin:
  | 
        
        
            | 
            | 
           134 | 
                 | categorybinenable | 0 | tool_recyclebin |
  | 
        
        
            | 
            | 
           135 | 
               And I navigate to "Courses >  Manage courses and categories" in site administration
  | 
        
        
            | 
            | 
           136 | 
               And I click on "Actions menu" "link"
  | 
        
        
            | 
            | 
           137 | 
               Then I should not see "Recycle bin"
  | 
        
        
            | 
            | 
           138 | 
              | 
        
        
            | 
            | 
           139 | 
             @javascript
  | 
        
        
            | 
            | 
           140 | 
             Scenario: Show recycle bin not empty on category action menu whit autohide enable
  | 
        
        
            | 
            | 
           141 | 
               Given I log in as "admin"
  | 
        
        
            | 
            | 
           142 | 
               And the following config values are set as admin:
  | 
        
        
            | 
            | 
           143 | 
                 | autohide | 1 | tool_recyclebin |
  | 
        
        
            | 
            | 
           144 | 
               And I navigate to "Courses >  Manage courses and categories" in site administration
  | 
        
        
            | 
            | 
           145 | 
               And I click on "Actions menu" "link"
  | 
        
        
            | 
            | 
           146 | 
               Then I should not see "Recycle bin"
  | 
        
        
            | 
            | 
           147 | 
               And I click on "delete" action for "Course 2" in management course listing
  | 
        
        
            | 
            | 
           148 | 
               And I press "Delete"
  | 
        
        
            | 
            | 
           149 | 
               And I should see "Deleting C2"
  | 
        
        
            | 
            | 
           150 | 
               And I should see "C2 has been completely deleted"
  | 
        
        
            | 
            | 
           151 | 
               And I press "Continue"
  | 
        
        
            | 
            | 
           152 | 
               When I click on "Actions menu" "link"
  | 
        
        
            | 
            | 
           153 | 
               Then I should see "Recycle bin"
  |