| 1 | 
           efrain | 
           1 | 
           @core @core_backup
  | 
        
        
            | 
            | 
           2 | 
           Feature: Backup Moodle courses
  | 
        
        
            | 
            | 
           3 | 
             In order to save and store course contents
  | 
        
        
            | 
            | 
           4 | 
             As an admin
  | 
        
        
            | 
            | 
           5 | 
             I need to create backups of courses
  | 
        
        
            | 
            | 
           6 | 
              | 
        
        
            | 
            | 
           7 | 
             Background:
  | 
        
        
            | 
            | 
           8 | 
               Given the following "courses" exist:
  | 
        
        
            | 
            | 
           9 | 
                 | fullname | shortname | category | numsections | initsections |
  | 
        
        
            | 
            | 
           10 | 
                 | Course 1 | C1        | 0        | 10          | 1            |
  | 
        
        
            | 
            | 
           11 | 
                 | Course 2 | C2        | 0        | 2           | 1            |
  | 
        
        
            | 
            | 
           12 | 
               And the following "activities" exist:
  | 
        
        
            | 
            | 
           13 | 
                 | activity | course | idnumber | name | intro | section |
  | 
        
        
            | 
            | 
           14 | 
                 | assign | C2 | assign1 | Test assign | Assign description | 1 |
  | 
        
        
            | 
            | 
           15 | 
                 | data | C2 | data1 | Test data | Database description | 2 |
  | 
        
        
            | 
            | 
           16 | 
               And the following config values are set as admin:
  | 
        
        
            | 
            | 
           17 | 
                 | enableasyncbackup | 0 |
  | 
        
        
            | 
            | 
           18 | 
               And I log in as "admin"
  | 
        
        
            | 
            | 
           19 | 
              | 
        
        
            | 
            | 
           20 | 
             Scenario: Backup a course providing options
  | 
        
        
            | 
            | 
           21 | 
               When I backup "Course 1" course using this options:
  | 
        
        
            | 
            | 
           22 | 
                 | Confirmation | Filename | test_backup.mbz |
  | 
        
        
            | 
            | 
           23 | 
               Then I should see "Restore"
  | 
        
        
            | 
            | 
           24 | 
               And I click on "Restore" "link" in the "test_backup.mbz" "table_row"
  | 
        
        
            | 
            | 
           25 | 
               And I should see "URL of backup"
  | 
        
        
            | 
            | 
           26 | 
               And I should see "Anonymize user information"
  | 
        
        
            | 
            | 
           27 | 
              | 
        
        
            | 
            | 
           28 | 
             @javascript
  | 
        
        
            | 
            | 
           29 | 
             Scenario: Backup a course with default options
  | 
        
        
            | 
            | 
           30 | 
               When I backup "Course 1" course using this options:
  | 
        
        
            | 
            | 
           31 | 
                 | Initial | Include calendar events | 0 |
  | 
        
        
            | 
            | 
           32 | 
                 | Initial | Include course logs | 1 |
  | 
        
        
            | 
            | 
           33 | 
                 | Schema  | Section 5 | 0 |
  | 
        
        
            | 
            | 
           34 | 
                 | Confirmation | Filename | test_backup.mbz |
  | 
        
        
            | 
            | 
           35 | 
               Then I should see "Restore"
  | 
        
        
            | 
            | 
           36 | 
               And I click on "Restore" "link" in the "test_backup.mbz" "table_row"
  | 
        
        
            | 
            | 
           37 | 
               And I should not see "Section 5" in the "region-main" "region"
  | 
        
        
            | 
            | 
           38 | 
               And I press "Continue"
  | 
        
        
            | 
            | 
           39 | 
               And I click on "Continue" "button" in the ".bcs-current-course" "css_element"
  | 
        
        
            | 
            | 
           40 | 
               And "No" "icon" should exist in the "//div[contains(concat(' ', normalize-space(@class), ' '), ' fitem ')][contains(., 'Include calendar events')]" "xpath_element"
  | 
        
        
            | 
            | 
           41 | 
               And "Include course logs" "checkbox" should exist
  | 
        
        
            | 
            | 
           42 | 
               And I press "Next"
  | 
        
        
            | 
            | 
           43 | 
              | 
        
        
            | 
            | 
           44 | 
             Scenario: Backup a course without blocks
  | 
        
        
            | 
            | 
           45 | 
               When I backup "Course 1" course using this options:
  | 
        
        
            | 
            | 
           46 | 
                 | 1 | setting_root_blocks | 0 |
  | 
        
        
            | 
            | 
           47 | 
               Then I should see "Course backup area"
  | 
        
        
            | 
            | 
           48 | 
              | 
        
        
            | 
            | 
           49 | 
             Scenario: Backup selecting just one section
  | 
        
        
            | 
            | 
           50 | 
               When I backup "Course 2" course using this options:
  | 
        
        
            | 
            | 
           51 | 
                 | Schema | Test data | 0 |
  | 
        
        
            | 
            | 
           52 | 
                 | Schema | Section 2 | 0 |
  | 
        
        
            | 
            | 
           53 | 
                 | Confirmation | Filename | test_backup.mbz |
  | 
        
        
            | 
            | 
           54 | 
               Then I should see "Course backup area"
  | 
        
        
            | 
            | 
           55 | 
               And I click on "Restore" "link" in the "test_backup.mbz" "table_row"
  | 
        
        
            | 
            | 
           56 | 
               And I should not see "Section 2" in the "region-main" "region"
  | 
        
        
            | 
            | 
           57 | 
               And I press "Continue"
  | 
        
        
            | 
            | 
           58 | 
               And I click on "Continue" "button" in the ".bcs-current-course" "css_element"
  | 
        
        
            | 
            | 
           59 | 
               And I press "Next"
  | 
        
        
            | 
            | 
           60 | 
               And I should see "Test assign"
  | 
        
        
            | 
            | 
           61 | 
               And I should not see "Test data"
  | 
        
        
            | 
            | 
           62 | 
              | 
        
        
            | 
            | 
           63 | 
             Scenario: Backup a course using the one click backup button
  | 
        
        
            | 
            | 
           64 | 
               When I perform a quick backup of course "Course 2"
  | 
        
        
            | 
            | 
           65 | 
               Then I should see "Course backup area"
  | 
        
        
            | 
            | 
           66 | 
               And I should see "backup-moodle2-course-"
  |