2 Feature: Restore Moodle 2 course backups
3 In order to continue using my stored course contents
4 As a teacher and an admin
5 I need to restore them inside other Moodle courses or in new courses
8 Given the following "courses" exist:
9 | fullname | shortname | category | format | numsections | coursedisplay |
10 | Course 1 | C1 | 0 | topics | 15 | 1 |
11 | Course 2 | C2 | 0 | topics | 5 | 0 |
12 | Course 3 | C3 | 0 | topics | 2 | 0 |
13 | Course 4 | C4 | 0 | topics | 20 | 0 |
14 And the following "activities" exist:
15 | activity | course | idnumber | name | intro | section |
16 | assign | C3 | assign1 | Test assign name | Assign description | 1 |
17 | data | C3 | data1 | Test database name | Database description | 2 |
18 And I log in as "admin"
19 And I am on "Course 1" course homepage with editing mode on
20 And I add a "Forum" to section "1" and I fill the form with:
21 | Forum name | Test forum name |
22 | Description | Test forum description |
23 And I add the "Community finder" block
26 Scenario: Restore a course in another existing course
27 When I backup "Course 1" course using this options:
28 | Confirmation | Filename | test_backup.mbz |
29 And I restore "test_backup.mbz" backup into "Course 2" course using this options:
30 Then I should see "Course 2"
31 And I should see "Community finder" in the "Community finder" "block"
32 And I should see "Test forum name"
35 Scenario: Restore a course in a new course
36 When I backup "Course 1" course using this options:
37 | Confirmation | Filename | test_backup.mbz |
38 And I restore "test_backup.mbz" backup into a new course using this options:
39 | Schema | Course name | Course 1 restored in a new course |
40 Then I should see "Course 1 restored in a new course"
41 And I should see "Community finder" in the "Community finder" "block"
42 And I should see "Test forum name"
43 And I should see "Topic 15"
44 And I should not see "Topic 16"
45 And I navigate to "Edit settings" node in "Course administration"
46 And I expand all fieldsets
47 And the field "id_format" matches value "Topics format"
51 Scenario: Restore a backup into the same course
52 When I backup "Course 3" course using this options:
53 | Confirmation | Filename | test_backup.mbz |
54 And I restore "test_backup.mbz" backup into "Course 2" course using this options:
55 | Schema | Test database name | 0 |
56 | Schema | Section 2 | 0 |
57 Then I should see "Course 2"
58 And I should see "Test assign name"
59 And I should not see "Test database name"
62 Scenario: Restore a backup into the same course removing it's contents before that
63 When I backup "Course 1" course using this options:
64 | Confirmation | Filename | test_backup.mbz |
65 And I am on "Course 1" course homepage
66 And I add a "Forum" to section "1" and I fill the form with:
67 | Forum name | Test forum post backup name |
68 | Description | Test forum post backup description |
69 And I navigate to "Restore" node in "Course administration"
70 And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
71 | Schema | Section 3 | 0 |
72 Then I should see "Course 1"
73 And I should not see "Section 3"
74 And I should not see "Test forum post backup name"
75 And I should see "Community finder" in the "Community finder" "block"
76 And I should see "Test forum name"
79 Scenario: Restore a backup into a new course changing the course format afterwards
80 Given I backup "Course 1" course using this options:
81 | Confirmation | Filename | test_backup.mbz |
82 When I restore "test_backup.mbz" backup into a new course using this options:
83 Then I should see "Topic 1"
84 And I should see "Test forum name"
85 And I navigate to "Edit settings" node in "Course administration"
86 And I expand all fieldsets
87 And the field "id_format" matches value "Topics format"
88 And I set the following fields to these values:
89 | id_startdate_day | 1 |
90 | id_startdate_month | January |
91 | id_startdate_year | 2020 |
92 | id_format | Weekly format |
93 | id_enddate_enabled | 0 |
94 And I press "Save and display"
95 And I should see "1 January - 7 January"
96 And I should see "Test forum name"
97 And I navigate to "Edit settings" node in "Course administration"
98 And I expand all fieldsets
99 And the field "id_format" matches value "Weekly format"
100 And I set the following fields to these values:
101 | id_format | Social format |
102 And I press "Save and display"
103 And I should see "An open forum for chatting about anything you want to"
104 And I navigate to "Edit settings" node in "Course administration"
105 And I expand all fieldsets
106 And the field "id_format" matches value "Social format"
110 Scenario: Restore a backup in an existing course retaining the backup course settings
111 Given I add a "URL" to section "3" and I fill the form with:
112 | Name | Test URL name |
113 | Description | Test URL description |
114 | id_externalurl | http://www.moodle.org |
115 And I hide section "3"
116 And I hide section "7"
117 When I backup "Course 1" course using this options:
118 | Confirmation | Filename | test_backup.mbz |
119 And I restore "test_backup.mbz" backup into "Course 2" course using this options:
120 | Schema | Overwrite course configuration | Yes |
121 And I navigate to "Edit settings" node in "Course administration"
122 And I expand all fieldsets
123 Then the field "id_format" matches value "Topics format"
124 And the field "Course layout" matches value "Show one section per page"
125 And the field "Course short name" matches value "C1_1"
127 And section "3" should be visible
128 And section "7" should be hidden
129 And section "15" should be visible
130 And I should see "Topic 15"
131 And I should not see "Topic 16"
132 And I should see "Test URL name" in the "Topic 3" "section"
133 And I should see "Test forum name" in the "Topic 1" "section"
136 Scenario: Restore a backup in an existing course keeping the target course settings
137 Given I add a "URL" to section "3" and I fill the form with:
138 | Name | Test URL name |
139 | Description | Test URL description |
140 | id_externalurl | http://www.moodle.org |
141 And I hide section "3"
142 And I hide section "7"
143 When I backup "Course 1" course using this options:
144 | Confirmation | Filename | test_backup.mbz |
145 And I restore "test_backup.mbz" backup into "Course 2" course using this options:
146 | Schema | Overwrite course configuration | No |
147 And I navigate to "Edit settings" node in "Course administration"
148 And I expand all fieldsets
149 Then the field "id_format" matches value "Topics format"
150 And the field "Course short name" matches value "C2"
151 And the field "Course layout" matches value "Show all sections on one page"
153 And section "3" should be visible
154 And section "7" should be hidden
155 And section "15" should be visible
156 And I should see "Topic 15"
157 And I should not see "Topic 16"
158 And I should see "Test URL name" in the "Topic 3" "section"
159 And I should see "Test forum name" in the "Topic 1" "section"
162 Scenario: Restore a backup in an existing course deleting contents and retaining the backup course settings
163 Given I add a "URL" to section "3" and I fill the form with:
164 | Name | Test URL name |
165 | Description | Test URL description |
166 | id_externalurl | http://www.moodle.org |
167 And I hide section "3"
168 And I hide section "7"
169 When I backup "Course 1" course using this options:
170 | Initial | Include enrolled users | 0 |
171 | Confirmation | Filename | test_backup.mbz |
172 And I am on site homepage
173 And I follow "Course 2"
174 And I navigate to "Restore" node in "Course administration"
175 And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
176 | Schema | Overwrite course configuration | Yes |
177 And I navigate to "Edit settings" node in "Course administration"
178 And I expand all fieldsets
179 Then the field "id_format" matches value "Topics format"
180 And the field "Course layout" matches value "Show one section per page"
181 And the field "Course short name" matches value "C1_1"
183 And section "3" should be hidden
184 And section "7" should be hidden
185 And section "15" should be visible
186 And I should see "Topic 15"
187 And I should not see "Topic 16"
188 And I should see "Test URL name" in the "Topic 3" "section"
189 And I should see "Test forum name" in the "Topic 1" "section"
192 Scenario: Restore a backup in an existing course deleting contents and keeping the current course settings
193 Given I add a "URL" to section "3" and I fill the form with:
194 | Name | Test URL name |
195 | Description | Test URL description |
196 | id_externalurl | http://www.moodle.org |
197 And I hide section "3"
198 And I hide section "7"
199 When I backup "Course 1" course using this options:
200 | Initial | Include enrolled users | 0 |
201 | Confirmation | Filename | test_backup.mbz |
202 And I am on site homepage
203 And I follow "Course 2"
204 And I navigate to "Restore" node in "Course administration"
205 And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
206 | Schema | Overwrite course configuration | No |
207 And I navigate to "Edit settings" node in "Course administration"
208 And I expand all fieldsets
209 Then the field "id_format" matches value "Topics format"
210 And the field "Course short name" matches value "C2"
211 And the field "Course layout" matches value "Show all sections on one page"
213 And section "3" should be hidden
214 And section "7" should be hidden
215 And section "15" should be visible
216 And I should see "Topic 15"
217 And I should not see "Topic 16"
218 And I should see "Test URL name" in the "Topic 3" "section"
219 And I should see "Test forum name" in the "Topic 1" "section"
222 Scenario: Restore a backup in an existing course deleting contents decreasing the number of sections
223 Given I add a "URL" to section "3" and I fill the form with:
224 | Name | Test URL name |
225 | Description | Test URL description |
226 | id_externalurl | http://www.moodle.org |
227 And I hide section "3"
228 And I hide section "7"
229 When I backup "Course 1" course using this options:
230 | Initial | Include enrolled users | 0 |
231 | Confirmation | Filename | test_backup.mbz |
232 And I am on site homepage
233 And I follow "Course 4"
234 And I navigate to "Restore" node in "Course administration"
235 And I merge "test_backup.mbz" backup into the current course after deleting it's contents using this options:
236 | Schema | Overwrite course configuration | No |
237 And I navigate to "Edit settings" node in "Course administration"
238 And I expand all fieldsets
239 Then the field "id_format" matches value "Topics format"
240 And the field "Course short name" matches value "C4"
241 And the field "Course layout" matches value "Show all sections on one page"
243 And section "3" should be hidden
244 And section "7" should be hidden
245 And section "15" should be visible
246 And I should see "Topic 15"
247 And I should not see "Topic 16"
248 And I should see "Test URL name" in the "Topic 3" "section"
249 And I should see "Test forum name" in the "Topic 1" "section"