MDL-64506 phpunit: Update unit tests to use classic
[moodle.git] / cohort / tests / behat / add_cohort.feature
CommitLineData
550d842e 1@core @core_cohort
e800f0d6
DM
2Feature: Add cohorts of users
3 In order to create site-wide groups
5d7b6307 4 As an admin
e800f0d6
DM
5 I need to create cohorts and add users on them
6
7 Background:
759b323e 8 Given the following "users" exist:
e800f0d6 9 | username | firstname | lastname | email |
0fe86bbd
RT
10 | user1 | First | User | first@example.com |
11 | user2 | Second | User | second@example.com |
12 | user3 | Third | User | third@example.com |
13 | user4 | Forth | User | forth@example.com |
e800f0d6 14 And I log in as "admin"
02fda279 15 And I navigate to "Users > Accounts >Cohorts" in site administration
274dc068 16 And I follow "Add new cohort"
f083d614 17 And I set the following fields to these values:
e800f0d6
DM
18 | Name | Test cohort name |
19 | Context | System |
20 | Cohort ID | 333 |
21 | Description | Test cohort description |
22 And I press "Save changes"
23
e800f0d6
DM
24 Scenario: Add a cohort
25 When I follow "Cohorts"
26 Then I should see "Test cohort name"
27 And I should see "333"
28 And I should see "Test cohort description"
29 And I should see "Created manually"
30
e800f0d6 31 Scenario: Add users to a cohort selecting them from the system users list
0fe86bbd
RT
32 When I add "First User (first@example.com)" user to "333" cohort members
33 And I add "Second User (second@example.com)" user to "333" cohort members
e800f0d6 34 Then I should see "2" in the "#cohorts" "css_element"
ba5c5083 35 And I click on "Assign" "link" in the "Test cohort name" "table_row"
0fe86bbd
RT
36 And the "Current users" select box should contain "First User (first@example.com)"
37 And the "Current users" select box should contain "Second User (second@example.com)"
38 And the "Current users" select box should not contain "Forth User (forth@example.com)"
e800f0d6 39
9b1dbe16 40 Scenario: Add users to a cohort using a bulk user action
e5287f9b
MG
41 When I follow "Accounts"
42 And I follow "Bulk user actions"
f083d614 43 And I set the field "Available" to "Third User"
e800f0d6 44 And I press "Add to selection"
f083d614 45 And I set the field "Available" to "Forth User"
e800f0d6 46 And I press "Add to selection"
f083d614 47 And I set the field "id_action" to "Add to cohort"
e800f0d6 48 And I press "Go"
f083d614 49 And I set the field "Cohort" to "Test cohort name [333]"
e800f0d6 50 And I press "Add to cohort"
e5287f9b 51 And I follow "Accounts"
e800f0d6
DM
52 And I follow "Cohorts"
53 Then I should see "2" in the "#cohorts" "css_element"
ba5c5083 54 And I click on "Assign" "link" in the "Test cohort name" "table_row"
0fe86bbd
RT
55 And the "Current users" select box should contain "Third User (third@example.com)"
56 And the "Current users" select box should contain "Forth User (forth@example.com)"
57 And the "Current users" select box should not contain "First User (first@example.com)"
48983fb9
MG
58
59 @javascript
60 Scenario: Edit cohort name in-place
61 When I follow "Cohorts"
62 And I click on "Edit cohort name" "link" in the "Test cohort name" "table_row"
63 And I set the field "New name for cohort Test cohort name" to "Students cohort"
64 And I press key "13" in the field "New name for cohort Test cohort name"
65 Then I should not see "Test cohort name"
66 And I should see "Students cohort"
67 And I follow "Cohorts"
68 And I should see "Students cohort"