Merge branch 'MDL-42604-master' of git://github.com/ankitagarwal/moodle
[moodle.git] / badges / tests / behat / award_badge.feature
CommitLineData
550d842e 1@core @core_badges @_only_local
27806552
YB
2Feature: 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 Background:
8 Given I am on homepage
9 And I log in as "admin"
10
11 @javascript
12 Scenario: Add criteria
13 Given I expand "Site administration" node
14 And I expand "Badges" node
15 And I follow "Add a new badge"
16 And I fill the moodle form with:
17 | Name | Test Badge |
18 | Description | Test badge description |
19 | issuername | Test Badge Site |
20 | issuercontact | testuser@test-badge-site.com |
21 And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
22 And I press "Create badge"
23 And I select "Profile completion" from "type"
24 And I wait "5" seconds
25 And I check "First name"
26 And I check "Email address"
27 When I press "Save"
28 Then I should see "Profile completion"
29 And I should see "First name"
30 And I should see "Email address"
31 And I should not see "Criteria for this badge have not been set up yet."
32
33 @javascript
34 Scenario: Earn badge
35 Given I expand "Site administration" node
36 And I expand "Badges" node
37 And I follow "Add a new badge"
38 And I fill the moodle form with:
39 | Name | Profile Badge |
40 | Description | Test badge description |
41 | issuername | Test Badge Site |
42 | issuercontact | testuser@test-badge-site.com |
43 And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
44 And I press "Create badge"
45 And I select "Profile completion" from "type"
46 And I wait "5" seconds
47 And I check "Phone"
48 And I press "Save"
49 And I press "Enable access"
50 And I press "Continue"
51 And I expand "My profile settings" node
52 And I follow "Edit profile"
53 And I expand all fieldsets
54 And I fill in "Phone" with "123456789"
55 And I press "Update profile"
56 When I follow "My badges"
57 Then I should see "Profile Badge"
58 And I should not see "There are no badges available."