[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 @core @core_availability 2 Feature: edit_availability 3 In order to control which students can see activities 4 As a teacher 5 I need to set up availability options for activities and sections 6 7 # PURPOSE OF THIS TEST FEATURE: 8 # 9 # This test covers the user interface around editing availability conditions, 10 # especially the JavaScript code which is not tested elsewhere (e.g. does the 11 # 'Add restriction' dialog work). It tests both forms and also the admin 12 # setting interface. 13 # 14 # This test does not check the detailed behaviour of the availability system, 15 # which is mainly covered in PHPUnit (and, from the user interface 16 # perspective, in the other Behat tests for each type of condition). 17 18 Background: 19 Given the following "courses" exist: 20 | fullname | shortname | format | 21 | Course 1 | C1 | topics | 22 And the following "users" exist: 23 | username | 24 | teacher1 | 25 | student1 | 26 And the following "course enrolments" exist: 27 | user | course | role | 28 | teacher1 | C1 | editingteacher | 29 | student1 | C1 | student | 30 31 Scenario: Confirm the 'enable availability' option is working 32 Given the following config values are set as admin: 33 | enableavailability | 0 | 34 When I log in as "teacher1" 35 And I am on site homepage 36 And I follow "Course 1" 37 And I turn editing mode on 38 And I add a "Page" to section "1" 39 Then "Restrict access" "fieldset" should not exist 40 41 Given I follow "C1" 42 When I edit the section "1" 43 Then "Restrict access" "fieldset" should not exist 44 45 And the following config values are set as admin: 46 | enableavailability | 1 | 47 48 And I am on site homepage 49 And I follow "Course 1" 50 And I add a "Page" to section "1" 51 Then "Restrict access" "fieldset" should exist 52 53 Given I follow "C1" 54 When I edit the section "1" 55 Then "Restrict access" "fieldset" should exist 56 57 @javascript 58 Scenario: Edit availability using settings in activity form 59 # Set up. 60 Given I log in as "teacher1" 61 And I follow "Course 1" 62 63 # Add a Page and check it has None in so far. 64 And I turn editing mode on 65 And I add a "Page" to section "1" 66 And I expand all fieldsets 67 Then I should see "None" in the "Restrict access" "fieldset" 68 69 # Add a Date restriction and check it appears. 70 When I click on "Add restriction..." "button" 71 Then "Add restriction..." "dialogue" should be visible 72 When I click on "Date" "button" in the "Add restriction..." "dialogue" 73 Then "Add restriction..." "dialogue" should not exist 74 And I should not see "None" in the "Restrict access" "fieldset" 75 And "Restriction type" "select" should be visible 76 And I should see "Date" in the "Restrict access" "fieldset" 77 And ".availability-item .availability-eye img" "css_element" should be visible 78 And ".availability-item .availability-delete img" "css_element" should be visible 79 And the "alt" attribute of ".availability-item .availability-eye img" "css_element" should contain "Displayed greyed-out" 80 81 # Toggle the eye icon. 82 When I click on ".availability-item .availability-eye img" "css_element" 83 Then the "alt" attribute of ".availability-item .availability-eye img" "css_element" should contain "Hidden entirely" 84 When I click on ".availability-item .availability-eye img" "css_element" 85 Then the "alt" attribute of ".availability-item .availability-eye img" "css_element" should contain "Displayed greyed-out" 86 87 # Click the delete button. 88 When I click on ".availability-item .availability-delete img" "css_element" 89 Then I should not see "Date" in the "Restrict access" "fieldset" 90 91 # Add a nested restriction set and check it appears. 92 When I click on "Add restriction..." "button" 93 And I click on "Restriction set" "button" in the "Add restriction..." "dialogue" 94 Then ".availability-children .availability-list" "css_element" should be visible 95 And I should see "None" in the ".availability-children .availability-list" "css_element" 96 And I should see "Please set" in the ".availability-children .availability-list" "css_element" 97 And I should see "Add restriction" in the ".availability-children .availability-list" "css_element" 98 99 # Click on the button to add a restriction inside the nested set. 100 When I click on "Add restriction..." "button" in the ".availability-children .availability-list" "css_element" 101 And I click on "Date" "button" in the "Add restriction..." "dialogue" 102 Then I should not see "None" in the ".availability-children .availability-list" "css_element" 103 And I should not see "Please set" in the ".availability-children .availability-list" "css_element" 104 And I should see "Date" in the ".availability-children .availability-list" "css_element" 105 106 # OK, let's delete the date inside the nested set... 107 When I click on ".availability-item .availability-delete img" "css_element" in the ".availability-item" "css_element" 108 Then I should not see "Date" in the ".availability-children .availability-list" "css_element" 109 And I should see "None" in the ".availability-children .availability-list" "css_element" 110 111 # ...and the nested set itself. 112 When I click on ".availability-none .availability-delete img" "css_element" 113 Then ".availability-children .availability-list" "css_element" should not exist 114 115 # Add two dates so we can check the connectors. 116 When I click on "Add restriction..." "button" 117 And I click on "Date" "button" in the "Add restriction..." "dialogue" 118 And I click on "Add restriction..." "button" 119 And I click on "Date" "button" in the "Add restriction..." "dialogue" 120 Then I should see "and" in the "Restrict access" "fieldset" 121 And "Required restrictions" "select" should be visible 122 123 # Try changing the connector type. 124 When I set the field "Required restrictions" to "any" 125 Then I should not see "and" in the "Restrict access" "fieldset" 126 And I should see "or" in the "Restrict access" "fieldset" 127 128 # Now delete one of the dates and check the connector goes away. 129 When I click on ".availability-item .availability-delete img" "css_element" 130 Then I should not see "or" in the "Restrict access" "fieldset" 131 132 # Add a nested restriction set with two dates so there will be inner connector. 133 When I click on "Add restriction..." "button" 134 And I click on "Restriction set" "button" in the "Add restriction..." "dialogue" 135 And I click on "Add restriction..." "button" in the ".availability-children .availability-list" "css_element" 136 And I click on "Date" "button" in the "Add restriction..." "dialogue" 137 And I click on "Add restriction..." "button" in the ".availability-children .availability-list" "css_element" 138 And I click on "Date" "button" in the "Add restriction..." "dialogue" 139 Then I should see "and" in the ".availability-children .availability-list .availability-connector" "css_element" 140 141 # Check changing the outer one does not affect the inner one. 142 When I set the field "Required restrictions" to "all" 143 Then I should not see "or" in the "Restrict access" "fieldset" 144 When I set the field "Required restrictions" to "any" 145 Then I should see "or" in the "Restrict access" "fieldset" 146 And I should not see "or" in the ".availability-children .availability-list .availability-connector" "css_element" 147 148 @javascript 149 Scenario: Edit availability using settings in section form 150 # Set up. 151 Given I log in as "teacher1" 152 And I am on site homepage 153 And I follow "Course 1" 154 And I turn editing mode on 155 156 # Edit a section 157 When I edit the section "1" 158 And I expand all fieldsets 159 Then I should see "None" in the "Restrict access" "fieldset" 160 161 # Add a Date restriction and check it appears. 162 When I click on "Add restriction..." "button" 163 When I click on "Date" "button" in the "Add restriction..." "dialogue" 164 And I should not see "None" in the "Restrict access" "fieldset" 165 And "Restriction type" "select" should be visible 166 And I should see "Date" in the "Restrict access" "fieldset" 167 168 @javascript 169 Scenario: 'Add group/grouping access restriction' button unavailable 170 # Button does not exist when conditional access restrictions are turned off. 171 Given the following config values are set as admin: 172 | enableavailability | 0 | 173 And I log in as "admin" 174 And I am on site homepage 175 And I follow "Course 1" 176 And I turn editing mode on 177 And I add a "Forum" to section "1" 178 When I expand all fieldsets 179 Then "Add group/grouping access restriction" "button" should not exist 180 181 @javascript 182 Scenario: Use the 'Add group/grouping access restriction' button 183 # Button should initially be disabled. 184 Given the following "groupings" exist: 185 | name | course | idnumber | 186 | GX1 | C1 | GXI1 | 187 And I log in as "admin" 188 And I am on site homepage 189 And I follow "Course 1" 190 And I turn editing mode on 191 And I add a "Forum" to section "1" 192 And I set the following fields to these values: 193 | Forum name | MyForum | 194 | Description | x | 195 When I expand all fieldsets 196 Then the "Add group/grouping access restriction" "button" should be disabled 197 198 # Turn on separate groups. 199 And I set the field "Group mode" to "Separate groups" 200 And the "Add group/grouping access restriction" "button" should be enabled 201 202 # Press the button and check it adds a restriction and disables itself. 203 And I should see "None" in the "Restrict access" "fieldset" 204 And I press "Add group/grouping access restriction" 205 And I should see "Group" in the "Restrict access" "fieldset" 206 And the "Add group/grouping access restriction" "button" should be disabled 207 208 # Delete the restriction and check it is enabled again. 209 And I click on "Delete" "link" in the "Restrict access" "fieldset" 210 And the "Add group/grouping access restriction" "button" should be enabled 211 212 # Try a grouping instead. 213 And I set the field "Grouping" to "GX1" 214 And I press "Add group/grouping access restriction" 215 And I should see "Grouping" in the "Restrict access" "fieldset" 216 217 # Check the button still works after saving and editing. 218 And I press "Save and display" 219 And I navigate to "Edit settings" node in "Forum administration" 220 And I expand all fieldsets 221 And the "Add group/grouping access restriction" "button" should be disabled 222 And I should see "Grouping" in the "Restrict access" "fieldset" 223 224 # And check it's still active if I delete the condition. 225 And I click on "Delete" "link" in the "Restrict access" "fieldset" 226 And the "Add group/grouping access restriction" "button" should be enabled
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Thu Aug 11 10:00:09 2016 | Cross-referenced by PHPXref 0.7.1 |