1 |
efrain |
1 |
@core @core_group
|
|
|
2 |
Feature: Test role visibility for the groups management page
|
|
|
3 |
In order to control access
|
|
|
4 |
As an admin
|
|
|
5 |
I need to control which roles can see each other
|
|
|
6 |
|
|
|
7 |
Background: Set up some groups
|
|
|
8 |
Given the following "courses" exist:
|
|
|
9 |
| fullname | shortname |
|
|
|
10 |
| Course 1 | C1 |
|
|
|
11 |
And the following "users" exist:
|
|
|
12 |
| username | firstname | lastname | email |
|
|
|
13 |
| learner1 | Learner | 1 | learner1@example.com |
|
|
|
14 |
| teacher1 | Teacher | 1 | teacher1@example.com |
|
|
|
15 |
| manager1 | Manager | 1 | manager1@example.com |
|
|
|
16 |
And the following "course enrolments" exist:
|
|
|
17 |
| user | course | role |
|
|
|
18 |
| learner1 | C1 | student |
|
|
|
19 |
| teacher1 | C1 | editingteacher |
|
|
|
20 |
| manager1 | C1 | manager |
|
|
|
21 |
And the following "groups" exist:
|
|
|
22 |
| name | course | idnumber |
|
|
|
23 |
| Group 1 | C1 | G1 |
|
|
|
24 |
And the following "group members" exist:
|
|
|
25 |
| user | group |
|
|
|
26 |
| learner1 | G1 |
|
|
|
27 |
| teacher1 | G1 |
|
|
|
28 |
| manager1 | G1 |
|
|
|
29 |
|
|
|
30 |
Scenario: Check the default roles are visible
|
|
|
31 |
Given I log in as "manager1"
|
|
|
32 |
And I am on the "Course 1" "groups" page
|
|
|
33 |
When I set the field "groups" to "Group 1 (3)"
|
|
|
34 |
And I press "Show members for group"
|
|
|
35 |
Then "optgroup[label='No roles']" "css_element" should not exist in the "#members" "css_element"
|
|
|
36 |
And "optgroup[label='Student']" "css_element" should exist in the "#members" "css_element"
|
|
|
37 |
And "optgroup[label='Teacher']" "css_element" should exist in the "#members" "css_element"
|
|
|
38 |
And "optgroup[label='Manager']" "css_element" should exist in the "#members" "css_element"
|
|
|
39 |
And I log out
|
|
|
40 |
|
|
|
41 |
Scenario: Do not allow managers to view any roles and check they are hidden
|
|
|
42 |
Given I log in as "teacher1"
|
|
|
43 |
And I am on the "Course 1" "groups" page
|
|
|
44 |
When I set the field "groups" to "Group 1 (3)"
|
|
|
45 |
And I press "Show members for group"
|
|
|
46 |
Then "optgroup[label='No roles']" "css_element" should exist in the "#members" "css_element"
|
|
|
47 |
And "optgroup[label='Student']" "css_element" should exist in the "#members" "css_element"
|
|
|
48 |
And "optgroup[label='Teacher']" "css_element" should exist in the "#members" "css_element"
|
|
|
49 |
And "optgroup[label='Manager']" "css_element" should not exist in the "#members" "css_element"
|
|
|
50 |
And I log out
|