Commit | Line | Data |
---|---|---|
550d842e | 1 | @core @core_badges @_only_local |
27806552 YB |
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 | 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" | |
68c13c68 JM |
76 | |
77 | @javascript | |
78 | Scenario: Award course badge | |
79 | Given the following "users" exists: | |
80 | | username | firstname | lastname | email | | |
81 | | teacher1 | Teacher | 1 | teacher1@asd.com | | |
82 | | student1 | Student | 1 | student1@asd.com | | |
83 | | student2 | Student | 2 | student2@asd.com | | |
84 | And the following "courses" exists: | |
85 | | fullname | shortname | category | groupmode | | |
86 | | Course 1 | C1 | 0 | 1 | | |
87 | And the following "course enrolments" exists: | |
88 | | user | course | role | | |
89 | | teacher1 | C1 | editingteacher | | |
90 | | student1 | C1 | student | | |
91 | | student2 | C1 | student | | |
92 | And I log out | |
93 | And I log in as "teacher1" | |
94 | And I follow "Course 1" | |
95 | And I click on "//span[text()='Badges']" "xpath_element" in the "Administration" "block" | |
96 | And I follow "Add a new badge" | |
97 | And I fill the moodle form with: | |
98 | | Name | Course Badge | | |
99 | | Description | Course badge description | | |
100 | | issuername | Tester of course badge | | |
101 | And I upload "badges/tests/behat/badge.png" file to "Image" filepicker | |
102 | And I press "Create badge" | |
103 | And I select "Manual issue by role" from "type" | |
104 | And I check "Teacher" | |
105 | And I press "Save" | |
106 | And I press "Enable access" | |
107 | And I press "Continue" | |
108 | And I follow "Recipients (0)" | |
109 | And I press "Award badge" | |
110 | And I select "Student 2 (student2@asd.com)" from "potentialrecipients[]" | |
111 | And I press "Award badge" | |
112 | And I select "Student 1 (student1@asd.com)" from "potentialrecipients[]" | |
113 | When I press "Award badge" | |
114 | And I follow "Course Badge" | |
115 | Then I should see "Recipients (2)" | |
116 | And I log out | |
117 | And I log in as "student1" | |
118 | And I follow "Course 1" | |
119 | And I expand "My profile" node | |
120 | And I follow "My badges" | |
121 | Then I should see "Course Badge" |