[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/badges/tests/behat/ -> award_badge.feature (source)

   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 | testuser@example.com |
  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 expand all fieldsets
  20      And I set the field "First name" to "1"
  21      And I set the field "Email address" to "1"
  22      And I set the field "Phone" to "1"
  23      And I set the field "id_description" to "Criterion description"
  24      When I press "Save"
  25      Then I should see "Profile completion"
  26      And I should see "First name"
  27      And I should see "Email address"
  28      And I should see "Phone"
  29      And I should see "Criterion description"
  30      And I should not see "Criteria for this badge have not been set up yet."
  31      And I press "Enable access"
  32      And I press "Continue"
  33      And I click on "Admin User" "link"
  34      And I follow "Profile" in the open menu
  35      And I follow "Edit profile"
  36      And I expand all fieldsets
  37      And I set the field "Phone" to "123456789"
  38      And I press "Update profile"
  39      And I follow "Profile" in the user menu
  40      Then I should see "Profile Badge"
  41      And I should not see "There are no badges available."
  42  
  43    @javascript
  44    Scenario: Award site badge
  45      Given the following "users" exist:
  46        | username | firstname | lastname | email |
  47        | teacher | teacher | 1 | teacher1@example.com |
  48        | student | student | 1 | student1@example.com |
  49      And I log in as "admin"
  50      And I navigate to "Add a new badge" node in "Site administration > Badges"
  51      And I set the following fields to these values:
  52        | Name | Site Badge |
  53        | Description | Site badge description |
  54        | issuername | Tester of site badge |
  55      And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
  56      And I press "Create badge"
  57      And I set the field "type" to "Manual issue by role"
  58      And I set the field "Teacher" to "1"
  59      And I press "Save"
  60      And I press "Enable access"
  61      And I press "Continue"
  62      And I follow "Recipients (0)"
  63      And I press "Award badge"
  64      And I set the field "potentialrecipients[]" to "teacher 1 (teacher1@example.com)"
  65      And I press "Award badge"
  66      And I set the field "potentialrecipients[]" to "student 1 (student1@example.com)"
  67      And I press "Award badge"
  68      When I follow "Site Badge"
  69      Then I should see "Recipients (2)"
  70      And I log out
  71      And I log in as "student"
  72      And I follow "Profile" in the user menu
  73      Then I should see "Site Badge"
  74  
  75    @javascript
  76    Scenario: Award course badge
  77      Given the following "users" exist:
  78        | username | firstname | lastname | email |
  79        | teacher1 | Teacher | 1 | teacher1@example.com |
  80        | student1 | Student | 1 | student1@example.com |
  81        | student2 | Student | 2 | student2@example.com |
  82      And the following "courses" exist:
  83        | fullname | shortname | category | groupmode |
  84        | Course 1 | C1 | 0 | 1 |
  85      And the following "course enrolments" exist:
  86        | user | course | role |
  87        | teacher1 | C1 | editingteacher |
  88        | student1 | C1 | student |
  89        | student2 | C1 | student |
  90      And I log in as "teacher1"
  91      And I follow "Course 1"
  92      And I navigate to "Add a new badge" node in "Course administration > Badges"
  93      And I follow "Add a new badge"
  94      And I set the following fields to these values:
  95        | Name | Course Badge |
  96        | Description | Course badge description |
  97        | issuername | Tester of course badge |
  98      And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
  99      And I press "Create badge"
 100      And I set the field "type" to "Manual issue by role"
 101      And I set the field "Teacher" to "1"
 102      And I press "Save"
 103      And I press "Enable access"
 104      And I press "Continue"
 105      And I follow "Recipients (0)"
 106      And I press "Award badge"
 107      And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
 108      And I press "Award badge"
 109      And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
 110      When I press "Award badge"
 111      And I follow "Course Badge"
 112      Then I should see "Recipients (2)"
 113      And I log out
 114      And I log in as "student1"
 115      And I follow "Profile" in the user menu
 116      And I follow "Course 1"
 117      And I should see "Course Badge"
 118  
 119    @javascript
 120    Scenario: Award badge on activity completion
 121      Given the following "courses" exist:
 122        | fullname | shortname | category |
 123        | Course 1 | C1 | 0 |
 124      And the following "users" exist:
 125        | username | firstname | lastname | email |
 126        | teacher1 | Teacher | Frist | teacher1@example.com |
 127        | student1 | Student | First | student1@example.com |
 128      And the following "course enrolments" exist:
 129        | user | course | role |
 130        | teacher1 | C1 | editingteacher |
 131        | student1 | C1 | student |
 132      And I log in as "teacher1"
 133      And I follow "Course 1"
 134      And I follow "Edit settings"
 135      And I set the following fields to these values:
 136        | Enable completion tracking | Yes |
 137      And I press "Save and display"
 138      And I turn editing mode on
 139      And I add a "Assignment" to section "1" and I fill the form with:
 140        | Assignment name | Test assignment name |
 141        | Description | Submit your online text |
 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 "Profile" in the user menu
 159      And I follow "Course 1"
 160      Then I should not see "badges"
 161      And I am on homepage
 162      And I follow "Course 1"
 163      And I press "Mark as complete: Test assignment name"
 164      And I follow "Profile" in the user menu
 165      And I follow "Course 1"
 166      Then I should see "Course Badge"
 167  
 168    @javascript
 169    Scenario: Award badge on course completion
 170      Given the following "courses" exist:
 171        | fullname | shortname | category |
 172        | Course 1 | C1 | 0 |
 173      And the following "users" exist:
 174        | username | firstname | lastname | email |
 175        | teacher1 | Teacher | Frist | teacher1@example.com |
 176        | student1 | Student | First | student1@example.com |
 177      And the following "course enrolments" exist:
 178        | user | course | role |
 179        | teacher1 | C1 | editingteacher |
 180        | student1 | C1 | student |
 181      And I log in as "teacher1"
 182      And I follow "Course 1"
 183      And I follow "Edit settings"
 184      And I set the following fields to these values:
 185        | Enable completion tracking | Yes |
 186      And I press "Save and display"
 187      And I turn editing mode on
 188      And I add a "Assignment" to section "1" and I fill the form with:
 189        | Assignment name | Test assignment name |
 190        | Description | Submit your online text |
 191        | assignsubmission_onlinetext_enabled | 1 |
 192      And I follow "Course completion"
 193      And I set the field "id_overall_aggregation" to "2"
 194      And I click on "Condition: Activity completion" "link"
 195      And I set the field "Assignment - Test assignment name" to "1"
 196      And I press "Save changes"
 197      And I follow "Course 1"
 198      And I navigate to "Add a new badge" node in "Course administration > Badges"
 199      And I follow "Add a new badge"
 200      And I set the following fields to these values:
 201        | Name | Course Badge |
 202        | Description | Course badge description |
 203        | issuername | Tester of course badge |
 204      And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
 205      And I press "Create badge"
 206      And I set the field "type" to "Course completion"
 207      And I set the field with xpath "//fieldset/input[1]" to "0"
 208      And I press "Save"
 209      And I press "Enable access"
 210      When I press "Continue"
 211      And I log out
 212      And I log in as "student1"
 213      And I follow "Profile" in the user menu
 214      And I follow "Course 1"
 215      Then I should not see "badges"
 216      And I am on homepage
 217      And I follow "Course 1"
 218      And I press "Mark as complete: Test assignment name"
 219      And I log out
 220      # Completion cron won't mark the whole course completed unless the
 221      # individual criteria was marked completed more than a second ago. So
 222      # run it twice, first to mark the criteria and second for the course.
 223      And I run the scheduled task "core\task\completion_regular_task"
 224      And I wait "1" seconds
 225      And I run the scheduled task "core\task\completion_regular_task"
 226      # The student should now see their badge.
 227      And I log in as "student1"
 228      And I follow "Profile" in the user menu
 229      Then I should see "Course Badge"


Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1