1 |
efrain |
1 |
@core @core_admin
|
|
|
2 |
Feature: Staff can assign user roles
|
|
|
3 |
In order to assign users to roles at site or activity module level
|
|
|
4 |
As an admin
|
|
|
5 |
I can add and remove users from the roles
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "custom profile fields" exist:
|
|
|
9 |
| datatype | shortname | name |
|
|
|
10 |
| text | frog | Favourite frog |
|
|
|
11 |
And the following config values are set as admin:
|
|
|
12 |
| showuseridentity | email,profile_field_frog |
|
|
|
13 |
And the following "users" exist:
|
|
|
14 |
| username | firstname | lastname | email | profile_field_frog |
|
|
|
15 |
| user1 | User | One | one@example.com | Kermit |
|
|
|
16 |
| user2 | User | Two | two@example.com | Tree |
|
|
|
17 |
And the following "courses" exist:
|
|
|
18 |
| shortname | fullname |
|
|
|
19 |
| C1 | Course 1 |
|
|
|
20 |
And the following "course enrolments" exist:
|
|
|
21 |
| user | course | role |
|
|
|
22 |
| user1 | C1 | student |
|
|
|
23 |
| user2 | C1 | student |
|
|
|
24 |
And the following "activities" exist:
|
|
|
25 |
| activity | name | course | idnumber |
|
|
|
26 |
| page | TestPage | C1 | page1 |
|
|
|
27 |
|
|
|
28 |
@javascript
|
|
|
29 |
Scenario: Enrol at system level using custom field search
|
|
|
30 |
When I am on the "C1" "Course" page logged in as "admin"
|
|
|
31 |
And I navigate to "Users > Permissions > Assign system roles" in site administration
|
|
|
32 |
And I follow "Manager"
|
|
|
33 |
And I set the field "addselect_searchtext" to "Kermit"
|
|
|
34 |
# The Behat 'I should see' step doesn't work for optgroup labels.
|
|
|
35 |
Then "optgroup[label*='Potential users matching'][label*=' (1)']" "css_element" should exist
|
|
|
36 |
And I set the field "addselect" to "User One (one@example.com, Kermit)"
|
|
|
37 |
And I press "Add"
|
|
|
38 |
And I should see "User One" in the "#removeselect" "css_element"
|
|
|
39 |
|
|
|
40 |
@javascript
|
|
|
41 |
Scenario: Unenrol at system level using custom field search
|
|
|
42 |
Given the following "role assigns" exist:
|
|
|
43 |
| user | role | contextlevel | reference |
|
|
|
44 |
| user1 | manager | System | |
|
|
|
45 |
When I am on the "C1" "Course" page logged in as "admin"
|
|
|
46 |
And I navigate to "Users > Permissions > Assign system roles" in site administration
|
|
|
47 |
And I follow "Manager"
|
|
|
48 |
And I set the field "removeselect_searchtext" to "Kermit"
|
|
|
49 |
# The Behat 'I should see' step doesn't work for optgroup labels.
|
|
|
50 |
Then "optgroup[label*='Existing users matching'][label*=' (1)']" "css_element" should exist
|
|
|
51 |
And I set the field "removeselect" to "User One (one@example.com, Kermit)"
|
|
|
52 |
And I press "Remove"
|
|
|
53 |
And I should not see "User One" in the "#removeselect" "css_element"
|
|
|
54 |
|
|
|
55 |
@javascript
|
|
|
56 |
Scenario: Enrol at activity level using custom field search
|
|
|
57 |
When I am on the "page1" "Activity" page logged in as "admin"
|
|
|
58 |
And I navigate to "Permissions" in current page administration
|
|
|
59 |
And I set the field "Participants tertiary navigation" to "Locally assigned roles"
|
|
|
60 |
And I follow "Teacher"
|
|
|
61 |
And I set the field "addselect_searchtext" to "Kermit"
|
|
|
62 |
# The Behat 'I should see' step doesn't work for optgroup labels.
|
|
|
63 |
Then "optgroup[label*='Potential users matching'][label*=' (1)']" "css_element" should exist
|
|
|
64 |
And I set the field "addselect" to "User One (one@example.com, Kermit)"
|
|
|
65 |
And I press "Add"
|
|
|
66 |
And I should see "User One" in the "#removeselect" "css_element"
|
|
|
67 |
|
|
|
68 |
@javascript
|
|
|
69 |
Scenario: Unenrol at activity level using custom field search
|
|
|
70 |
Given the following "role assigns" exist:
|
|
|
71 |
| user | role | contextlevel | reference |
|
|
|
72 |
| user1 | editingteacher | Activity module | page1 |
|
|
|
73 |
When I am on the "page1" "Activity" page logged in as "admin"
|
|
|
74 |
And I navigate to "Permissions" in current page administration
|
|
|
75 |
And I set the field "Participants tertiary navigation" to "Locally assigned roles"
|
|
|
76 |
And I follow "Teacher"
|
|
|
77 |
And I set the field "removeselect_searchtext" to "Kermit"
|
|
|
78 |
# The Behat 'I should see' step doesn't work for optgroup labels.
|
|
|
79 |
Then "optgroup[label*='Users in this Activity module matching'][label*=' (1)']" "css_element" should exist
|
|
|
80 |
And I set the field "removeselect" to "User One (one@example.com, Kermit)"
|
|
|
81 |
And I press "Remove"
|
|
|
82 |
And I should not see "User One" in the "#removeselect" "css_element"
|