1 |
efrain |
1 |
@core @core_cohort @enrol_cohort
|
|
|
2 |
Feature: Access visible and hidden cohorts
|
|
|
3 |
In order to enrol users from cohorts
|
|
|
4 |
As an manager or teacher
|
|
|
5 |
I need to be able to view the list of cohorts defined above the course
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "categories" exist:
|
|
|
9 |
| name | category | idnumber |
|
|
|
10 |
| Cat 1 | 0 | CAT1 |
|
|
|
11 |
| Cat 2 | 0 | CAT2 |
|
|
|
12 |
And the following "cohorts" exist:
|
|
|
13 |
| name | idnumber | visible |
|
|
|
14 |
| System cohort | CV0 | 1 |
|
|
|
15 |
| System hidden cohort | CH0 | 0 |
|
|
|
16 |
| System empty cohort | CVE0 | 1 |
|
|
|
17 |
And the following "cohorts" exist:
|
|
|
18 |
| name | idnumber | contextlevel | reference | visible |
|
|
|
19 |
| Cohort in category 1 | CV1 | Category | CAT1 | 1 |
|
|
|
20 |
| Cohort in category 2 | CV2 | Category | CAT2 | 1 |
|
|
|
21 |
| Cohort hidden in category 1 | CH1 | Category | CAT1 | 0 |
|
|
|
22 |
| Cohort empty in category 1 | CVE1 | Category | CAT1 | 1 |
|
|
|
23 |
Given the following "users" exist:
|
|
|
24 |
| username | firstname | lastname | email |
|
|
|
25 |
| user1 | First | User | first@example.com |
|
|
|
26 |
| user2 | Second | User | second@example.com |
|
|
|
27 |
| student | Sam | User | student@example.com |
|
|
|
28 |
| teacher | Terry | User | teacher@example.com |
|
|
|
29 |
And the following "cohort members" exist:
|
|
|
30 |
| user | cohort |
|
|
|
31 |
| student | CV0 |
|
|
|
32 |
| student | CV1 |
|
|
|
33 |
| student | CV2 |
|
|
|
34 |
| student | CH0 |
|
|
|
35 |
| student | CH1 |
|
|
|
36 |
And the following "role assigns" exist:
|
|
|
37 |
| user | role | contextlevel | reference |
|
|
|
38 |
| user1 | manager | System | |
|
|
|
39 |
| user2 | manager | Category | CAT1 |
|
|
|
40 |
And the following "courses" exist:
|
|
|
41 |
| fullname | shortname | category |
|
|
|
42 |
| Course 1 | C1 | CAT1 |
|
|
|
43 |
And the following "course enrolments" exist:
|
|
|
44 |
| user | course | role |
|
|
|
45 |
| teacher | C1 | editingteacher |
|
|
|
46 |
|
|
|
47 |
@javascript @skip_chrome_zerosize
|
|
|
48 |
Scenario: Teacher can see visible cohorts defined in the above contexts
|
|
|
49 |
When I log in as "teacher"
|
|
|
50 |
And I am on the "Course 1" "enrolment methods" page
|
|
|
51 |
And I select "Cohort sync" from the "Add method" singleselect
|
|
|
52 |
And I open the autocomplete suggestions list
|
|
|
53 |
Then "Cohort in category 1" "autocomplete_suggestions" should exist
|
|
|
54 |
And "System cohort" "autocomplete_suggestions" should exist
|
|
|
55 |
And "Cohort hidden in category 1" "autocomplete_suggestions" should not exist
|
|
|
56 |
And "System hidden cohort" "autocomplete_suggestions" should not exist
|
|
|
57 |
And "Cohort in category 2" "autocomplete_suggestions" should not exist
|
|
|
58 |
And "Cohort empty in category 1" "autocomplete_suggestions" should exist
|
|
|
59 |
And "System empty cohort" "autocomplete_suggestions" should exist
|
|
|
60 |
And I set the field "Cohort" to "System cohort"
|
|
|
61 |
And I press "Add method"
|
|
|
62 |
And I am on the "Course 1" "enrolled users" page
|
|
|
63 |
And I should see "student@example.com"
|
|
|
64 |
And I am on the "Course 1" "groups" page
|
|
|
65 |
And I press "Auto-create groups"
|
|
|
66 |
And the "Select members from cohort" select box should contain "Cohort in category 1"
|
|
|
67 |
And the "Select members from cohort" select box should contain "System cohort"
|
|
|
68 |
And the "Select members from cohort" select box should not contain "Cohort hidden in category 1"
|
|
|
69 |
And the "Select members from cohort" select box should not contain "System hidden cohort"
|
|
|
70 |
And the "Select members from cohort" select box should not contain "Cohort in category 2"
|
|
|
71 |
And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
|
|
|
72 |
And the "Select members from cohort" select box should not contain "System empty cohort"
|
|
|
73 |
|
|
|
74 |
@javascript @skip_chrome_zerosize
|
|
|
75 |
Scenario: System manager can see all cohorts defined in the above contexts
|
|
|
76 |
When I log in as "user1"
|
|
|
77 |
And I am on the "Course 1" "enrolment methods" page
|
|
|
78 |
And I select "Cohort sync" from the "Add method" singleselect
|
|
|
79 |
And I open the autocomplete suggestions list
|
|
|
80 |
Then "Cohort in category 1" "autocomplete_suggestions" should exist
|
|
|
81 |
And "System cohort" "autocomplete_suggestions" should exist
|
|
|
82 |
And "Cohort hidden in category 1" "autocomplete_suggestions" should exist
|
|
|
83 |
And "System hidden cohort" "autocomplete_suggestions" should exist
|
|
|
84 |
And "Cohort in category 2" "autocomplete_suggestions" should not exist
|
|
|
85 |
And "Cohort empty in category 1" "autocomplete_suggestions" should exist
|
|
|
86 |
And "System empty cohort" "autocomplete_suggestions" should exist
|
|
|
87 |
And I set the field "Cohort" to "System cohort"
|
|
|
88 |
And I press "Add method"
|
|
|
89 |
And I am on the "Course 1" "enrolled users" page
|
|
|
90 |
And I should see "student@example.com"
|
|
|
91 |
And I am on the "Course 1" "groups" page
|
|
|
92 |
And I press "Auto-create groups"
|
|
|
93 |
And the "Select members from cohort" select box should contain "Cohort in category 1"
|
|
|
94 |
And the "Select members from cohort" select box should contain "System cohort"
|
|
|
95 |
And the "Select members from cohort" select box should contain "Cohort hidden in category 1"
|
|
|
96 |
And the "Select members from cohort" select box should contain "System hidden cohort"
|
|
|
97 |
And the "Select members from cohort" select box should not contain "Cohort in category 2"
|
|
|
98 |
And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
|
|
|
99 |
And the "Select members from cohort" select box should not contain "System empty cohort"
|
|
|
100 |
|
|
|
101 |
@javascript @skip_chrome_zerosize
|
|
|
102 |
Scenario: Category manager can see all cohorts defined in his category and visible cohorts defined above
|
|
|
103 |
When I log in as "user2"
|
|
|
104 |
And I am on the "Course 1" "enrolment methods" page
|
|
|
105 |
And I select "Cohort sync" from the "Add method" singleselect
|
|
|
106 |
And I open the autocomplete suggestions list
|
|
|
107 |
Then "Cohort in category 1" "autocomplete_suggestions" should exist
|
|
|
108 |
And "System cohort" "autocomplete_suggestions" should exist
|
|
|
109 |
And "Cohort hidden in category 1" "autocomplete_suggestions" should exist
|
|
|
110 |
And "System hidden cohort" "autocomplete_suggestions" should not exist
|
|
|
111 |
And "Cohort in category 2" "autocomplete_suggestions" should not exist
|
|
|
112 |
And "Cohort empty in category 1" "autocomplete_suggestions" should exist
|
|
|
113 |
And "System empty cohort" "autocomplete_suggestions" should exist
|
|
|
114 |
And I set the field "Cohort" to "System cohort"
|
|
|
115 |
And I press "Add method"
|
|
|
116 |
And I am on the "Course 1" "enrolled users" page
|
|
|
117 |
And I should see "student@example.com"
|
|
|
118 |
And I am on the "Course 1" "groups" page
|
|
|
119 |
And I press "Auto-create groups"
|
|
|
120 |
And the "Select members from cohort" select box should contain "Cohort in category 1"
|
|
|
121 |
And the "Select members from cohort" select box should contain "System cohort"
|
|
|
122 |
And the "Select members from cohort" select box should contain "Cohort hidden in category 1"
|
|
|
123 |
And the "Select members from cohort" select box should not contain "System hidden cohort"
|
|
|
124 |
And the "Select members from cohort" select box should not contain "Cohort in category 2"
|
|
|
125 |
And the "Select members from cohort" select box should not contain "Cohort empty in category 1"
|
|
|
126 |
And the "Select members from cohort" select box should not contain "System empty cohort"
|