[ Index ] |
PHP Cross Reference of Unnamed Project |
[Summary view] [Print] [Text view]
1 @core @core_availability 2 Feature: display_availability 3 In order to know which activities are available 4 As a user 5 I need to see appropriate availability restrictions for activities and sections 6 7 # PURPOSE OF THIS TEST FEATURE: 8 # 9 # This test is to do a basic check of the user interface relating to display 10 # of availability conditions - i.e. if there's a condition, does it show up; 11 # are we doing the HTML correctly; does it correctly hide an activity where 12 # the options are set to not show it at all. 13 # 14 # Things this test is not: 15 # - It is not a test of the date condition specifically. The date condition is 16 # only used as an example in order to get the availability information to 17 # display. (The date condition has its own Behat test in 18 # /availability/condition/date/tests/behat.) 19 # - It is not a complete test of the logic. This is supposed to be a shallow 20 # check of the user interface parts and doesn't cover all logical 21 # possibilities. The logic is tested in PHPUnit tests instead, which are 22 # much more efficient. (Again there are unit tests for the overall system 23 # and for each condition type.) 24 25 Background: 26 Given the following "courses" exist: 27 | fullname | shortname | format | 28 | Course 1 | C1 | topics | 29 And the following "users" exist: 30 | username | 31 | teacher1 | 32 | student1 | 33 And the following "course enrolments" exist: 34 | user | course | role | 35 | teacher1 | C1 | editingteacher | 36 | student1 | C1 | student | 37 38 @javascript 39 Scenario: Activity availability display 40 # Set up. 41 Given I log in as "teacher1" 42 And I am on site homepage 43 And I follow "Course 1" 44 And I turn editing mode on 45 46 # Add a Page with 1 restriction. 47 When I add a "Page" to section "1" 48 And I set the following fields to these values: 49 | Name | Page 1 | 50 | Description | Test | 51 | Page content | Test | 52 And I expand all fieldsets 53 And I press "Add restriction..." 54 And I click on "Date" "button" in the "Add restriction..." "dialogue" 55 And I set the field "direction" to "until" 56 And I set the field "x[year]" to "2013" 57 And I set the field "x[month]" to "March" 58 And I press "Save and return to course" 59 60 # Add a Page with 2 restrictions - one is set to hide from students if failed. 61 And I add a "Page" to section "2" 62 And I set the following fields to these values: 63 | Name | Page 2 | 64 | Description | Test | 65 | Page content | Test | 66 And I expand all fieldsets 67 And I press "Add restriction..." 68 And I click on "Date" "button" in the "Add restriction..." "dialogue" 69 And I set the field "direction" to "until" 70 And I set the field "x[year]" to "2013" 71 And I set the field "x[month]" to "March" 72 And I click on ".availability-item .availability-eye img" "css_element" 73 And I press "Add restriction..." 74 And I click on "User profile" "button" in the "Add restriction..." "dialogue" 75 And I set the field "User profile field" to "Email address" 76 And I set the field "Value to compare against" to "email@example.com" 77 And I set the field "Method of comparison" to "is equal to" 78 And I press "Save and return to course" 79 80 # Add another Page with no restrictions. 81 And I add a "Page" to section "3" and I fill the form with: 82 | Name | Page 3 | 83 | Description | Test | 84 | Page content | Test | 85 86 # Page 1 should show in single-line format, showing the date 87 Then I should see "Available until" in the "#section-1 .availabilityinfo" "css_element" 88 And I should see "2013" in the "#section-1 .availabilityinfo" "css_element" 89 And I should see "2013" in the "#section-1 .availabilityinfo" "css_element" 90 And "li" "css_element" should not exist in the "#section-1 .availabilityinfo" "css_element" 91 92 # Page 2 should show in list format. 93 And "li" "css_element" should exist in the "#section-2 .availabilityinfo" "css_element" 94 And I should see "Not available unless:" in the "#section-2 .availabilityinfo" "css_element" 95 And I should see "It is before" in the "#section-2 .availabilityinfo" "css_element" 96 And I should see "hidden otherwise" in the "#section-2 .availabilityinfo" "css_element" 97 And I should see "Email address" in the "#section-2 .availabilityinfo" "css_element" 98 99 # Page 3 should not have available info. 100 And "#section-3 .availabilityinfo" "css_element" should not exist 101 102 # Change to student view. 103 Given I log out 104 And I log in as "student1" 105 And I am on site homepage 106 And I follow "Course 1" 107 108 # Page 1 display still there but should be dimmed and not a link. 109 Then I should see "Page 1" in the "#section-1 .dimmed_text" "css_element" 110 And ".activityinstance a" "css_element" should not exist in the "Topic 1" "section" 111 112 # Date display should be present. 113 And I should see "Available until" in the "Topic 1" "section" 114 115 # Page 2 display not there at all 116 And I should not see "Page 2" in the "region-main" "region" 117 118 # Page 3 display and link 119 And I should see "Page 3" in the "region-main" "region" 120 And ".activityinstance a" "css_element" should exist in the "Topic 3" "section" 121 122 @javascript 123 Scenario: Section availability display 124 # Set up. 125 Given I log in as "teacher1" 126 And I am on site homepage 127 And I follow "Course 1" 128 And I turn editing mode on 129 130 # Add a restriction to section 1 (visible to students). 131 When I edit the section "1" 132 And I expand all fieldsets 133 And I press "Add restriction..." 134 And I click on "Date" "button" in the "Add restriction..." "dialogue" 135 And I set the field "direction" to "until" 136 And I set the field "x[year]" to "2013" 137 And I press "Save changes" 138 139 # Section 2 is the same but hidden from students 140 When I edit the section "2" 141 And I expand all fieldsets 142 And I press "Add restriction..." 143 And I click on "Date" "button" in the "Add restriction..." "dialogue" 144 And I set the field "direction" to "until" 145 And I set the field "x[year]" to "2013" 146 And I click on ".availability-item .availability-eye img" "css_element" 147 And I press "Save changes" 148 149 # This is necessary because otherwise it fails in Chrome, see MDL-44959 150 And I am on site homepage 151 And I follow "Course 1" 152 153 # Add Pages to each section. 154 And I add a "Page" to section "1" and I fill the form with: 155 | Name | Page 1 | 156 | Description | Test | 157 | Page content | Test | 158 And I add a "Page" to section "2" and I fill the form with: 159 | Name | Page 2 | 160 | Description | Test | 161 | Page content | Test | 162 And I add a "Page" to section "3" and I fill the form with: 163 | Name | Page 3 | 164 | Description | Test | 165 | Page content | Test | 166 167 # Check display 168 Then I should see "Available until" in the "#section-1 .availabilityinfo" "css_element" 169 And I should see "Available until" in the "#section-2 .availabilityinfo" "css_element" 170 And I should see "hidden otherwise" in the "#section-2 .availabilityinfo" "css_element" 171 172 # Change to student view. 173 Given I log out 174 And I log in as "student1" 175 And I am on site homepage 176 And I follow "Course 1" 177 178 # The contents of both sections should be hidden. 179 Then I should not see "Page 1" in the "region-main" "region" 180 And I should not see "Page 2" in the "region-main" "region" 181 And I should see "Page 3" in the "region-main" "region" 182 183 # Section 1 should be visible and show info. 184 And I should see "Topic 1" in the "region-main" "region" 185 And I should see "Available until" in the "#section-1 .availabilityinfo" "css_element" 186 187 # Section 2 should not be available at all 188 And I should not see "Topic 2" in the "region-main" "region"
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 |