| 1 | efrain | 1 | @core @core_badges @_file_upload
 | 
        
           |  |  | 2 | Feature: Award badges based on user profile field
 | 
        
           |  |  | 3 |   In order to award badges to users based on completion of their user profile
 | 
        
           |  |  | 4 |   As an admin
 | 
        
           |  |  | 5 |   I need to add profile completion criteria to badges in the system
 | 
        
           |  |  | 6 |   | 
        
           |  |  | 7 |   @javascript
 | 
        
           |  |  | 8 |   Scenario: Award badge for a uploading a profile picture.
 | 
        
           |  |  | 9 |     Given the following "users" exist:
 | 
        
           |  |  | 10 |       | username | firstname | lastname | email           |
 | 
        
           |  |  | 11 |       | user1    | First     | User     | first@example.com  |
 | 
        
           |  |  | 12 |     And the following "core_badges > Badge" exists:
 | 
        
           |  |  | 13 |       | name        | Site Badge                   |
 | 
        
           |  |  | 14 |       | status      | 0                            |
 | 
        
           |  |  | 15 |       | description | Site badge description       |
 | 
        
           |  |  | 16 |       | image       | badges/tests/behat/badge.png |
 | 
        
           |  |  | 17 |     And I log in as "admin"
 | 
        
           |  |  | 18 |     And I navigate to "Badges > Manage badges" in site administration
 | 
        
           |  |  | 19 |     And I press "Edit" action in the "Site Badge" report row
 | 
        
           |  |  | 20 |     And I select "Criteria" from the "jump" singleselect
 | 
        
           |  |  | 21 |     And I set the field "type" to "Profile completion"
 | 
        
           |  |  | 22 |     And I set the field "id_field_picture" to "1"
 | 
        
           |  |  | 23 |     And I press "Save"
 | 
        
           |  |  | 24 |     And I press "Enable access"
 | 
        
           | 1441 | ariadna | 25 |     And I click on "Enable" "button" in the "Confirm" "dialogue"
 | 
        
           | 1 | efrain | 26 |     And I log out
 | 
        
           |  |  | 27 |     When I log in as "user1"
 | 
        
           |  |  | 28 |     And I follow "Profile" in the user menu
 | 
        
           |  |  | 29 |     And I click on "Edit profile" "link" in the "region-main" "region"
 | 
        
           |  |  | 30 |     And I upload "badges/tests/behat/badge.png" file to "New picture" filemanager
 | 
        
           |  |  | 31 |     And I press "Update profile"
 | 
        
           |  |  | 32 |     Then I should see "Site Badge"
 |