1 |
efrain |
1 |
@enrol @enrol_cohort
|
|
|
2 |
Feature: Cohort enrolment management
|
|
|
3 |
|
|
|
4 |
Background:
|
|
|
5 |
Given the following "users" exist:
|
|
|
6 |
| username | firstname | lastname | email |
|
|
|
7 |
| teacher001 | Teacher | 001 | teacher001@example.com |
|
|
|
8 |
And the following "cohorts" exist:
|
|
|
9 |
| name | idnumber | visible |
|
|
|
10 |
| Alpha1 | A1 | 1 |
|
|
|
11 |
| Beta2 | B1 | 1 |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| fullname | shortname | format | startdate |
|
|
|
14 |
| Course 001 | C001 | weeks | ##1 month ago## |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role | timestart |
|
|
|
17 |
| teacher001 | C001 | editingteacher | ##1 month ago## |
|
|
|
18 |
|
|
|
19 |
@javascript
|
|
|
20 |
Scenario: Add multiple cohorts to the course
|
|
|
21 |
When I log in as "teacher001"
|
|
|
22 |
And I am on the "Course 001" "enrolment methods" page
|
|
|
23 |
And I select "Cohort sync" from the "Add method" singleselect
|
|
|
24 |
And I open the autocomplete suggestions list
|
|
|
25 |
And I click on "Alpha1" item in the autocomplete list
|
|
|
26 |
And "Alpha1" "autocomplete_selection" should exist
|
|
|
27 |
And I click on "Beta2" item in the autocomplete list
|
|
|
28 |
And "Alpha1" "autocomplete_selection" should exist
|
|
|
29 |
And "Beta2" "autocomplete_selection" should exist
|
|
|
30 |
And I press "Add method"
|
|
|
31 |
Then I should see "Cohort sync (Beta2 - Student)"
|
|
|
32 |
And I should see "Cohort sync (Alpha1 - Student)"
|
|
|
33 |
|
|
|
34 |
@javascript
|
|
|
35 |
Scenario: Edit cohort enrolment
|
|
|
36 |
When I log in as "teacher001"
|
|
|
37 |
And I add "Cohort sync" enrolment method in "Course 001" with:
|
|
|
38 |
| Cohort | Alpha1 |
|
|
|
39 |
And I should see "Cohort sync (Alpha1 - Student)"
|
|
|
40 |
And I click on "Edit" "link" in the "Alpha1" "table_row"
|
|
|
41 |
And I set the field "Assign role" to "Non-editing teacher"
|
|
|
42 |
And I click on "Save" "button"
|
|
|
43 |
And I should see "Cohort sync (Alpha1 - Non-editing teacher)"
|
|
|
44 |
|
|
|
45 |
@javascript
|
|
|
46 |
Scenario: Course cohort enrolment sync cohorts members
|
|
|
47 |
Given the following "users" exist:
|
|
|
48 |
| username | firstname | lastname | email |
|
|
|
49 |
| s1 | Sandra | Cole | s1@example.com |
|
|
|
50 |
| s2 | John | Smith | s2@example.com |
|
|
|
51 |
| s4 | Jane | Doe | s4@example.com |
|
|
|
52 |
And the following "cohort members" exist:
|
|
|
53 |
| user | cohort |
|
|
|
54 |
| s1 | A1 |
|
|
|
55 |
| s2 | A1 |
|
|
|
56 |
When I log in as "teacher001"
|
|
|
57 |
And I add "Cohort sync" enrolment method in "Course 001" with:
|
|
|
58 |
| Cohort | A1 |
|
|
|
59 |
| customint2 | -1 |
|
|
|
60 |
Then I should see "Cohort sync (Alpha1 - Student)"
|
|
|
61 |
And I set the field "Participants tertiary navigation" to "Groups"
|
|
|
62 |
# Confirm that group was created and corresponding group members are present
|
|
|
63 |
And I set the field "groups[]" to "Alpha1 cohort (2)"
|
|
|
64 |
And the "members" select box should contain "Sandra Cole (s1@example.com)"
|
|
|
65 |
And the "members" select box should contain "John Smith (s2@example.com)"
|
|
|
66 |
And I log in as "admin"
|
|
|
67 |
And I navigate to "Users > Accounts > Cohorts" in site administration
|
|
|
68 |
And I press "Assign" action in the "Alpha1" report row
|
|
|
69 |
And I should see "Cohort 'Alpha1' members"
|
|
|
70 |
And I should see "Removing users from a cohort may result in unenrolling of users from multiple courses which includes deleting of user settings, grades, group membership and other user information from affected courses."
|
|
|
71 |
# Remove user s4 from cohort
|
|
|
72 |
And I set the field "removeselect[]" to "John Smith (s2@example.com)"
|
|
|
73 |
And I click on "Remove" "button"
|
|
|
74 |
# Add user s4 to the cohort.
|
|
|
75 |
And I set the field "addselect_searchtext" to "s4"
|
|
|
76 |
And I set the field "addselect[]" to "Jane Doe (s4@example.com)"
|
|
|
77 |
And I click on "Add" "button"
|
|
|
78 |
And the "removeselect[]" select box should contain "Sandra Cole (s1@example.com)"
|
|
|
79 |
And the "removeselect[]" select box should contain "Jane Doe (s4@example.com)"
|
|
|
80 |
And the "removeselect[]" select box should not contain "John Smith (s2@example.com)"
|
|
|
81 |
And I trigger cron
|
|
|
82 |
And I am on "Course 001" course homepage
|
|
|
83 |
And I navigate to course participants
|
|
|
84 |
# Verifies students 1 and 4 are in the cohort and student 2 is not any more.
|
|
|
85 |
And the following should exist in the "participants" table:
|
11 |
efrain |
86 |
| First name | Email address | Roles | Groups |
|
1 |
efrain |
87 |
| Sandra Cole | s1@example.com | Student | Alpha1 cohort |
|
|
|
88 |
| Jane Doe | s4@example.com | Student | Alpha1 cohort |
|
|
|
89 |
And the following should not exist in the "participants" table:
|
11 |
efrain |
90 |
| First name | Email address | Roles | Groups |
|
1 |
efrain |
91 |
| John Smith | s2@example.com | Student | Alpha1 cohort |
|
|
|
92 |
|
|
|
93 |
@javascript
|
|
|
94 |
Scenario: Course cohort enrolment creates a new group
|
|
|
95 |
Given the following "users" exist:
|
|
|
96 |
| username | firstname | lastname | email |
|
|
|
97 |
| s3 | Bianca | McAfee | s3@example.com |
|
|
|
98 |
| s5 | Abigail | Wyatt | s5@example.com |
|
|
|
99 |
And the following "cohort members" exist:
|
|
|
100 |
| user | cohort |
|
|
|
101 |
| s3 | B1 |
|
|
|
102 |
| s5 | B1 |
|
|
|
103 |
When I log in as "teacher001"
|
|
|
104 |
And I add "Cohort sync" enrolment method in "Course 001" with:
|
|
|
105 |
| Cohort | B1 |
|
|
|
106 |
And I click on "Edit" "link" in the "Beta2" "table_row"
|
|
|
107 |
And I set the field "Add to group" to "Create new group"
|
|
|
108 |
And I click on "Save changes" "button"
|
|
|
109 |
And I set the field "Participants tertiary navigation" to "Groups"
|
|
|
110 |
And I set the field "groups[]" to "Beta2 cohort (2)"
|
|
|
111 |
Then the "members" select box should contain "Bianca McAfee (s3@example.com)"
|
|
|
112 |
And the "members" select box should contain "Abigail Wyatt (s5@example.com)"
|