| 1 | 
           efrain | 
           1 | 
           @core @core_courseformat @core_course @show_editor @javascript
  | 
        
        
            | 
            | 
           2 | 
           Feature: Bulk course section actions.
  | 
        
        
            | 
            | 
           3 | 
             In order to edit the course section
  | 
        
        
            | 
            | 
           4 | 
             As a teacher
  | 
        
        
            | 
            | 
           5 | 
             I need to be able to edit sections in bulk.
  | 
        
        
            | 
            | 
           6 | 
              | 
        
        
            | 
            | 
           7 | 
             Background:
  | 
        
        
            | 
            | 
           8 | 
               Given the following "course" exists:
  | 
        
        
            | 
            | 
           9 | 
                 | fullname     | Course 1 |
  | 
        
        
            | 
            | 
           10 | 
                 | shortname    | C1       |
  | 
        
        
            | 
            | 
           11 | 
                 | category     | 0        |
  | 
        
        
            | 
            | 
           12 | 
                 | numsections  | 4        |
  | 
        
        
            | 
            | 
           13 | 
                 | initsections | 1        |
  | 
        
        
            | 
            | 
           14 | 
               And the following "activities" exist:
  | 
        
        
            | 
            | 
           15 | 
                 | activity | name              | intro                       | course | idnumber | section |
  | 
        
        
            | 
            | 
           16 | 
                 | assign   | Activity sample 1 | Test assignment description | C1     | sample1  | 1       |
  | 
        
        
            | 
            | 
           17 | 
                 | assign   | Activity sample 2 | Test assignment description | C1     | sample2  | 1       |
  | 
        
        
            | 
            | 
           18 | 
                 | assign   | Activity sample 3 | Test assignment description | C1     | sample3  | 2       |
  | 
        
        
            | 
            | 
           19 | 
                 | assign   | Activity sample 4 | Test assignment description | C1     | sample4  | 2       |
  | 
        
        
            | 
            | 
           20 | 
               And the following "users" exist:
  | 
        
        
            | 
            | 
           21 | 
                 | username | firstname | lastname | email                |
  | 
        
        
            | 
            | 
           22 | 
                 | teacher1 | Teacher   | 1        | teacher1@example.com |
  | 
        
        
            | 
            | 
           23 | 
               And the following "course enrolments" exist:
  | 
        
        
            | 
            | 
           24 | 
                 | user     | course | role           |
  | 
        
        
            | 
            | 
           25 | 
                 | teacher1 | C1     | editingteacher |
  | 
        
        
            | 
            | 
           26 | 
               And the following config values are set as admin:
  | 
        
        
            | 
            | 
           27 | 
                 | allowstealth | 1 |
  | 
        
        
            | 
            | 
           28 | 
               And I am on the "C1" "Course" page logged in as "teacher1"
  | 
        
        
            | 
            | 
           29 | 
               And I turn editing mode on
  | 
        
        
            | 
            | 
           30 | 
               And I click on "Bulk actions" "button"
  | 
        
        
            | 
            | 
           31 | 
               And I should see "0 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           32 | 
              | 
        
        
            | 
            | 
           33 | 
             Scenario: Bulk hide sections
  | 
        
        
            | 
            | 
           34 | 
               Given I should not see "Hidden from students" in the "Activity sample 1" "activity"
  | 
        
        
            | 
            | 
           35 | 
               And I should not see "Hidden from students" in the "Activity sample 2" "activity"
  | 
        
        
            | 
            | 
           36 | 
               And I should not see "Hidden from students" in the "Activity sample 3" "activity"
  | 
        
        
            | 
            | 
           37 | 
               And I should not see "Hidden from students" in the "Activity sample 4" "activity"
  | 
        
        
            | 
            | 
           38 | 
               And I should not see "Hidden from students" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           39 | 
               And I should not see "Hidden from students" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           40 | 
               And I should not see "Hidden from students" in the "Section 3" "section"
  | 
        
        
            | 
            | 
           41 | 
               And I should not see "Hidden from students" in the "Section 4" "section"
  | 
        
        
            | 
            | 
           42 | 
               When I click on "Select section Section 1" "checkbox"
  | 
        
        
            | 
            | 
           43 | 
               And I click on "Select section Section 2" "checkbox"
  | 
        
        
            | 
            | 
           44 | 
               And I should see "2 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           45 | 
               And I click on "Sections availability" "button" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           46 | 
               And I click on "Hide on course page" "radio" in the "Sections availability" "dialogue"
  | 
        
        
            | 
            | 
           47 | 
               And I click on "Apply" "button" in the "Sections availability" "dialogue"
  | 
        
        
            | 
            | 
           48 | 
               Then I should see "Hidden from students" in the "Activity sample 1" "activity"
  | 
        
        
            | 
            | 
           49 | 
               And I should see "Hidden from students" in the "Activity sample 2" "activity"
  | 
        
        
            | 
            | 
           50 | 
               And I should see "Hidden from students" in the "Activity sample 3" "activity"
  | 
        
        
            | 
            | 
           51 | 
               And I should see "Hidden from students" in the "Activity sample 4" "activity"
  | 
        
        
            | 
            | 
           52 | 
               And I should see "Hidden from students" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           53 | 
               And I should see "Hidden from students" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           54 | 
               And I should not see "Hidden from students" in the "Section 3" "section"
  | 
        
        
            | 
            | 
           55 | 
               And I should not see "Hidden from students" in the "Section 4" "section"
  | 
        
        
            | 
            | 
           56 | 
               And I should see "0 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           57 | 
              | 
        
        
            | 
            | 
           58 | 
             Scenario: Bulk show sections
  | 
        
        
            | 
            | 
           59 | 
               Given I click on "Select section Section 1" "checkbox"
  | 
        
        
            | 
            | 
           60 | 
               And I click on "Select section Section 3" "checkbox"
  | 
        
        
            | 
            | 
           61 | 
               And I click on "Sections availability" "button" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           62 | 
               And I click on "Hide on course page" "radio" in the "Sections availability" "dialogue"
  | 
        
        
            | 
            | 
           63 | 
               And I click on "Apply" "button" in the "Sections availability" "dialogue"
  | 
        
        
            | 
            | 
           64 | 
               And I should see "Hidden from students" in the "Activity sample 1" "activity"
  | 
        
        
            | 
            | 
           65 | 
               And I should see "Hidden from students" in the "Activity sample 2" "activity"
  | 
        
        
            | 
            | 
           66 | 
               And I should not see "Hidden from students" in the "Activity sample 3" "activity"
  | 
        
        
            | 
            | 
           67 | 
               And I should not see "Hidden from students" in the "Activity sample 4" "activity"
  | 
        
        
            | 
            | 
           68 | 
               And I should see "Hidden from students" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           69 | 
               And I should not see "Hidden from students" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           70 | 
               And I should see "Hidden from students" in the "Section 3" "section"
  | 
        
        
            | 
            | 
           71 | 
               And I should not see "Hidden from students" in the "Section 4" "section"
  | 
        
        
            | 
            | 
           72 | 
               When I click on "Select section Section 1" "checkbox"
  | 
        
        
            | 
            | 
           73 | 
               And I click on "Select section Section 2" "checkbox"
  | 
        
        
            | 
            | 
           74 | 
               And I should see "2 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           75 | 
               And I click on "Sections availability" "button" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           76 | 
               And I click on "Show on course page" "radio" in the "Sections availability" "dialogue"
  | 
        
        
            | 
            | 
           77 | 
               And I click on "Apply" "button" in the "Sections availability" "dialogue"
  | 
        
        
            | 
            | 
           78 | 
               Then I should not see "Hidden from students" in the "Activity sample 1" "activity"
  | 
        
        
            | 
            | 
           79 | 
               And I should not see "Hidden from students" in the "Activity sample 2" "activity"
  | 
        
        
            | 
            | 
           80 | 
               And I should not see "Hidden from students" in the "Activity sample 3" "activity"
  | 
        
        
            | 
            | 
           81 | 
               And I should not see "Hidden from students" in the "Activity sample 4" "activity"
  | 
        
        
            | 
            | 
           82 | 
               And I should not see "Hidden from students" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           83 | 
               And I should not see "Hidden from students" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           84 | 
               And I should see "Hidden from students" in the "Section 3" "section"
  | 
        
        
            | 
            | 
           85 | 
               And I should not see "Hidden from students" in the "Section 4" "section"
  | 
        
        
            | 
            | 
           86 | 
              | 
        
        
            | 
            | 
           87 | 
             Scenario: Bulk delete sections with content ask for confirmation
  | 
        
        
            | 
            | 
           88 | 
               Given I should see "Section 1" in the "region-main" "region"
  | 
        
        
            | 
            | 
           89 | 
               And I should see "Section 2" in the "region-main" "region"
  | 
        
        
            | 
            | 
           90 | 
               And I should see "Section 3" in the "region-main" "region"
  | 
        
        
            | 
            | 
           91 | 
               And I should see "Section 4" in the "region-main" "region"
  | 
        
        
            | 
            | 
           92 | 
               And I should see "Activity sample 1" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           93 | 
               And I should see "Activity sample 2" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           94 | 
               And I should see "Activity sample 3" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           95 | 
               And I should see "Activity sample 4" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           96 | 
               And I click on "Select section Section 1" "checkbox"
  | 
        
        
            | 
            | 
           97 | 
               And I click on "Select section Section 2" "checkbox"
  | 
        
        
            | 
            | 
           98 | 
               And I should see "2 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           99 | 
               When I click on "Delete sections" "button" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           100 | 
               And I click on "Delete" "button" in the "Delete selected sections?" "dialogue"
  | 
        
        
            | 
            | 
           101 | 
               Then I should see "Section 3" in the "region-main" "region"
  | 
        
        
            | 
            | 
           102 | 
               And I should see "Section 4" in the "region-main" "region"
  | 
        
        
            | 
            | 
           103 | 
               And I should not see "Section 1" in the "region-main" "region"
  | 
        
        
            | 
            | 
           104 | 
               And I should not see "Section 2" in the "region-main" "region"
  | 
        
        
            | 
            | 
           105 | 
               And I should not see "Activity sample 1" in the "Section 3" "section"
  | 
        
        
            | 
            | 
           106 | 
               And I should not see "Activity sample 2" in the "Section 3" "section"
  | 
        
        
            | 
            | 
           107 | 
               And I should not see "Activity sample 3" in the "Section 4" "section"
  | 
        
        
            | 
            | 
           108 | 
               And I should not see "Activity sample 4" in the "Section 4" "section"
  | 
        
        
            | 
            | 
           109 | 
               And I should see "0 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           110 | 
              | 
        
        
            | 
            | 
           111 | 
             Scenario: Bulk delete sections without content does not ask for confirmation
  | 
        
        
            | 
            | 
           112 | 
               Given I should see "Section 1" in the "region-main" "region"
  | 
        
        
            | 
            | 
           113 | 
               And I should see "Section 2" in the "region-main" "region"
  | 
        
        
            | 
            | 
           114 | 
               And I should see "Section 3" in the "region-main" "region"
  | 
        
        
            | 
            | 
           115 | 
               And I should see "Section 4" in the "region-main" "region"
  | 
        
        
            | 
            | 
           116 | 
               And I should see "Activity sample 1" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           117 | 
               And I should see "Activity sample 2" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           118 | 
               And I should see "Activity sample 3" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           119 | 
               And I should see "Activity sample 4" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           120 | 
               And I click on "Select section Section 3" "checkbox"
  | 
        
        
            | 
            | 
           121 | 
               And I click on "Select section Section 4" "checkbox"
  | 
        
        
            | 
            | 
           122 | 
               And I should see "2 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           123 | 
               When I click on "Delete sections" "button" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           124 | 
               And I click on "Delete" "button" in the "Delete selected sections?" "dialogue"
  | 
        
        
            | 
            | 
           125 | 
               Then I should see "Section 1" in the "region-main" "region"
  | 
        
        
            | 
            | 
           126 | 
               And I should see "Section 2" in the "region-main" "region"
  | 
        
        
            | 
            | 
           127 | 
               And I should not see "Section 3" in the "region-main" "region"
  | 
        
        
            | 
            | 
           128 | 
               And I should not see "Section 4" in the "region-main" "region"
  | 
        
        
            | 
            | 
           129 | 
               And I should see "Activity sample 1" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           130 | 
               And I should see "Activity sample 2" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           131 | 
               And I should see "Activity sample 3" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           132 | 
               And I should see "Activity sample 4" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           133 | 
               And I should see "0 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           134 | 
              | 
        
        
            | 
            | 
           135 | 
             Scenario: Bulk delete both section with content and empty section ask for confirmation
  | 
        
        
            | 
            | 
           136 | 
               Given I should see "Section 1" in the "region-main" "region"
  | 
        
        
            | 
            | 
           137 | 
               And I should see "Section 2" in the "region-main" "region"
  | 
        
        
            | 
            | 
           138 | 
               And I should see "Section 3" in the "region-main" "region"
  | 
        
        
            | 
            | 
           139 | 
               And I should see "Section 4" in the "region-main" "region"
  | 
        
        
            | 
            | 
           140 | 
               And I should see "Activity sample 1" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           141 | 
               And I should see "Activity sample 2" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           142 | 
               And I should see "Activity sample 3" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           143 | 
               And I should see "Activity sample 4" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           144 | 
               And I click on "Select section Section 2" "checkbox"
  | 
        
        
            | 
            | 
           145 | 
               And I click on "Select section Section 3" "checkbox"
  | 
        
        
            | 
            | 
           146 | 
               And I should see "2 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           147 | 
               When I click on "Delete sections" "button" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           148 | 
               And I click on "Delete" "button" in the "Delete selected sections?" "dialogue"
  | 
        
        
            | 
            | 
           149 | 
               Then I should see "Section 1" in the "region-main" "region"
  | 
        
        
            | 
            | 
           150 | 
               And I should see "Section 4" in the "region-main" "region"
  | 
        
        
            | 
            | 
           151 | 
               And I should not see "Section 2" in the "region-main" "region"
  | 
        
        
            | 
            | 
           152 | 
               And I should not see "Section 3" in the "region-main" "region"
  | 
        
        
            | 
            | 
           153 | 
               And I should see "Activity sample 1" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           154 | 
               And I should see "Activity sample 1" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           155 | 
               And I should see "Activity sample 2" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           156 | 
               And I should not see "Activity sample 3" in the "Section 4" "section"
  | 
        
        
            | 
            | 
           157 | 
               And I should not see "Activity sample 4" in the "Section 4" "section"
  | 
        
        
            | 
            | 
           158 | 
               And I should see "0 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           159 | 
              | 
        
        
            | 
            | 
           160 | 
             Scenario: Bulk move sections after general section
  | 
        
        
            | 
            | 
           161 | 
               Given I set the field "Edit section name" in the "Section 2" "section" to "Move one"
  | 
        
        
            | 
            | 
           162 | 
               And I set the field "Edit section name" in the "Section 3" "section" to "Move two"
  | 
        
        
            | 
            | 
           163 | 
               And I click on "Select section Move one" "checkbox"
  | 
        
        
            | 
            | 
           164 | 
               And I click on "Select section Move two" "checkbox"
  | 
        
        
            | 
            | 
           165 | 
               And I should see "2 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           166 | 
               When I click on "Move sections" "button" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           167 | 
               And I click on "General" "link" in the "Move selected sections" "dialogue"
  | 
        
        
            | 
            | 
           168 | 
               # Check activities are moved with the sections.
  | 
        
        
            | 
            | 
           169 | 
               Then I should see "Activity sample 1" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           170 | 
               And I should see "Activity sample 2" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           171 | 
               And I should see "Activity sample 3" in the "Move one" "section"
  | 
        
        
            | 
            | 
           172 | 
               And I should see "Activity sample 4" in the "Move one" "section"
  | 
        
        
            | 
            | 
           173 | 
               # Check new section order.
  | 
        
        
            | 
            | 
           174 | 
               And "Move one" "section" should appear after "General" "section"
  | 
        
        
            | 
            | 
           175 | 
               And "Move two" "section" should appear after "Move one" "section"
  | 
        
        
            | 
            | 
           176 | 
               And "Section 1" "section" should appear after "Move two" "section"
  | 
        
        
            | 
            | 
           177 | 
               And "Section 4" "section" should appear after "Section 1" "section"
  | 
        
        
            | 
            | 
           178 | 
              | 
        
        
            | 
            | 
           179 | 
             Scenario: Bulk move sections at the end of the course
  | 
        
        
            | 
            | 
           180 | 
               Given I set the field "Edit section name" in the "Section 3" "section" to "Move me"
  | 
        
        
            | 
            | 
           181 | 
               And I click on "Select section Section 2" "checkbox"
  | 
        
        
            | 
            | 
           182 | 
               And I click on "Select section Move me" "checkbox"
  | 
        
        
            | 
            | 
           183 | 
               And I should see "2 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           184 | 
               When I click on "Move sections" "button" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           185 | 
               And I click on "Section 4" "link" in the "Move selected sections" "dialogue"
  | 
        
        
            | 
            | 
           186 | 
               # Check activities are moved with the sections.
  | 
        
        
            | 
            | 
           187 | 
               Then I should see "Activity sample 1" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           188 | 
               And I should see "Activity sample 2" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           189 | 
               And I should see "Activity sample 3" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           190 | 
               And I should see "Activity sample 4" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           191 | 
               # Check new section order.
  | 
        
        
            | 
            | 
           192 | 
               And "Section 1" "section" should appear after "General" "section"
  | 
        
        
            | 
            | 
           193 | 
               And "Section 4" "section" should appear after "Section 1" "section"
  | 
        
        
            | 
            | 
           194 | 
               And "Section 2" "section" should appear after "Section 4" "section"
  | 
        
        
            | 
            | 
           195 | 
               And "Move me" "section" should appear after "Section 2" "section"
  | 
        
        
            | 
            | 
           196 | 
              | 
        
        
            | 
            | 
           197 | 
             Scenario: Bulk move sections in the middle of the course
  | 
        
        
            | 
            | 
           198 | 
               Given I set the field "Edit section name" in the "Section 4" "section" to "Move me"
  | 
        
        
            | 
            | 
           199 | 
               And I click on "Select section Section 1" "checkbox"
  | 
        
        
            | 
            | 
           200 | 
               And I click on "Select section Move me" "checkbox"
  | 
        
        
            | 
            | 
           201 | 
               And I should see "2 selected" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           202 | 
               When I click on "Move sections" "button" in the "sticky-footer" "region"
  | 
        
        
            | 
            | 
           203 | 
               And I click on "Section 2" "link" in the "Move selected sections" "dialogue"
  | 
        
        
            | 
            | 
           204 | 
               # Check activities are moved with the sections.
  | 
        
        
            | 
            | 
           205 | 
               Then I should see "Activity sample 1" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           206 | 
               And I should see "Activity sample 2" in the "Section 1" "section"
  | 
        
        
            | 
            | 
           207 | 
               And I should see "Activity sample 3" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           208 | 
               And I should see "Activity sample 4" in the "Section 2" "section"
  | 
        
        
            | 
            | 
           209 | 
               # Check new section order.
  | 
        
        
            | 
            | 
           210 | 
               And "Section 2" "section" should appear after "General" "section"
  | 
        
        
            | 
            | 
           211 | 
               And "Section 1" "section" should appear after "Section 2" "section"
  | 
        
        
            | 
            | 
           212 | 
               And "Move me" "section" should appear after "Section 1" "section"
  | 
        
        
            | 
            | 
           213 | 
               And "Section 3" "section" should appear after "Move me" "section"
  |