1 |
efrain |
1 |
@core @core_badges @_file_upload @javascript
|
|
|
2 |
Feature: Manage badges is not shown when there are no existing badges.
|
|
|
3 |
|
|
|
4 |
Scenario: Check navigation at site level with no badges
|
|
|
5 |
Given I log in as "admin"
|
|
|
6 |
When I navigate to "Badges > Manage badges" in site administration
|
|
|
7 |
And I should see "There are currently no badges available for users to earn"
|
|
|
8 |
Then "Manage badges" "button" should not exist
|
|
|
9 |
|
|
|
10 |
Scenario: Check navigation at course level with no badges
|
|
|
11 |
Given the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| teacher | Teacher | 1 | teacher@example.com |
|
|
|
14 |
And the following "courses" exist:
|
|
|
15 |
| fullname | shortname | format | enablecompletion |
|
|
|
16 |
| Course 1 | C1 | topics | 1 |
|
|
|
17 |
And the following "course enrolments" exist:
|
|
|
18 |
| user | course | role |
|
|
|
19 |
| teacher | C1 | editingteacher |
|
|
|
20 |
And I log in as "teacher"
|
|
|
21 |
And I am on "Course 1" course homepage
|
|
|
22 |
When I navigate to "Badges" in current page administration
|
|
|
23 |
Then "Manage badges" "button" should not exist
|
|
|
24 |
And I click on "Add a new badge" "button"
|
|
|
25 |
And I set the following fields to these values:
|
|
|
26 |
| Name | Testing course badge |
|
|
|
27 |
| Version | 1.1 |
|
|
|
28 |
| Language | Basque |
|
|
|
29 |
| Description | Testing course badge description |
|
|
|
30 |
| Image author | http://author.example.com |
|
|
|
31 |
| Image caption | Test caption image |
|
|
|
32 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
|
|
33 |
And I click on "Create badge" "button"
|
|
|
34 |
And I click on "Back" "button"
|
|
|
35 |
And I should see "Testing course badge"
|
|
|
36 |
And I click on "Back" "button"
|
|
|
37 |
And "Manage badges" "button" should exist
|
|
|
38 |
# Badge is not enabled so is not listed.
|
|
|
39 |
And I should not see "Testing course badge"
|
|
|
40 |
And I click on "Manage badges" "button"
|
|
|
41 |
And I press "Edit" action in the "Testing course badge" report row
|
|
|
42 |
And I click on "Add criteria" "button"
|
|
|
43 |
And I set the field "type" to "Manual issue by role"
|
|
|
44 |
And I expand all fieldsets
|
|
|
45 |
And I set the field "Teacher" to "1"
|
|
|
46 |
And I click on "Save" "button"
|
|
|
47 |
And I click on "Back" "button"
|
|
|
48 |
And I should see "Testing course badge"
|
|
|
49 |
And I click on "Back" "button"
|
|
|
50 |
And "Manage badges" "button" should exist
|
|
|
51 |
# Badge is not enabled yet so is not listed.
|
|
|
52 |
And I should not see "Testing course badge"
|
|
|
53 |
And I click on "Manage badges" "button"
|
|
|
54 |
And I press "Enable access" action in the "Testing course badge" report row
|
|
|
55 |
And I click on "Continue" "button"
|
|
|
56 |
And I should see "Testing course badge"
|
|
|
57 |
And I click on "Back" "button"
|
|
|
58 |
And "Manage badges" "button" should exist
|
|
|
59 |
# Badge is already enabled so is listed.
|
|
|
60 |
And I should see "Testing course badge"
|
|
|
61 |
|
|
|
62 |
Scenario: Check navigation at course level with no badges as a student
|
|
|
63 |
# Create a badge, but leave it not enabled for now.
|
|
|
64 |
Given the following "users" exist:
|
|
|
65 |
| username | firstname | lastname | email |
|
|
|
66 |
| student1 | Student | 1 | student1@example.com |
|
|
|
67 |
And the following "courses" exist:
|
|
|
68 |
| fullname | shortname | format | enablecompletion |
|
|
|
69 |
| Course 1 | C1 | topics | 1 |
|
|
|
70 |
And the following "course enrolments" exist:
|
|
|
71 |
| user | course | role |
|
|
|
72 |
| student1 | C1 | student |
|
|
|
73 |
And I am on the "C1" "Course" page logged in as "admin"
|
|
|
74 |
And I navigate to "Badges > Add a new badge" in current page administration
|
|
|
75 |
And I set the following fields to these values:
|
|
|
76 |
| Name | Testing course badge |
|
|
|
77 |
| Version | 1.0 |
|
|
|
78 |
| Language | Catalan |
|
|
|
79 |
| Description | Testing course badge description |
|
|
|
80 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
|
|
81 |
And I press "Create badge"
|
|
|
82 |
And I set the field "type" to "Manual issue by role"
|
|
|
83 |
And I expand all fieldsets
|
|
|
84 |
And I set the field "Teacher" to "1"
|
|
|
85 |
And I press "Save"
|
|
|
86 |
And I log out
|
|
|
87 |
When I am on the "C1" "Course" page logged in as "student1"
|
|
|
88 |
Then "Badges" "link" should not exist in current page administration
|
|
|
89 |
And I log out
|
|
|
90 |
# Enable the badge.
|
|
|
91 |
And I am on the "C1" "Course" page logged in as "admin"
|
|
|
92 |
And I navigate to "Badges" in current page administration
|
|
|
93 |
And I click on "Manage badges" "button"
|
|
|
94 |
And I press "Enable access" action in the "Testing course badge" report row
|
|
|
95 |
And I press "Continue"
|
|
|
96 |
And I log out
|
|
|
97 |
# Now student should see the Badges link.
|
|
|
98 |
And I am on the "C1" "Course" page logged in as "student1"
|
|
|
99 |
And I follow "Badges"
|
|
|
100 |
And "Manage badges" "button" should not exist
|
|
|
101 |
And "Add a new badge" "button" should not exist
|
|
|
102 |
And I should not see "There are currently no badges available for users to earn."
|
|
|
103 |
And the following should exist in the "reportbuilder-table" table:
|
|
|
104 |
| Name | Description | Criteria |
|
|
|
105 |
| Testing course badge | Testing course badge description | Awarded by: Teacher |
|