[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 @core @core_badges @_file_upload 2 Feature: Award badges 3 In order to award badges to users for their achievements 4 As an admin 5 I need to add criteria to badges in the system 6 7 @javascript 8 Scenario: Award profile badge 9 Given I log in as "admin" 10 And I navigate to "Add a new badge" node in "Site administration > Badges" 11 And I set the following fields to these values: 12 | Name | Profile Badge | 13 | Description | Test badge description | 14 | issuername | Test Badge Site | 15 | issuercontact | [email protected] | 16 And I upload "badges/tests/behat/badge.png" file to "Image" filemanager 17 And I press "Create badge" 18 And I set the field "type" to "Profile completion" 19 And I set the field "First name" to "1" 20 And I set the field "Email address" to "1" 21 And I set the field "Phone" to "1" 22 When I press "Save" 23 Then I should see "Profile completion" 24 And I should see "First name" 25 And I should see "Email address" 26 And I should not see "Criteria for this badge have not been set up yet." 27 And I press "Enable access" 28 And I press "Continue" 29 And I expand "My profile settings" node 30 And I follow "Edit profile" 31 And I expand all fieldsets 32 And I set the field "Phone" to "123456789" 33 And I press "Update profile" 34 And I navigate to "My badges" node in "My profile" 35 Then I should see "Profile Badge" 36 And I should not see "There are no badges available." 37 38 @javascript 39 Scenario: Award site badge 40 Given the following "users" exist: 41 | username | firstname | lastname | email | 42 | teacher | teacher | 1 | [email protected] | 43 | student | student | 1 | [email protected] | 44 And I log in as "admin" 45 And I navigate to "Add a new badge" node in "Site administration > Badges" 46 And I set the following fields to these values: 47 | Name | Site Badge | 48 | Description | Site badge description | 49 | issuername | Tester of site badge | 50 And I upload "badges/tests/behat/badge.png" file to "Image" filemanager 51 And I press "Create badge" 52 And I set the field "type" to "Manual issue by role" 53 And I set the field "Teacher" to "1" 54 And I press "Save" 55 And I press "Enable access" 56 And I press "Continue" 57 And I follow "Recipients (0)" 58 And I press "Award badge" 59 And I set the field "potentialrecipients[]" to "teacher 1 ([email protected])" 60 And I press "Award badge" 61 And I set the field "potentialrecipients[]" to "student 1 ([email protected])" 62 And I press "Award badge" 63 When I follow "Site Badge" 64 Then I should see "Recipients (2)" 65 And I log out 66 And I log in as "student" 67 And I navigate to "My badges" node in "My profile" 68 Then I should see "Site Badge" 69 70 @javascript 71 Scenario: Award course badge 72 Given the following "users" exist: 73 | username | firstname | lastname | email | 74 | teacher1 | Teacher | 1 | [email protected] | 75 | student1 | Student | 1 | [email protected] | 76 | student2 | Student | 2 | [email protected] | 77 And the following "courses" exist: 78 | fullname | shortname | category | groupmode | 79 | Course 1 | C1 | 0 | 1 | 80 And the following "course enrolments" exist: 81 | user | course | role | 82 | teacher1 | C1 | editingteacher | 83 | student1 | C1 | student | 84 | student2 | C1 | student | 85 And I log in as "teacher1" 86 And I follow "Course 1" 87 And I navigate to "Add a new badge" node in "Course administration > Badges" 88 And I follow "Add a new badge" 89 And I set the following fields to these values: 90 | Name | Course Badge | 91 | Description | Course badge description | 92 | issuername | Tester of course badge | 93 And I upload "badges/tests/behat/badge.png" file to "Image" filemanager 94 And I press "Create badge" 95 And I set the field "type" to "Manual issue by role" 96 And I set the field "Teacher" to "1" 97 And I press "Save" 98 And I press "Enable access" 99 And I press "Continue" 100 And I follow "Recipients (0)" 101 And I press "Award badge" 102 And I set the field "potentialrecipients[]" to "Student 2 ([email protected])" 103 And I press "Award badge" 104 And I set the field "potentialrecipients[]" to "Student 1 ([email protected])" 105 When I press "Award badge" 106 And I follow "Course Badge" 107 Then I should see "Recipients (2)" 108 And I log out 109 And I log in as "student1" 110 And I follow "Course 1" 111 And I navigate to "My badges" node in "My profile" 112 Then I should see "Course Badge" 113 114 @javascript 115 Scenario: Award badge on activity completion 116 Given the following "courses" exist: 117 | fullname | shortname | category | 118 | Course 1 | C1 | 0 | 119 And the following "users" exist: 120 | username | firstname | lastname | email | 121 | teacher1 | Teacher | Frist | [email protected] | 122 | student1 | Student | First | [email protected] | 123 And the following "course enrolments" exist: 124 | user | course | role | 125 | teacher1 | C1 | editingteacher | 126 | student1 | C1 | student | 127 And I log in as "admin" 128 And I set the following administration settings values: 129 | Enable completion tracking | 1 | 130 And I follow "Home" 131 And I follow "Course 1" 132 And I follow "Edit settings" 133 And I set the following fields to these values: 134 | Enable completion tracking | Yes | 135 And I press "Save changes" 136 And I turn editing mode on 137 And I add a "Assignment" to section "1" and I fill the form with: 138 | Assignment name | Test assignment name | 139 | Description | Submit your online text | 140 And I log out 141 And I log in as "teacher1" 142 And I follow "Course 1" 143 And I navigate to "Add a new badge" node in "Course administration > Badges" 144 And I follow "Add a new badge" 145 And I set the following fields to these values: 146 | Name | Course Badge | 147 | Description | Course badge description | 148 | issuername | Tester of course badge | 149 And I upload "badges/tests/behat/badge.png" file to "Image" filemanager 150 And I press "Create badge" 151 And I set the field "type" to "Activity completion" 152 And I set the field "Test assignment name" to "1" 153 And I press "Save" 154 And I press "Enable access" 155 When I press "Continue" 156 And I log out 157 And I log in as "student1" 158 And I follow "Course 1" 159 And I navigate to "My badges" node in "My profile" 160 Then I should see "There are no badges available." 161 And I follow "Home" 162 And I follow "Course 1" 163 And I press "Mark as complete: Test assignment name" 164 And I navigate to "My badges" node in "My profile" 165 Then I should see "Course Badge" 166 167 @javascript 168 Scenario: Award badge on course completion 169 Given the following "courses" exist: 170 | fullname | shortname | category | 171 | Course 1 | C1 | 0 | 172 And the following "users" exist: 173 | username | firstname | lastname | email | 174 | teacher1 | Teacher | Frist | [email protected] | 175 | student1 | Student | First | [email protected] | 176 And the following "course enrolments" exist: 177 | user | course | role | 178 | teacher1 | C1 | editingteacher | 179 | student1 | C1 | student | 180 And I log in as "admin" 181 And I set the following administration settings values: 182 | Enable completion tracking | 1 | 183 And I follow "Home" 184 And I follow "Course 1" 185 And I follow "Edit settings" 186 And I set the following fields to these values: 187 | Enable completion tracking | Yes | 188 And I press "Save changes" 189 And I turn editing mode on 190 And I add a "Assignment" to section "1" and I fill the form with: 191 | Assignment name | Test assignment name | 192 | Description | Submit your online text | 193 | assignsubmission_onlinetext_enabled | 1 | 194 And I follow "Course completion" 195 And I set the field "id_overall_aggregation" to "2" 196 And I click on "Condition: Activity completion" "link" 197 And I set the field "Assign - Test assignment name" to "1" 198 And I press "Save changes" 199 And I log out 200 And I log in as "teacher1" 201 And I follow "Course 1" 202 And I navigate to "Add a new badge" node in "Course administration > Badges" 203 And I follow "Add a new badge" 204 And I set the following fields to these values: 205 | Name | Course Badge | 206 | Description | Course badge description | 207 | issuername | Tester of course badge | 208 And I upload "badges/tests/behat/badge.png" file to "Image" filemanager 209 And I press "Create badge" 210 And I set the field "type" to "Course completion" 211 And I set the field with xpath "//fieldset/input[1]" to "0" 212 And I press "Save" 213 And I press "Enable access" 214 When I press "Continue" 215 And I log out 216 And I log in as "student1" 217 And I follow "Course 1" 218 And I navigate to "My badges" node in "My profile" 219 Then I should see "There are no badges available." 220 And I follow "Home" 221 And I follow "Course 1" 222 And I press "Mark as complete: Test assignment name" 223 And I log out 224 And I log in as "admin" 225 # We can't wait for cron to happen, so the admin manually triggers it. 226 And I trigger cron 227 # The admin needs to trigger cron twice to see the completion status as completed. 228 # We wait more than 1 minute because of the next cron run scheduled time. 229 And I wait "61" seconds 230 And I trigger cron 231 # Finally the admin goes back to homepage to continue the user story. 232 And I am on homepage 233 And I log out 234 And I log in as "student1" 235 And I navigate to "My badges" node in "My profile" 236 Then I should see "Course Badge"
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |