| Línea 11... |
Línea 11... |
| 11 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
11 |
| teacher2 | Teacher | 2 | teacher2@example.com |
|
| 12 |
| student1 | Student | 1 | student1@example.com |
|
12 |
| student1 | Student | 1 | student1@example.com |
|
| 13 |
| student2 | Student | 2 | student2@example.com |
|
13 |
| student2 | Student | 2 | student2@example.com |
|
| 14 |
And the following "courses" exist:
|
14 |
And the following "courses" exist:
|
| 15 |
| fullname | shortname | category | groupmode |
|
15 |
| fullname | shortname | category | groupmode |
|
| 16 |
| Course 1 | C1 | 0 | 1 |
|
16 |
| Course 1 | C1 | 0 | 1 |
|
| 17 |
And the following "course enrolments" exist:
|
17 |
And the following "course enrolments" exist:
|
| 18 |
| user | course | role |
|
18 |
| user | course | role |
|
| 19 |
| teacher1 | C1 | editingteacher |
|
19 |
| teacher1 | C1 | editingteacher |
|
| 20 |
| teacher2 | C1 | teacher |
|
20 |
| teacher2 | C1 | teacher |
|
| 21 |
| student1 | C1 | student |
|
21 |
| student1 | C1 | student |
|
| Línea 28... |
Línea 28... |
| 28 |
| user | group |
|
28 |
| user | group |
|
| 29 |
| student1 | CB |
|
29 |
| student1 | CB |
|
| 30 |
| teacher1 | CB |
|
30 |
| teacher1 | CB |
|
| 31 |
| student2 | CA |
|
31 |
| student2 | CA |
|
| 32 |
| teacher2 | CA |
|
32 |
| teacher2 | CA |
|
| 33 |
And I am on the "Course 1" "course editing" page logged in as "teacher1"
|
33 |
And the following "core_badges > Badge" exists:
|
| 34 |
And I expand all fieldsets
|
34 |
| name | Course Badge |
|
| 35 |
And I set the field "Group mode" to "Separate groups"
|
35 |
| course | C1 |
|
| 36 |
And I press "Save and display"
|
36 |
| description | Course badge description |
|
| 37 |
And I navigate to "Badges > Add a new badge" in current page administration
|
37 |
| image | badges/tests/behat/badge.png |
|
| 38 |
And I set the following fields to these values:
|
38 |
| status | 0 |
|
| 39 |
| Name | Course Badge |
|
39 |
| type | 2 |
|
| 40 |
| Description | Course badge description |
|
40 |
And I am on the "Course 1" "course" page logged in as "teacher1"
|
| 41 |
And I upload "badges/tests/behat/badge.png" file to "Image" filemanager
|
41 |
And I navigate to "Badges" in current page administration
|
| 42 |
And I press "Create badge"
|
42 |
And I follow "Course Badge"
|
| - |
|
43 |
And I select "Criteria" from the "jump" singleselect
|
| 43 |
And I set the field "type" to "Manual issue by role"
|
44 |
And I set the field "type" to "Manual issue by role"
|
| 44 |
And I expand all fieldsets
|
45 |
And I expand all fieldsets
|
| 45 |
And I set the field "Teacher" to "1"
|
46 |
And I set the field "Teacher" to "1"
|
| 46 |
And I set the field "Non-editing teacher" to "1"
|
47 |
And I set the field "Non-editing teacher" to "1"
|
| 47 |
# Set to ANY of the roles awards badge.
|
48 |
# Set to ANY of the roles awards badge.
|
| 48 |
And I set the field "Any of the selected roles awards the badge" to "1"
|
49 |
And I set the field "Any of the selected roles awards the badge" to "1"
|
| 49 |
And I press "Save"
|
50 |
And I press "Save"
|
| 50 |
And I press "Enable access"
|
51 |
And I press "Enable access"
|
| 51 |
And I press "Continue"
|
52 |
And I click on "Enable" "button" in the "Confirm" "dialogue"
|
| 52 |
And I log out
|
- |
|
| Línea 53... |
Línea 53... |
| 53 |
|
53 |
|
| 54 |
@javascript
|
54 |
@javascript
|
| 55 |
Scenario: Award course badge as non-editing teacher with only one group
|
55 |
Scenario: Award course badge as non-editing teacher with only one group
|
| 56 |
When I log in as "teacher2"
|
56 |
When I log in as "teacher2"
|
| 57 |
And I am on "Course 1" course homepage
|
57 |
And I am on "Course 1" course homepage
|
| 58 |
And I navigate to "Badges > Manage badges" in current page administration
|
58 |
And I navigate to "Badges" in current page administration
|
| 59 |
And I follow "Course Badge"
|
59 |
And I follow "Course Badge"
|
| 60 |
And I press "Award badge"
|
60 |
And I press "Award badge"
|
| 61 |
And I set the field "role" to "Non-editing teacher"
|
61 |
And I set the field "role" to "Non-editing teacher"
|
| 62 |
# Teacher 2 should see a "Separate groups" label with the group he is in
|
62 |
# Teacher 2 should see a "Separate groups" label with the group he is in
|
| Línea 66... |
Línea 66... |
| 66 |
And I should not see "Student 1"
|
66 |
And I should not see "Student 1"
|
| 67 |
# Non-editing teacher can award the badge
|
67 |
# Non-editing teacher can award the badge
|
| 68 |
And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
|
68 |
And I set the field "potentialrecipients[]" to "Student 2 (student2@example.com)"
|
| 69 |
And I press "Award badge"
|
69 |
And I press "Award badge"
|
| 70 |
And I am on "Course 1" course homepage
|
70 |
And I am on "Course 1" course homepage
|
| 71 |
And I navigate to "Badges > Manage badges" in current page administration
|
71 |
And I navigate to "Badges" in current page administration
|
| 72 |
And I follow "Course Badge"
|
72 |
And I follow "Course Badge"
|
| 73 |
And I should see "Recipients (1)"
|
73 |
And I should see "Recipients (1)"
|
| 74 |
And I log out
|
74 |
And I log out
|
| 75 |
And I log in as "student2"
|
75 |
And I log in as "student2"
|
| 76 |
And I follow "Profile" in the user menu
|
76 |
And I follow "Profile" in the user menu
|
| Línea 87... |
Línea 87... |
| 87 |
And I set the field "addselect" to "Teacher 2 (teacher2@example.com)"
|
87 |
And I set the field "addselect" to "Teacher 2 (teacher2@example.com)"
|
| 88 |
And I press "Add"
|
88 |
And I press "Add"
|
| 89 |
And I log out
|
89 |
And I log out
|
| 90 |
When I log in as "teacher2"
|
90 |
When I log in as "teacher2"
|
| 91 |
And I am on "Course 1" course homepage
|
91 |
And I am on "Course 1" course homepage
|
| 92 |
And I navigate to "Badges > Manage badges" in current page administration
|
92 |
And I navigate to "Badges" in current page administration
|
| 93 |
And I follow "Course Badge"
|
93 |
And I follow "Course Badge"
|
| 94 |
And I press "Award badge"
|
94 |
And I press "Award badge"
|
| 95 |
And I set the field "role" to "Non-editing teacher"
|
95 |
And I set the field "role" to "Non-editing teacher"
|
| 96 |
# Teacher 2 should see a "Separate groups" label and a dropdown menu with the groups he belongs to
|
96 |
# Teacher 2 should see a "Separate groups" label and a dropdown menu with the groups he belongs to
|
| 97 |
And I set the field "Separate groups" to "Class A"
|
97 |
And I set the field "Separate groups" to "Class A"
|
| Línea 112... |
Línea 112... |
| 112 |
And I press "Remove"
|
112 |
And I press "Remove"
|
| 113 |
And I press "Back to groups"
|
113 |
And I press "Back to groups"
|
| 114 |
And I log out
|
114 |
And I log out
|
| 115 |
When I log in as "teacher2"
|
115 |
When I log in as "teacher2"
|
| 116 |
And I am on "Course 1" course homepage
|
116 |
And I am on "Course 1" course homepage
|
| 117 |
And I navigate to "Badges > Manage badges" in current page administration
|
117 |
And I navigate to "Badges" in current page administration
|
| 118 |
And I follow "Course Badge"
|
118 |
And I follow "Course Badge"
|
| 119 |
And I press "Award badge"
|
119 |
And I press "Award badge"
|
| 120 |
# Teacher 2 shouldn't be able to go further
|
120 |
# Teacher 2 shouldn't be able to go further
|
| 121 |
Then I should see "Sorry, but you need to be part of a group to see this page."
|
121 |
Then I should see "Sorry, but you need to be part of a group to see this page."
|
| Línea 122... |
Línea 122... |
| 122 |
|
122 |
|
| 123 |
@javascript
|
123 |
@javascript
|
| 124 |
Scenario: Editing teacher can award badge to members of separate groups
|
124 |
Scenario: Editing teacher can award badge to members of separate groups
|
| 125 |
Given I am on the "Course 1" course page logged in as teacher1
|
125 |
Given I am on the "Course 1" course page logged in as teacher1
|
| 126 |
And I navigate to "Badges > Manage badges" in current page administration
|
126 |
And I navigate to "Badges" in current page administration
|
| 127 |
And I follow "Course Badge"
|
127 |
And I follow "Course Badge"
|
| 128 |
And I press "Award badge"
|
128 |
And I press "Award badge"
|
| 129 |
When I set the field "role" to "Teacher"
|
129 |
When I set the field "role" to "Teacher"
|
| 130 |
# Confirm that editing teacher sees a separate groups dropdown menu.
|
130 |
# Confirm that editing teacher sees a separate groups dropdown menu.
|
| Línea 153... |
Línea 153... |
| 153 |
And I expand all fieldsets
|
153 |
And I expand all fieldsets
|
| 154 |
# Set the group mode to visible groups.
|
154 |
# Set the group mode to visible groups.
|
| 155 |
And I set the field "Group mode" to "Visible groups"
|
155 |
And I set the field "Group mode" to "Visible groups"
|
| 156 |
And I press "Save and display"
|
156 |
And I press "Save and display"
|
| 157 |
When I am on the "Course 1" course page logged in as <loggedinuser>
|
157 |
When I am on the "Course 1" course page logged in as <loggedinuser>
|
| 158 |
And I navigate to "Badges > Manage badges" in current page administration
|
158 |
And I navigate to "Badges" in current page administration
|
| 159 |
And I follow "Course Badge"
|
159 |
And I follow "Course Badge"
|
| 160 |
And I press "Award badge"
|
160 |
And I press "Award badge"
|
| 161 |
And I set the field "role" to "<awarder>"
|
161 |
And I set the field "role" to "<awarder>"
|
| 162 |
# Confirm that teachers see a visible groups dropdown menu.
|
162 |
# Confirm that teachers see a visible groups dropdown menu.
|
| 163 |
Then "Visible groups" "select" should exist
|
163 |
Then "Visible groups" "select" should exist
|
| Línea 194... |
Línea 194... |
| 194 |
And I expand all fieldsets
|
194 |
And I expand all fieldsets
|
| 195 |
# Set the group mode to no groups.
|
195 |
# Set the group mode to no groups.
|
| 196 |
And I set the field "Group mode" to "No groups"
|
196 |
And I set the field "Group mode" to "No groups"
|
| 197 |
And I press "Save and display"
|
197 |
And I press "Save and display"
|
| 198 |
When I am on the "Course 1" course page logged in as <loggedinuser>
|
198 |
When I am on the "Course 1" course page logged in as <loggedinuser>
|
| 199 |
And I navigate to "Badges > Manage badges" in current page administration
|
199 |
And I navigate to "Badges" in current page administration
|
| 200 |
And I follow "Course Badge"
|
200 |
And I follow "Course Badge"
|
| 201 |
And I press "Award badge"
|
201 |
And I press "Award badge"
|
| 202 |
And I set the field "role" to "<awarder>"
|
202 |
And I set the field "role" to "<awarder>"
|
| 203 |
# Confirm that no group dropdowns don't exist.
|
203 |
# Confirm that no group dropdowns don't exist.
|
| 204 |
Then "Separate groups" "select" should not exist
|
204 |
Then "Separate groups" "select" should not exist
|