Línea 7... |
Línea 7... |
7 |
Background:
|
7 |
Background:
|
8 |
Given the following "users" exist:
|
8 |
Given the following "users" exist:
|
9 |
| username | firstname | lastname | email |
|
9 |
| username | firstname | lastname | email |
|
10 |
| student1 | Student | 1 | student1@example.com |
|
10 |
| student1 | Student | 1 | student1@example.com |
|
11 |
# Create system badge and define a criterion.
|
11 |
# Create system badge and define a criterion.
|
- |
|
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 |
|
12 |
And I log in as "admin"
|
23 |
And I log in as "admin"
|
13 |
And I navigate to "Badges > Add a new badge" in site administration
|
24 |
And I navigate to "Badges > Manage badges" in site administration
|
14 |
And I set the following fields to these values:
|
- |
|
15 |
| Name | Testing system badge |
|
- |
|
16 |
| Version | 1.1 |
|
- |
|
17 |
| Language | Catalan |
|
- |
|
18 |
| Description | Testing system badge description |
|
- |
|
19 |
| Image author | http://author.example.com |
|
- |
|
20 |
| Image caption | Test caption image |
|
- |
|
21 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
- |
|
22 |
And I press "Create badge"
|
- |
|
23 |
And I set the field "type" to "Manual issue by role"
|
- |
|
24 |
And I expand all fieldsets
|
- |
|
25 |
And I set the field "Teacher" to "1"
|
- |
|
26 |
And I press "Save"
|
- |
|
Línea -... |
Línea 25... |
- |
|
25 |
|
27 |
|
26 |
@accessibility
|
28 |
Scenario: Display badge without expired date
|
27 |
Scenario: Display badge without expired date
|
29 |
# Enable the badge.
|
28 |
# Enable the badge.
|
30 |
Given I press "Enable access"
|
29 |
Given I press "Enable access" action in the "Testing system badge" report row
|
31 |
And I press "Continue"
|
30 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
32 |
# Award badge to student1.
|
31 |
# Award badge to student1.
|
33 |
And I select "Recipients (0)" from the "jump" singleselect
|
- |
|
34 |
And I press "Award badge"
|
32 |
When I press "Award badge" action in the "Testing system badge" report row
|
35 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
33 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
36 |
And I press "Award badge"
|
34 |
And I press "Award badge"
|
37 |
# Check badge details are displayed.
|
35 |
# Check badge details are displayed.
|
38 |
And I navigate to "Badges > Manage badges" in site administration
|
36 |
And I navigate to "Badges > Manage badges" in site administration
|
Línea 44... |
Línea 42... |
44 |
And I should not see "Expired"
|
42 |
And I should not see "Expired"
|
45 |
And I should not see "Expires"
|
43 |
And I should not see "Expires"
|
46 |
And I follow "More details"
|
44 |
And I follow "More details"
|
47 |
And I should see "Catalan"
|
45 |
And I should see "Catalan"
|
48 |
And I should see "1.1"
|
46 |
And I should see "1.1"
|
- |
|
47 |
And the page should meet accessibility standards with "best-practice" extra tests
|
Línea 49... |
Línea 48... |
49 |
|
48 |
|
50 |
Scenario: Display badge with ALL criteria
|
49 |
Scenario: Display badge with ALL criteria
|
- |
|
50 |
# Add another criterion and enable the badge.
|
- |
|
51 |
Given I follow "Testing system badge"
|
51 |
# Add another criterion and enable the badge.
|
52 |
And I select "Criteria" from the "jump" singleselect
|
52 |
Given I set the field "type" to "Profile completion"
|
53 |
And I set the field "type" to "Profile completion"
|
53 |
And I set the field "id_field_firstname" to "1"
|
54 |
And I set the field "id_field_firstname" to "1"
|
54 |
And I press "Save"
|
55 |
And I press "Save"
|
55 |
And I press "Enable access"
|
56 |
And I press "Enable access"
|
56 |
And I press "Continue"
|
57 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
57 |
# Award badge to student1.
|
58 |
# Award badge to student1.
|
58 |
And I select "Recipients (0)" from the "jump" singleselect
|
59 |
And I select "Recipients (0)" from the "jump" singleselect
|
59 |
And I press "Award badge"
|
60 |
And I press "Award badge"
|
60 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
61 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
61 |
And I press "Award badge"
|
62 |
And I press "Award badge"
|
62 |
# Check badge details are displayed.
|
63 |
# Check badge details are displayed.
|
63 |
And I navigate to "Badges > Manage badges" in site administration
|
64 |
And I navigate to "Badges > Manage badges" in site administration
|
64 |
And I follow "Testing system badge"
|
65 |
And I follow "Testing system badge"
|
65 |
And I select "Recipients (1)" from the "jump" singleselect
|
66 |
And I select "Recipients (1)" from the "jump" singleselect
|
66 |
And I press "View issued badge" action in the "Student 1" report row
|
67 |
When I press "View issued badge" action in the "Student 1" report row
|
67 |
Then I should see "Awarded to Student 1"
|
68 |
Then I should see "Awarded to Student 1"
|
68 |
And I should see "Complete ALL of the listed requirements."
|
69 |
And I should see "Complete ALL of the listed requirements."
|
69 |
And I should see "This badge has to be awarded by a user with the following role:"
|
70 |
And I should see "This badge has to be awarded by a user with the following role:"
|
70 |
And I should see "The following user profile field has to be completed:"
|
71 |
And I should see "The following user profile field has to be completed:"
|
Línea 74... |
Línea 75... |
74 |
And I should see "Catalan"
|
75 |
And I should see "Catalan"
|
75 |
And I should see "1.1"
|
76 |
And I should see "1.1"
|
Línea 76... |
Línea 77... |
76 |
|
77 |
|
77 |
Scenario: Display badge with ANY criteria
|
78 |
Scenario: Display badge with ANY criteria
|
- |
|
79 |
# Add another criterion and enable the badge.
|
- |
|
80 |
Given I follow "Testing system badge"
|
78 |
# Add another criterion and enable the badge.
|
81 |
And I select "Criteria" from the "jump" singleselect
|
79 |
Given I set the field "type" to "Profile completion"
|
82 |
And I set the field "type" to "Profile completion"
|
80 |
And I set the field "id_field_firstname" to "1"
|
83 |
And I set the field "id_field_firstname" to "1"
|
81 |
And I press "Save"
|
84 |
And I press "Save"
|
82 |
And I set the field "update" to "2"
|
85 |
And I set the field "update" to "2"
|
83 |
And I press "Enable access"
|
86 |
And I press "Enable access"
|
84 |
And I press "Continue"
|
87 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
85 |
# Check badge details are displayed.
|
88 |
# Check badge details are displayed.
|
86 |
And I select "Recipients (2)" from the "jump" singleselect
|
89 |
And I select "Recipients (2)" from the "jump" singleselect
|
87 |
And I press "View issued badge" action in the "Student 1" report row
|
90 |
When I press "View issued badge" action in the "Student 1" report row
|
88 |
Then I should see "Awarded to Student 1"
|
91 |
Then I should see "Awarded to Student 1"
|
89 |
And I should see "Complete ANY of the listed requirements."
|
92 |
And I should see "Complete ANY of the listed requirements."
|
90 |
And I should see "This badge has to be awarded by a user with the following role:"
|
93 |
And I should see "This badge has to be awarded by a user with the following role:"
|
91 |
And I should see "The following user profile field has to be completed:"
|
94 |
And I should see "The following user profile field has to be completed:"
|
Línea 95... |
Línea 98... |
95 |
And I should see "Catalan"
|
98 |
And I should see "Catalan"
|
96 |
And I should see "1.1"
|
99 |
And I should see "1.1"
|
Línea 97... |
Línea 100... |
97 |
|
100 |
|
98 |
Scenario: Display badge with expiration date but not expired yet
|
101 |
Scenario: Display badge with expiration date but not expired yet
|
99 |
# Set expired date to badge (future date).
|
102 |
# Set expired date to badge (future date).
|
- |
|
103 |
Given I press "Edit" action in the "Testing system badge" report row
|
100 |
Given I select "Edit details" from the "jump" singleselect
|
104 |
And I expand all fieldsets
|
101 |
When I click on "Relative date" "radio"
|
105 |
When I click on "Relative date: this badge expires after a period of time:" "radio"
|
102 |
And I set the field "expireperiod[number]" to "1"
|
106 |
And I set the field "expireperiod[number]" to "1"
|
- |
|
107 |
And I press "Save changes"
|
- |
|
108 |
And I should see "Changes saved"
|
103 |
And I press "Save changes"
|
109 |
And I select "Overview" from the "jump" singleselect
|
104 |
And I press "Enable access"
|
110 |
And I press "Enable access"
|
105 |
And I press "Continue"
|
111 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
106 |
# Award badge to student1.
|
112 |
# Award badge to student1.
|
107 |
And I select "Recipients (0)" from the "jump" singleselect
|
113 |
And I select "Recipients (0)" from the "jump" singleselect
|
108 |
And I press "Award badge"
|
114 |
And I press "Award badge"
|
109 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
115 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
Línea 116... |
Línea 122... |
116 |
Then I should see "Expires"
|
122 |
Then I should see "Expires"
|
117 |
And I should not see "Expired"
|
123 |
And I should not see "Expired"
|
Línea 118... |
Línea 124... |
118 |
|
124 |
|
119 |
Scenario: Display expired badge
|
125 |
Scenario: Display expired badge
|
120 |
# Set expired date to badge (relative date 1 seconds after the date of issue it).
|
126 |
# Set expired date to badge (relative date 1 seconds after the date of issue it).
|
- |
|
127 |
Given I press "Edit" action in the "Testing system badge" report row
|
121 |
Given I select "Edit details" from the "jump" singleselect
|
128 |
And I expand all fieldsets
|
122 |
When I click on "Relative date" "radio"
|
129 |
When I click on "Relative date: this badge expires after a period of time:" "radio"
|
123 |
And I set the field "expireperiod[timeunit]" to "1"
|
130 |
And I set the field "expireperiod[timeunit]" to "1"
|
124 |
And I set the field "expireperiod[number]" to "1"
|
131 |
And I set the field "expireperiod[number]" to "1"
|
- |
|
132 |
And I press "Save changes"
|
- |
|
133 |
And I should see "Changes saved"
|
125 |
And I press "Save changes"
|
134 |
And I select "Overview" from the "jump" singleselect
|
126 |
And I press "Enable access"
|
135 |
And I press "Enable access"
|
127 |
And I press "Continue"
|
136 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
128 |
# Award badge to student1.
|
137 |
# Award badge to student1.
|
129 |
And I select "Recipients (0)" from the "jump" singleselect
|
138 |
And I select "Recipients (0)" from the "jump" singleselect
|
130 |
And I press "Award badge"
|
139 |
And I press "Award badge"
|
131 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|
140 |
And I set the field "potentialrecipients[]" to "Student 1 (student1@example.com)"
|