Merge branch 'w45_MDL-42525_m26_plugininfoperf' of https://github.com/skodak/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
844d74d7 12 Scenario: Award profile badge
27806552
YB
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:
844d74d7 17 | Name | Profile Badge |
27806552
YB
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"
27806552
YB
24 And I check "First name"
25 And I check "Email address"
844d74d7 26 And I check "Phone"
27806552
YB
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."
844d74d7
JM
32 And I press "Enable access"
33 And I press "Continue"
34 And I expand "My profile settings" node
35 And I follow "Edit profile"
36 And I expand all fieldsets
37 And I fill in "Phone" with "123456789"
38 And I press "Update profile"
39 And I follow "My badges"
40 Then I should see "Profile Badge"
41 And I should not see "There are no badges available."
27806552
YB
42
43 @javascript
844d74d7
JM
44 Scenario: Award site badge
45 Given the following "users" exists:
46 | username | firstname | lastname | email |
47 | teacher | teacher | 1 | teacher1@asd.com |
48 | student | student | 1 | student1@asd.com |
49 And I expand "Site administration" node
27806552
YB
50 And I expand "Badges" node
51 And I follow "Add a new badge"
52 And I fill the moodle form with:
844d74d7
JM
53 | Name | Site Badge |
54 | Description | Site badge description |
55 | issuername | Tester of site badge |
27806552
YB
56 And I upload "badges/tests/behat/badge.png" file to "Image" filepicker
57 And I press "Create badge"
844d74d7
JM
58 And I select "Manual issue by role" from "type"
59 And I check "Teacher"
27806552
YB
60 And I press "Save"
61 And I press "Enable access"
62 And I press "Continue"
844d74d7
JM
63 And I follow "Recipients (0)"
64 And I press "Award badge"
65 And I select "teacher 1 (teacher1@asd.com)" from "potentialrecipients[]"
66 And I press "Award badge"
67 And I select "student 1 (student1@asd.com)" from "potentialrecipients[]"
68 And I press "Award badge"
69 When I follow "Site Badge"
70 Then I should see "Recipients (2)"
71 And I log out
72 And I log in as "student"
73 And I expand "My profile" node
74 And I follow "My badges"
75 Then I should see "Site Badge"