2 Feature: Basic recycle bin functionality
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
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 And the following "courses" exist:
13 | fullname | shortname |
16 And the following "course enrolments" exist:
17 | user | course | role |
18 | teacher1 | C1 | editingteacher |
19 And the following config values are set as admin:
20 | coursebinenable | 1 | tool_recyclebin |
21 | categorybinenable | 1 | tool_recyclebin |
22 | coursebinexpiry | 604800 | tool_recyclebin |
23 | categorybinexpiry | 1209600 | tool_recyclebin |
24 | autohide | 0 | tool_recyclebin |
26 Scenario: Restore a deleted assignment
27 Given I log in as "teacher1"
28 And I am on "Course 1" course homepage with editing mode on
29 And I add a "Assignment" to section "1" and I fill the form with:
30 | Assignment name | Test assign |
31 | Description | Test |
32 And I delete "Test assign" activity
33 When I navigate to "Recycle bin" node in "Course administration"
34 Then I should see "Test assign"
35 And I should see "Contents will be permanently deleted after 7 days"
36 And I click on "Restore" "link" in the "region-main" "region"
37 And I should see "'Test assign' has been restored"
38 And I wait to be redirected
39 And I am on "Course 1" course homepage
40 And I should see "Test assign" in the "Topic 1" "section"
42 Scenario: Restore a deleted course
43 Given I log in as "admin"
44 And I go to the courses management page
45 And I click on "delete" action for "Course 2" in management course listing
47 And I should see "Deleting C2"
48 And I should see "C2 has been completely deleted"
49 And I press "Continue"
50 And I am on course index
51 And I should see "Course 1"
52 And I should not see "Course 2"
53 When I navigate to "Recycle bin" in current page administration
54 Then I should see "Course 2"
55 And I should see "Contents will be permanently deleted after 14 days"
56 And I click on "Restore" "link" in the "region-main" "region"
57 And I should see "'Course 2' has been restored"
58 And I wait to be redirected
59 And I go to the courses management page
60 And I should see "Course 2" in the "#course-listing" "css_element"
63 Scenario: Deleting a single item from the recycle bin
64 Given I log in as "teacher1"
65 And I am on "Course 1" course homepage with editing mode on
66 And I add a "Assignment" to section "1" and I fill the form with:
67 | Assignment name | Test assign |
68 | Description | Test |
69 And I delete "Test assign" activity
70 And I run all adhoc tasks
71 And I navigate to "Recycle bin" node in "Course administration"
72 When I click on "Delete" "link"
73 Then I should see "Are you sure you want to delete the selected item from the recycle bin?"
75 And I should see "Test assign"
76 And I click on "Delete" "link"
78 And I should see "'Test assign' has been deleted"
79 And I should see "There are no items in the recycle bin."
82 Scenario: Deleting all the items from the recycle bin
83 Given I log in as "teacher1"
84 And I am on "Course 1" course homepage with editing mode on
85 And I add a "Assignment" to section "1" and I fill the form with:
86 | Assignment name | Test assign 1 |
87 | Description | Test 1 |
88 And I add a "Assignment" to section "1" and I fill the form with:
89 | Assignment name | Test assign 2 |
90 | Description | Test 2 |
91 And I delete "Test assign 1" activity
92 And I delete "Test assign 2" activity
93 And I run all adhoc tasks
94 And I navigate to "Recycle bin" node in "Course administration"
95 And I should see "Test assign 1"
96 And I should see "Test assign 2"
97 When I click on "Delete all" "link"
98 Then I should see "Are you sure you want to delete all items from the recycle bin?"
100 And I should see "Test assign 1"
101 And I should see "Test assign 2"
102 And I click on "Delete all" "link"
104 And I should see "Recycle bin has been emptied"
105 And I should see "There are no items in the recycle bin."