1 |
efrain |
1 |
@core @core_badges @_file_upload @javascript
|
|
|
2 |
Feature: Display badges
|
|
|
3 |
In order to access to badges information
|
|
|
4 |
As a user
|
|
|
5 |
I need to view badges data awarded to users
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student1 | Student | 1 | student1@example.com |
|
|
|
11 |
# Create system badge and define a criterion.
|
1441 |
ariadna |
12 |
And the following "core_badges > Badge" exists:
|
|
|
13 |
| name | Testing system badge |
|
|
|
14 |
| status | inactive |
|
|
|
15 |
| version | 1.1 |
|
|
|
16 |
| language | ca |
|
|
|
17 |
| description | Testing system badge description |
|
|
|
18 |
| image | badges/tests/behat/badge.png |
|
|
|
19 |
| imagecaption | My caption image |
|
|
|
20 |
And the following "core_badges > Criterias" exist:
|
|
|
21 |
| badge | role |
|
|
|
22 |
| Testing system badge | editingteacher |
|
1 |
efrain |
23 |
And I log in as "admin"
|
1441 |
ariadna |
24 |
And I navigate to "Badges > Manage badges" in site administration
|
1 |
efrain |
25 |
|
1441 |
ariadna |
26 |
@accessibility
|
1 |
efrain |
27 |
Scenario: Display badge without expired date
|
|
|
28 |
# Enable the badge.
|
1441 |
ariadna |
29 |
Given I press "Enable access" action in the "Testing system badge" report row
|
|
|
30 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
1 |
efrain |
31 |
# Award badge to student1.
|
1441 |
ariadna |
32 |
When I press "Award badge" action in the "Testing system badge" report row
|
1 |
efrain |
33 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
|
|
34 |
And I press "Award badge"
|
|
|
35 |
# Check badge details are displayed.
|
|
|
36 |
And I navigate to "Badges > Manage badges" in site administration
|
|
|
37 |
And I follow "Testing system badge"
|
|
|
38 |
And I select "Recipients (1)" from the "jump" singleselect
|
|
|
39 |
And I press "View issued badge" action in the "Student 1" report row
|
|
|
40 |
Then I should see "Awarded to Student 1"
|
|
|
41 |
And I should see "This badge has to be awarded by a user with the following role:"
|
|
|
42 |
And I should not see "Expired"
|
|
|
43 |
And I should not see "Expires"
|
|
|
44 |
And I follow "More details"
|
|
|
45 |
And I should see "Catalan"
|
|
|
46 |
And I should see "1.1"
|
1441 |
ariadna |
47 |
And the page should meet accessibility standards with "best-practice" extra tests
|
1 |
efrain |
48 |
|
|
|
49 |
Scenario: Display badge with ALL criteria
|
|
|
50 |
# Add another criterion and enable the badge.
|
1441 |
ariadna |
51 |
Given I follow "Testing system badge"
|
|
|
52 |
And I select "Criteria" from the "jump" singleselect
|
|
|
53 |
And I set the field "type" to "Profile completion"
|
1 |
efrain |
54 |
And I set the field "id_field_firstname" to "1"
|
|
|
55 |
And I press "Save"
|
|
|
56 |
And I press "Enable access"
|
1441 |
ariadna |
57 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
1 |
efrain |
58 |
# Award badge to student1.
|
|
|
59 |
And I select "Recipients (0)" from the "jump" singleselect
|
|
|
60 |
And I press "Award badge"
|
|
|
61 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
|
|
62 |
And I press "Award badge"
|
|
|
63 |
# Check badge details are displayed.
|
|
|
64 |
And I navigate to "Badges > Manage badges" in site administration
|
|
|
65 |
And I follow "Testing system badge"
|
|
|
66 |
And I select "Recipients (1)" from the "jump" singleselect
|
1441 |
ariadna |
67 |
When I press "View issued badge" action in the "Student 1" report row
|
1 |
efrain |
68 |
Then I should see "Awarded to Student 1"
|
|
|
69 |
And I should see "Complete ALL of the listed requirements."
|
|
|
70 |
And I should see "This badge has to be awarded by a user with the following role:"
|
|
|
71 |
And I should see "The following user profile field has to be completed:"
|
|
|
72 |
And I should not see "Expired"
|
|
|
73 |
And I should not see "Expires"
|
|
|
74 |
And I follow "More details"
|
|
|
75 |
And I should see "Catalan"
|
|
|
76 |
And I should see "1.1"
|
|
|
77 |
|
|
|
78 |
Scenario: Display badge with ANY criteria
|
|
|
79 |
# Add another criterion and enable the badge.
|
1441 |
ariadna |
80 |
Given I follow "Testing system badge"
|
|
|
81 |
And I select "Criteria" from the "jump" singleselect
|
|
|
82 |
And I set the field "type" to "Profile completion"
|
1 |
efrain |
83 |
And I set the field "id_field_firstname" to "1"
|
|
|
84 |
And I press "Save"
|
|
|
85 |
And I set the field "update" to "2"
|
|
|
86 |
And I press "Enable access"
|
1441 |
ariadna |
87 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
1 |
efrain |
88 |
# Check badge details are displayed.
|
|
|
89 |
And I select "Recipients (2)" from the "jump" singleselect
|
1441 |
ariadna |
90 |
When I press "View issued badge" action in the "Student 1" report row
|
1 |
efrain |
91 |
Then I should see "Awarded to Student 1"
|
|
|
92 |
And I should see "Complete ANY of the listed requirements."
|
|
|
93 |
And I should see "This badge has to be awarded by a user with the following role:"
|
|
|
94 |
And I should see "The following user profile field has to be completed:"
|
|
|
95 |
And I should not see "Expired"
|
|
|
96 |
And I should not see "Expires"
|
|
|
97 |
And I follow "More details"
|
|
|
98 |
And I should see "Catalan"
|
|
|
99 |
And I should see "1.1"
|
|
|
100 |
|
|
|
101 |
Scenario: Display badge with expiration date but not expired yet
|
|
|
102 |
# Set expired date to badge (future date).
|
1441 |
ariadna |
103 |
Given I press "Edit" action in the "Testing system badge" report row
|
|
|
104 |
And I expand all fieldsets
|
|
|
105 |
When I click on "Relative date: this badge expires after a period of time:" "radio"
|
1 |
efrain |
106 |
And I set the field "expireperiod[number]" to "1"
|
|
|
107 |
And I press "Save changes"
|
1441 |
ariadna |
108 |
And I should see "Changes saved"
|
|
|
109 |
And I select "Overview" from the "jump" singleselect
|
1 |
efrain |
110 |
And I press "Enable access"
|
1441 |
ariadna |
111 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
1 |
efrain |
112 |
# Award badge to student1.
|
|
|
113 |
And I select "Recipients (0)" from the "jump" singleselect
|
|
|
114 |
And I press "Award badge"
|
|
|
115 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
|
|
116 |
And I press "Award badge"
|
|
|
117 |
# Check "Expires" date is displayed.
|
|
|
118 |
And I navigate to "Badges > Manage badges" in site administration
|
|
|
119 |
And I follow "Testing system badge"
|
|
|
120 |
And I select "Recipients (1)" from the "jump" singleselect
|
|
|
121 |
And I press "View issued badge" action in the "Student 1" report row
|
|
|
122 |
Then I should see "Expires"
|
|
|
123 |
And I should not see "Expired"
|
|
|
124 |
|
|
|
125 |
Scenario: Display expired badge
|
|
|
126 |
# Set expired date to badge (relative date 1 seconds after the date of issue it).
|
1441 |
ariadna |
127 |
Given I press "Edit" action in the "Testing system badge" report row
|
|
|
128 |
And I expand all fieldsets
|
|
|
129 |
When I click on "Relative date: this badge expires after a period of time:" "radio"
|
1 |
efrain |
130 |
And I set the field "expireperiod[timeunit]" to "1"
|
|
|
131 |
And I set the field "expireperiod[number]" to "1"
|
|
|
132 |
And I press "Save changes"
|
1441 |
ariadna |
133 |
And I should see "Changes saved"
|
|
|
134 |
And I select "Overview" from the "jump" singleselect
|
1 |
efrain |
135 |
And I press "Enable access"
|
1441 |
ariadna |
136 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
1 |
efrain |
137 |
# Award badge to student1.
|
|
|
138 |
And I select "Recipients (0)" from the "jump" singleselect
|
|
|
139 |
And I press "Award badge"
|
|
|
140 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
|
|
141 |
And I press "Award badge"
|
|
|
142 |
# Wait 1 second to guarantee the badge is expired.
|
|
|
143 |
And I wait "1" seconds
|
|
|
144 |
# Check "Expired" date is displayed.
|
|
|
145 |
And I navigate to "Badges > Manage badges" in site administration
|
|
|
146 |
And I follow "Testing system badge"
|
|
|
147 |
And I select "Recipients (1)" from the "jump" singleselect
|
|
|
148 |
And I press "View issued badge" action in the "Student 1" report row
|
|
|
149 |
Then I should see "Expired"
|
|
|
150 |
And I should not see "Expires"
|