MDL-43738 behat: Updating steps definitions and deprecating methods
[moodle.git] / group / tests / behat / create_groups.feature
CommitLineData
550d842e 1@core @core_group
e613fd90
DM
2Feature: Organize students into groups
3 In order to organize course activities in groups
5d7b6307 4 As a teacher
e613fd90
DM
5 I need to group students
6
7 @javascript
8 Scenario: Assign students to groups
9 Given the following "courses" exists:
10 | fullname | shortname | category | groupmode |
11 | Course 1 | C1 | 0 | 1 |
12 And the following "users" exists:
13 | username | firstname | lastname | email |
14 | teacher1 | Teacher | 1 | teacher1@asd.com |
15 | student0 | Student | 0 | student0@asd.com |
16 | student1 | Student | 1 | student1@asd.com |
17 | student2 | Student | 2 | student2@asd.com |
18 | student3 | Student | 3 | student3@asd.com |
19 And the following "course enrolments" exists:
20 | user | course | role |
21 | teacher1 | C1 | editingteacher |
22 | student0 | C1 | student |
23 | student1 | C1 | student |
24 | student2 | C1 | student |
25 | student3 | C1 | student |
26 And I log in as "teacher1"
27 And I follow "Course 1"
28 And I expand "Users" node
29 And I follow "Groups"
30 And I press "Create group"
31 And I fill the moodle form with:
32 | Group name | Group 1 |
33 And I press "Save changes"
34 And I press "Create group"
35 And I fill the moodle form with:
36 | Group name | Group 2 |
37 And I press "Save changes"
50edfdca
DM
38 When I add "Student 0 (student0@asd.com)" user to "Group 1" group members
39 And I add "Student 1 (student1@asd.com)" user to "Group 1" group members
40 And I add "Student 2 (student2@asd.com)" user to "Group 2" group members
41 And I add "Student 3 (student3@asd.com)" user to "Group 2" group members
e613fd90 42 Then I select "Group 1 (2)" from "groups"
e613fd90
DM
43 And the "members" select box should contain "Student 0"
44 And the "members" select box should contain "Student 1"
45 And the "members" select box should not contain "Student 2"
46 And I select "Group 2 (2)" from "groups"
e613fd90
DM
47 And the "members" select box should contain "Student 2"
48 And the "members" select box should contain "Student 3"
49 And the "members" select box should not contain "Student 0"
50 And I follow "Participants"
51 And I select "Group 1" from "Separate groups"
52 And I should see "Student 0"
53 And I should see "Student 1"
54 And I should not see "Student 2"
55 And I select "Group 2" from "Separate groups"
56 And I should see "Student 2"
57 And I should see "Student 3"
58 And I should not see "Student 0"
a2d3e3b6
MN
59
60 @javascript
61 Scenario: Create groups and groupings without the 'moodle/course:changeidnumber' capability
62 Given the following "courses" exists:
63 | fullname | shortname | category | groupmode |
64 | Course 1 | C1 | 0 | 1 |
65 And the following "users" exists:
66 | username | firstname | lastname | email |
67 | teacher1 | Teacher | 1 | teacher1@asd.com |
68 And the following "course enrolments" exists:
69 | user | course | role |
70 | teacher1 | C1 | editingteacher |
71 And I log in as "admin"
72 And I set the following system permissions of "Teacher" role:
73 | moodle/course:changeidnumber | Prevent |
74 And I log out
75 And I log in as "teacher1"
76 And I follow "Course 1"
77 And I expand "Users" node
78 And I follow "Groups"
79 When I press "Create group"
80 Then the "idnumber" "field" should be readonly
81 And I fill the moodle form with:
82 | Group name | The greatest group that never existed |
83 And I press "Save changes"
84 And I should see "The greatest group that never existed"
85 And I follow "Groupings"
86 And I press "Create grouping"
87 And the "idnumber" "field" should be readonly
88 And I fill the moodle form with:
89 | Grouping name | Not the greatest grouping, but it's ok! |
90 And I press "Save changes"
91 And I should see "Not the greatest grouping, but it's ok!"