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