From 905729bf333b15e9d2d815b72b5539c306810325 Mon Sep 17 00:00:00 2001 From: David Monllao Date: Tue, 15 Oct 2013 18:07:03 +0800 Subject: [PATCH] MDL-42363 behat: Covering MDL-41817 testing Covering backup/restore without blocks and with a single course section. --- .../ui/tests/behat/backup_courses.feature | 32 +++++++++++++++++-- .../behat/restore_moodle2_courses.feature | 18 +++++++---- 2 files changed, 42 insertions(+), 8 deletions(-) diff --git a/backup/util/ui/tests/behat/backup_courses.feature b/backup/util/ui/tests/behat/backup_courses.feature index 67321949996..f8d65d20fef 100644 --- a/backup/util/ui/tests/behat/backup_courses.feature +++ b/backup/util/ui/tests/behat/backup_courses.feature @@ -6,8 +6,13 @@ Feature: Backup Moodle courses Background: Given the following "courses" exists: - | fullname | shortname | category | - | Course 1 | C1 | 0 | + | fullname | shortname | category | numsections | + | Course 1 | C1 | 0 | 10 | + | Course 2 | C2 | 0 | 2 | + And the following "activities" exists: + | activity | course | idnumber | name | intro | section | + | assign | C2 | assign1 | Test assign | Assign description | 1 | + | data | C2 | data1 | Test data | Database description | 2 | And I log in as "admin" @javascript @@ -36,3 +41,26 @@ Feature: Backup Moodle courses And I check "Include course logs" And I press "Cancel" And I click on "Cancel" "button" in the "Cancel backup" "dialogue" + + @javascript + Scenario: Backup a course without blocks + When I backup "Course 1" course using this options: + | id_setting_root_blocks | 0 | + Then I should see "Course backup area" + + @javascript + Scenario: Backup selecting just one section + When I backup "Course 2" course using this options: + | Filename | test_backup.mbz | + | setting_section_section_2_userinfo | 0 | + | setting_section_section_2_included | 0 | + | setting_section_section_4_userinfo | 0 | + | setting_section_section_4_included | 0 | + Then I should see "Course backup area" + And I click on "Restore" "link" in the "test_backup.mbz" "table_row" + And I should not see "Section 2" + And I press "Continue" + And I click on "Continue" "button" in the ".bcs-current-course" "css_element" + And I press "Next" + And I should see "Test assign" + And I should not see "Test data" diff --git a/backup/util/ui/tests/behat/restore_moodle2_courses.feature b/backup/util/ui/tests/behat/restore_moodle2_courses.feature index ed7fa5c8d5a..0ce2779a5c6 100644 --- a/backup/util/ui/tests/behat/restore_moodle2_courses.feature +++ b/backup/util/ui/tests/behat/restore_moodle2_courses.feature @@ -9,6 +9,11 @@ Feature: Restore Moodle 2 course backups | fullname | shortname | category | format | numsections | coursedisplay | | Course 1 | C1 | 0 | topics | 15 | 1 | | Course 2 | C2 | 0 | topics | 5 | 0 | + | Course 3 | C3 | 0 | topics | 2 | 0 | + And the following "activities" exists: + | activity | course | idnumber | name | intro | section | + | assign | C3 | assign1 | Test assign name | Assign description | 1 | + | data | C3 | data1 | Test database name | Database description | 2 | And I log in as "admin" And I follow "Course 1" And I turn editing mode on @@ -44,15 +49,16 @@ Feature: Restore Moodle 2 course backups @javascript Scenario: Restore a backup into the same course - When I backup "Course 1" course using this options: + When I backup "Course 3" course using this options: | Filename | test_backup.mbz | - And I merge "test_backup.mbz" backup into the current course using this options: + And I restore "test_backup.mbz" backup into "Course 2" course using this options: + | setting_section_section_3_included | 0 | + | setting_section_section_3_userinfo | 0 | | setting_section_section_5_included | 0 | | setting_section_section_5_userinfo | 0 | - Then I should see "Course 1" - And I should not see "Section 3" - And I should see "Community finder" in the "Community finder" "block" - And I should see "Test forum name" + Then I should see "Course 2" + And I should see "Test assign name" + And I should not see "Test database name" @javascript Scenario: Restore a backup into the same course removing it's contents before that