Merge branch 'MDL-62643-master' of git://github.com/damyon/moodle
[moodle.git] / user / tests / behat / edit_user_roles.feature
blob90ff654358caec4944e6c21cb545f2cd7fb16ff0
1 @core @core_user
2 Feature: Edit user roles
3   In order to administer users in course
4   As a teacher
5   I need to be able to assign and unassign roles in the course
7   Background:
8     Given the following "users" exist:
9       | username  | firstname | lastname | email                 |
10       | teacher1  | Teacher   | 1        | teacher1@example.com  |
11       | student1  | Student   | 1        | student1@example.com  |
12       | student2  | Student   | 2        | student2@example.com  |
13     And the following "courses" exist:
14       | fullname | shortname | format |
15       | Course 1 | C1        | topics |
16     And the following "course enrolments" exist:
17       | user      | course | role           |
18       | teacher1  | C1     | editingteacher |
19       | student1  | C1     | student        |
20       | student2  | C1     | student        |
22   @javascript
23   Scenario: Assign roles on participants page
24     Given I log in as "teacher1"
25     And I am on "Course 1" course homepage
26     And I navigate to course participants
27     And I click on "Student 1's role assignments" "link"
28     And I click on ".form-autocomplete-downarrow" "css_element" in the "student1" "table_row"
29     And I click on "Non-editing teacher" item in the autocomplete list
30     And I press key "27" in the field "Student 1's role assignments"
31     When I click on "Save changes" "link"
32     Then I should see "Student, Non-editing teacher" in the "Student 1" "table_row"
34   @javascript
35   Scenario: Remove roles on participants page
36     Given I log in as "teacher1"
37     And I am on "Course 1" course homepage
38     And I navigate to course participants
39     And I click on "Student 1's role assignments" "link"
40     And I click on ".form-autocomplete-selection [aria-selected=true]" "css_element"
41     And I press key "27" in the field "Student 1's role assignments"
42     When I click on "Save changes" "link"
43     Then I should see "No roles" in the "Student 1" "table_row"