MDL-61022 recyclebin: Verify groups are restored
[moodle.git] / admin / tool / recyclebin / tests / behat / basic_functionality.feature
CommitLineData
e78cd9b7 1@tool @tool_recyclebin
60444e53
SK
2Feature: Basic recycle bin functionality
3 As a teacher
93af6a61
MN
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
60444e53
SK
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 |
ff3e43ee 12 | student2 | Student | 2 | student2@asd.com |
60444e53
SK
13 And the following "courses" exist:
14 | fullname | shortname |
15 | Course 1 | C1 |
93af6a61 16 | Course 2 | C2 |
60444e53
SK
17 And the following "course enrolments" exist:
18 | user | course | role |
19 | teacher1 | C1 | editingteacher |
ff3e43ee
DW
20 | student1 | C1 | student |
21 | student2 | C1 | student |
22 | teacher1 | C2 | editingteacher |
23 | student1 | C2 | student |
24 | student2 | C2 | student |
25 And the following "groups" exist:
26 | name | course | idnumber |
27 | Group A | C2 | G1 |
28 | Group B | C2 | G2 |
29 | Group C | C2 | G3 |
30 And the following "group members" exist:
31 | user | group |
32 | teacher1 | G1 |
33 | teacher1 | G2 |
34 | student1 | G1 |
35 | student2 | G1 |
36 | student2 | G2 |
93af6a61
MN
37 And the following config values are set as admin:
38 | coursebinenable | 1 | tool_recyclebin |
39 | categorybinenable | 1 | tool_recyclebin |
40 | coursebinexpiry | 604800 | tool_recyclebin |
41 | categorybinexpiry | 1209600 | tool_recyclebin |
42 | autohide | 0 | tool_recyclebin |
60444e53 43
93af6a61 44 Scenario: Restore a deleted assignment
60444e53 45 Given I log in as "teacher1"
fdeeaff9 46 And I am on "Course 1" course homepage with editing mode on
93af6a61
MN
47 And I add a "Assignment" to section "1" and I fill the form with:
48 | Assignment name | Test assign |
49 | Description | Test |
50 And I delete "Test assign" activity
ba5c5083 51 When I navigate to "Recycle bin" node in "Course administration"
93af6a61
MN
52 Then I should see "Test assign"
53 And I should see "Contents will be permanently deleted after 7 days"
ba5c5083 54 And I click on "Restore" "link" in the "region-main" "region"
93af6a61
MN
55 And I should see "'Test assign' has been restored"
56 And I wait to be redirected
fdeeaff9 57 And I am on "Course 1" course homepage
93af6a61
MN
58 And I should see "Test assign" in the "Topic 1" "section"
59
60 Scenario: Restore a deleted course
61 Given I log in as "admin"
62 And I go to the courses management page
63 And I click on "delete" action for "Course 2" in management course listing
64 And I press "Delete"
65 And I should see "Deleting C2"
66 And I should see "C2 has been completely deleted"
67 And I press "Continue"
7a12a02d 68 And I am on course index
f04dda10 69 And I should see "Course 1"
7a12a02d
MG
70 And I should not see "Course 2"
71 When I navigate to "Recycle bin" in current page administration
93af6a61
MN
72 Then I should see "Course 2"
73 And I should see "Contents will be permanently deleted after 14 days"
ba5c5083 74 And I click on "Restore" "link" in the "region-main" "region"
93af6a61
MN
75 And I should see "'Course 2' has been restored"
76 And I wait to be redirected
77 And I go to the courses management page
78 And I should see "Course 2" in the "#course-listing" "css_element"
ff3e43ee
DW
79 And I am on "Course 2" course homepage
80 And I navigate to "Groups" node in "Course administration > Users"
81 And I follow "Overview"
82 And "Student 1" "text" should exist in the "Group A" "table_row"
83 And "Student 2" "text" should exist in the "Group A" "table_row"
84 And "Student 2" "text" should exist in the "Group B" "table_row"
93af6a61
MN
85
86 @javascript
87 Scenario: Deleting a single item from the recycle bin
88 Given I log in as "teacher1"
fdeeaff9 89 And I am on "Course 1" course homepage with editing mode on
93af6a61
MN
90 And I add a "Assignment" to section "1" and I fill the form with:
91 | Assignment name | Test assign |
92 | Description | Test |
93 And I delete "Test assign" activity
ff4230d8 94 And I run all adhoc tasks
ba5c5083 95 And I navigate to "Recycle bin" node in "Course administration"
93af6a61
MN
96 When I click on "Delete" "link"
97 Then I should see "Are you sure you want to delete the selected item from the recycle bin?"
98 And I press "Cancel"
99 And I should see "Test assign"
100 And I click on "Delete" "link"
101 And I press "Yes"
102 And I should see "'Test assign' has been deleted"
103 And I should see "There are no items in the recycle bin."
104
105 @javascript
106 Scenario: Deleting all the items from the recycle bin
107 Given I log in as "teacher1"
fdeeaff9 108 And I am on "Course 1" course homepage with editing mode on
93af6a61
MN
109 And I add a "Assignment" to section "1" and I fill the form with:
110 | Assignment name | Test assign 1 |
111 | Description | Test 1 |
112 And I add a "Assignment" to section "1" and I fill the form with:
113 | Assignment name | Test assign 2 |
114 | Description | Test 2 |
115 And I delete "Test assign 1" activity
116 And I delete "Test assign 2" activity
ff4230d8 117 And I run all adhoc tasks
ba5c5083 118 And I navigate to "Recycle bin" node in "Course administration"
93af6a61
MN
119 And I should see "Test assign 1"
120 And I should see "Test assign 2"
121 When I click on "Delete all" "link"
122 Then I should see "Are you sure you want to delete all items from the recycle bin?"
123 And I press "Cancel"
124 And I should see "Test assign 1"
125 And I should see "Test assign 2"
126 And I click on "Delete all" "link"
127 And I press "Yes"
128 And I should see "Recycle bin has been emptied"
129 And I should see "There are no items in the recycle bin."