1 |
efrain |
1 |
@block @block_people
|
|
|
2 |
Feature: Using the block_people plugin
|
|
|
3 |
In order to display the block_people plugin
|
|
|
4 |
As admin
|
|
|
5 |
I need to be able to configure the plugin block_people
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname |
|
|
|
10 |
| Course 1 | C1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname |
|
|
|
13 |
| teacher1 | Teacher | 1 |
|
|
|
14 |
| noneditor1 | Non-editing teacher | 1 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| teacher1 | C1 | editingteacher |
|
|
|
18 |
| noneditor1 | C1 | teacher |
|
|
|
19 |
|
|
|
20 |
Scenario: Show participants in the block with the roles "Teacher" and "Non-editing teacher"
|
|
|
21 |
# The values are the position 3 (Teacher) and 4 (Non-editing Teacher) in the current list.
|
|
|
22 |
# If the list will be sorted in another way in the future this could break the test.
|
|
|
23 |
Given the following config values are set as admin:
|
|
|
24 |
| config | value | plugin |
|
|
|
25 |
| roles | 3, 4 | block_people |
|
|
|
26 |
When I log in as "teacher1"
|
|
|
27 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
28 |
And I add the "People" block
|
|
|
29 |
Then the user "Teacher 1" should be listed in the section with the role "Teacher"
|
|
|
30 |
And the user "Non-editing teacher 1" should be listed in the section with the role "Non-editing teacher"
|
|
|
31 |
|
|
|
32 |
# Javascript is needed for Scenarios with visibility checks.
|
|
|
33 |
@javascript
|
|
|
34 |
Scenario: Counter check: Do not show any roles
|
|
|
35 |
Given the following config values are set as admin:
|
|
|
36 |
| config | value | plugin |
|
|
|
37 |
| roles | 0 | block_people |
|
|
|
38 |
When I log in as "teacher1"
|
|
|
39 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
40 |
And I add the "People" block
|
|
|
41 |
Then ".block_people div.teachers" "css_element" should not be visible
|
|
|
42 |
|
|
|
43 |
Scenario: Show participants in the block with the roles "Teacher" and ""Non-editing teacher" with setting "Show multiple roles" enabled
|
|
|
44 |
Given the following config values are set as admin:
|
|
|
45 |
| config | value | plugin |
|
|
|
46 |
| multipleroles | 1 | block_people |
|
|
|
47 |
| roles | 3, 4 | block_people |
|
|
|
48 |
And the following "users" exist:
|
|
|
49 |
| username | firstname | lastname |
|
|
|
50 |
| multiroleuser | Multirole | User |
|
|
|
51 |
And the following "course enrolments" exist:
|
|
|
52 |
| user | course | role |
|
|
|
53 |
| multiroleuser | C1 | editingteacher |
|
|
|
54 |
And the following "system role assigns" exist:
|
|
|
55 |
| user | course | role |
|
|
|
56 |
| multiroleuser | Course 1 | teacher |
|
|
|
57 |
When I log in as "teacher1"
|
|
|
58 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
59 |
And I add the "People" block
|
|
|
60 |
Then the user "Teacher 1" should be listed in the section with the role "Teacher"
|
|
|
61 |
And the user "Multirole User" should be listed in the section with the role "Teacher"
|
|
|
62 |
And the user "Non-editing teacher 1" should be listed in the section with the role "Non-editing teacher"
|
|
|
63 |
And the user "Multirole User" should be listed in the section with the role "Non-editing teacher"
|
|
|
64 |
|
|
|
65 |
Scenario: Enable "Show link to the participants page"
|
|
|
66 |
Given the following config values are set as admin:
|
|
|
67 |
| config | value | plugin |
|
|
|
68 |
| linkparticipantspage | 1 | block_people |
|
|
|
69 |
When I log in as "teacher1"
|
|
|
70 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
71 |
And I add the "People" block
|
|
|
72 |
Then I should see "Show participants list" in the ".block_people .participants" "css_element"
|
|
|
73 |
When I click on "Show participants list" "link"
|
|
|
74 |
Then I should see "Participants" in the "region-main" "region"
|
|
|
75 |
|
|
|
76 |
Scenario: Counter check: Disable "Show link to the participants page"
|
|
|
77 |
Given the following config values are set as admin:
|
|
|
78 |
| config | value | plugin |
|
|
|
79 |
| linkparticipantspage | 0 | block_people |
|
|
|
80 |
When I log in as "teacher1"
|
|
|
81 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
82 |
And I add the "People" block
|
|
|
83 |
Then ".block_people .participants" "css_element" should not exist
|
|
|
84 |
|
|
|
85 |
Scenario: Enable "Hiding the block"
|
|
|
86 |
Given the following config values are set as admin:
|
|
|
87 |
| config | value | plugin |
|
|
|
88 |
| hideblock | 1 | block_people |
|
|
|
89 |
When I log in as "teacher1"
|
|
|
90 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
91 |
And I add the "People" block
|
|
|
92 |
When I open the action menu in "People" "block"
|
|
|
93 |
Then I should see "Hide People block"
|
|
|
94 |
When I click on "Hide People block" "link"
|
|
|
95 |
When I turn editing mode off
|
|
|
96 |
Then "People" "block" should not exist
|
|
|
97 |
When I turn editing mode on
|
|
|
98 |
And I open the action menu in "People" "block"
|
|
|
99 |
And I click on "Show People block" "link"
|
|
|
100 |
Then "People" "block" should exist
|
|
|
101 |
|
|
|
102 |
Scenario: Counter check: Disable "Hiding the block"
|
|
|
103 |
Given the following config values are set as admin:
|
|
|
104 |
| config | value | plugin |
|
|
|
105 |
| hideblock | 0 | block_people |
|
|
|
106 |
When I log in as "teacher1"
|
|
|
107 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
108 |
And I add the "People" block
|
|
|
109 |
When I open the action menu in "People" "block"
|
|
|
110 |
Then I should not see "Hide People block"
|
|
|
111 |
|
|
|
112 |
Scenario: Reset visibility of hidden People blocks
|
|
|
113 |
When I log in as "teacher1"
|
|
|
114 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
115 |
And I add the "People" block
|
|
|
116 |
And I open the action menu in "People" "block"
|
|
|
117 |
And I click on "Hide People block" "link"
|
|
|
118 |
And I turn editing mode off
|
|
|
119 |
Then "People" "block" should not exist
|
|
|
120 |
And I log out
|
|
|
121 |
When I log in as "admin"
|
|
|
122 |
And I navigate to "Plugins > Blocks > People" in site administration
|
|
|
123 |
And I set the field "Reset visibility" to "1"
|
|
|
124 |
And I press "Save changes"
|
|
|
125 |
And I log out
|
|
|
126 |
And I log in as "teacher1"
|
|
|
127 |
And I am on "Course 1" course homepage
|
|
|
128 |
Then "People" "block" should exist
|
|
|
129 |
|
|
|
130 |
@javascript
|
|
|
131 |
Scenario: The message icon is shown for users who can be messaged by the user
|
|
|
132 |
Given the following config values are set as admin:
|
|
|
133 |
| config | value | plugin |
|
|
|
134 |
| linkmessaging | 1 | block_people |
|
|
|
135 |
| roles | 3, 4 | block_people |
|
|
|
136 |
And the following "users" exist:
|
|
|
137 |
| username | firstname | lastname |
|
|
|
138 |
| student1 | Student | User |
|
|
|
139 |
And the following "course enrolments" exist:
|
|
|
140 |
| user | course | role |
|
|
|
141 |
| student1 | C1 | student |
|
|
|
142 |
And I log in as "noneditor1"
|
|
|
143 |
And I open messaging
|
|
|
144 |
And I open messaging settings preferences
|
|
|
145 |
And I click on "//label[text()[contains(.,'My contacts and anyone in my courses')]]" "xpath_element"
|
|
|
146 |
And I log out
|
|
|
147 |
And I log in as "teacher1"
|
|
|
148 |
And I open messaging
|
|
|
149 |
And I open messaging settings preferences
|
|
|
150 |
And I click on "//label[text()[contains(.,'My contacts only')]]" "xpath_element"
|
|
|
151 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
152 |
And I add the "People" block
|
|
|
153 |
And I log out
|
|
|
154 |
And I log in as "student1"
|
|
|
155 |
And I am on "Course 1" course homepage
|
|
|
156 |
Then "a[title='Send message to Non-editing teacher 1']" "css_element" should exist
|
|
|
157 |
And "a[title='Send message to Teacher 1']" "css_element" should not exist
|
|
|
158 |
|
|
|
159 |
@javascript
|
|
|
160 |
Scenario: Counter check: Do not show the message icon
|
|
|
161 |
Given the following config values are set as admin:
|
|
|
162 |
| config | value | plugin |
|
|
|
163 |
| linkmessaging | 0 | block_people |
|
|
|
164 |
| roles | 3, 4 | block_people |
|
|
|
165 |
And the following "users" exist:
|
|
|
166 |
| username | firstname | lastname |
|
|
|
167 |
| student1 | Student | User |
|
|
|
168 |
And the following "course enrolments" exist:
|
|
|
169 |
| user | course | role |
|
|
|
170 |
| student1 | C1 | student |
|
|
|
171 |
And I log in as "noneditor1"
|
|
|
172 |
And I open messaging
|
|
|
173 |
And I open messaging settings preferences
|
|
|
174 |
And I click on "//label[text()[contains(.,'My contacts and anyone in my courses')]]" "xpath_element"
|
|
|
175 |
And I log out
|
|
|
176 |
And I log in as "teacher1"
|
|
|
177 |
And I open messaging
|
|
|
178 |
And I open messaging settings preferences
|
|
|
179 |
And I click on "//label[text()[contains(.,'My contacts only')]]" "xpath_element"
|
|
|
180 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
181 |
And I add the "People" block
|
|
|
182 |
And I log out
|
|
|
183 |
And I log in as "student1"
|
|
|
184 |
And I am on "Course 1" course homepage
|
|
|
185 |
Then "a[title='Send message to Non-editing teacher 1']" "css_element" should not exist
|
|
|
186 |
And "a[title='Send message to Teacher 1']" "css_element" should not exist
|
|
|
187 |
|
|
|
188 |
Scenario: Enable "Show link to the teacher page on the avatar"
|
|
|
189 |
Given the following config values are set as admin:
|
|
|
190 |
| config | value | plugin |
|
|
|
191 |
| linkavatar | 1 | block_people |
|
|
|
192 |
| roles | 3, 4 | block_people |
|
|
|
193 |
When I log in as "teacher1"
|
|
|
194 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
195 |
And I add the "People" block
|
|
|
196 |
Then the user "Teacher 1" should be listed in the section with the role "Teacher"
|
|
|
197 |
And ".block_people .teachers .image a" "css_element" should exist
|
|
|
198 |
And I click on ".block_people .teachers .image a" "css_element"
|
|
|
199 |
And I should see "User details"
|
|
|
200 |
And I should see "Course details"
|
|
|
201 |
|
|
|
202 |
Scenario: Counter check: Disable "Show link to the teacher page on the avatar"
|
|
|
203 |
Given the following config values are set as admin:
|
|
|
204 |
| config | value | plugin |
|
|
|
205 |
| linkavatar | 0 | block_people |
|
|
|
206 |
| roles | 3, 4 | block_people |
|
|
|
207 |
When I log in as "teacher1"
|
|
|
208 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
209 |
And I add the "People" block
|
|
|
210 |
Then the user "Teacher 1" should be listed in the section with the role "Teacher"
|
|
|
211 |
And ".block_people .teachers .image a" "css_element" should not exist
|
|
|
212 |
|
|
|
213 |
Scenario: Enable "Show link to the teacher page on the teacher name"
|
|
|
214 |
Given the following config values are set as admin:
|
|
|
215 |
| config | value | plugin |
|
|
|
216 |
| linkname | 1 | block_people |
|
|
|
217 |
| roles | 3, 4 | block_people |
|
|
|
218 |
When I log in as "teacher1"
|
|
|
219 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
220 |
And I add the "People" block
|
|
|
221 |
Then the user "Teacher 1" should be listed in the section with the role "Teacher"
|
|
|
222 |
And ".block_people .teachers .name a" "css_element" should exist
|
|
|
223 |
And I click on ".block_people .teachers .name a" "css_element"
|
|
|
224 |
And I should see "User details"
|
|
|
225 |
And I should see "Course details"
|
|
|
226 |
|
|
|
227 |
Scenario: Counter check: Disable "Show link to the teacher page on the teacher name"
|
|
|
228 |
Given the following config values are set as admin:
|
|
|
229 |
| config | value | plugin |
|
|
|
230 |
| linkname | 0 | block_people |
|
|
|
231 |
| roles | 3, 4 | block_people |
|
|
|
232 |
When I log in as "teacher1"
|
|
|
233 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
234 |
And I add the "People" block
|
|
|
235 |
Then the user "Teacher 1" should be listed in the section with the role "Teacher"
|
|
|
236 |
And ".block_people .teachers .name a" "css_element" should not exist
|
|
|
237 |
|
|
|
238 |
Scenario: Do not show suspended users in the block
|
|
|
239 |
Given the following config values are set as admin:
|
|
|
240 |
| config | value | plugin |
|
|
|
241 |
| roles | 3, 4 | block_people |
|
|
|
242 |
And the following "users" exist:
|
|
|
243 |
| username | firstname | lastname |
|
|
|
244 |
| teacher2 | Teacher | 2 |
|
|
|
245 |
And the following "course enrolments" exist:
|
|
|
246 |
| user | course | role | status |
|
|
|
247 |
| teacher2 | C1 | editingteacher | 1 |
|
|
|
248 |
And I log in as "admin"
|
|
|
249 |
And I navigate to "Users > Accounts > Browse list of users" in site administration
|
|
|
250 |
And I click on "Edit" "link" in the "Teacher 2" "table_row"
|
|
|
251 |
And I set the field "Suspended account" to "1"
|
|
|
252 |
And I press "Update profile"
|
|
|
253 |
And I log out
|
|
|
254 |
When I log in as "teacher1"
|
|
|
255 |
And I am on "Course 1" course homepage with editing mode on
|
|
|
256 |
And I add the "People" block
|
|
|
257 |
Then the user "Teacher 1" should be listed in the section with the role "Teacher"
|
|
|
258 |
And the user "Teacher 2" should not be listed in the section with the role "Teacher"
|