2 Feature: Posting to all groups in a separate group discussion is restricted to users with access to all groups
3 In order to post to all groups in a forum with separate groups
5 I need to have the accessallgroups capability
8 Given the following "users" exist:
9 | username | firstname | lastname | email |
10 | teacher1 | Teacher | 1 | teacher1@example.com |
11 | noneditor1 | Non-editing teacher | 1 | noneditor1@example.com |
12 | noneditor2 | Non-editing teacher | 2 | noneditor2@example.com |
13 | student1 | Student | 1 | student1@example.com |
14 | student2 | Student | 2 | student2@example.com |
15 And the following "courses" exist:
16 | fullname | shortname | category |
18 And the following "course enrolments" exist:
19 | user | course | role |
20 | teacher1 | C1 | editingteacher |
21 | noneditor1 | C1 | teacher |
22 | noneditor2 | C1 | teacher |
23 | student1 | C1 | student |
24 | student2 | C1 | student |
25 And the following "groups" exist:
26 | name | course | idnumber |
30 And the following "group members" exist:
42 And the following "activities" exist:
43 | activity | name | intro | course | idnumber | groupmode |
44 | forum | Standard forum name | Standard forum description | C1 | sepgroups | 1 |
46 Scenario: Teacher with accessallgroups can view all groups
47 Given I log in as "teacher1"
48 And I follow "Course 1"
49 When I follow "Standard forum name"
50 Then the "Separate groups" select box should contain "All participants"
51 Then the "Separate groups" select box should contain "Group A"
52 Then the "Separate groups" select box should contain "Group B"
53 Then the "Separate groups" select box should contain "Group C"
55 Scenario: Teacher with accessallgroups can select any group when posting
56 Given I log in as "teacher1"
57 And I follow "Course 1"
58 And I follow "Standard forum name"
59 When I click on "Add a new discussion topic" "button"
60 Then the "Group" select box should contain "All participants"
61 And the "Group" select box should contain "Group A"
62 And the "Group" select box should contain "Group B"
63 And the "Group" select box should contain "Group C"
65 Scenario: Teacher with accessallgroups can post in groups they are a member of
66 Given I log in as "teacher1"
67 And I follow "Course 1"
68 And I follow "Standard forum name"
69 And I select "Group A" from the "Separate groups" singleselect
70 When I click on "Add a new discussion topic" "button"
71 And I set the following fields to these values:
72 | Subject | Teacher 1 -> Group B |
73 | Message | Teacher 1 -> Group B |
74 # Change the group in the post form.
76 And I press "Post to forum"
77 And I wait to be redirected
78 # We should be redirected to the group that we selected when posting.
79 Then the field "Separate groups" matches value "Group B"
80 And I should see "Group B" in the "Teacher 1 -> Group B" "table_row"
81 And I should not see "Group A" in the "Teacher 1 -> Group B" "table_row"
82 And I should not see "Group C" in the "Teacher 1 -> Group B" "table_row"
83 # It should also be displayed under All participants
84 And I select "All participants" from the "Separate groups" singleselect
85 And I should see "Group B" in the "Teacher 1 -> Group B" "table_row"
86 And I should not see "Group A" in the "Teacher 1 -> Group B" "table_row"
87 And I should not see "Group C" in the "Teacher 1 -> Group B" "table_row"
88 # It should not be displayed in Groups A, or C.
89 And I select "Group A" from the "Separate groups" singleselect
90 And I should not see "Teacher 1 -> Group B"
91 And I select "Group C" from the "Separate groups" singleselect
92 And I should not see "Teacher 1 -> Group B"
94 Scenario: Teacher with accessallgroups can post in groups they are not a member of
95 Given I log in as "teacher1"
96 And I follow "Course 1"
97 And I follow "Standard forum name"
98 And I select "Group A" from the "Separate groups" singleselect
99 When I click on "Add a new discussion topic" "button"
100 And I set the following fields to these values:
101 | Subject | Teacher 1 -> Group C |
102 | Message | Teacher 1 -> Group C |
104 And I press "Post to forum"
105 And I wait to be redirected
106 # We should be redirected to the group that we selected when posting.
107 Then the field "Separate groups" matches value "Group C"
108 # We redirect to the group posted in automatically.
109 And I should see "Group C" in the "Teacher 1 -> Group C" "table_row"
110 And I should not see "Group A" in the "Teacher 1 -> Group C" "table_row"
111 And I should not see "Group B" in the "Teacher 1 -> Group C" "table_row"
112 # It should also be displayed under All participants
113 And I select "All participants" from the "Separate groups" singleselect
114 And I should see "Group C" in the "Teacher 1 -> Group C" "table_row"
115 And I should not see "Group A" in the "Teacher 1 -> Group C" "table_row"
116 And I should not see "Group B" in the "Teacher 1 -> Group C" "table_row"
117 # It should not be displayed in Groups A, or B.
118 And I select "Group A" from the "Separate groups" singleselect
119 And I should not see "Teacher 1 -> Group C"
120 And I select "Group B" from the "Separate groups" singleselect
121 And I should not see "Teacher 1 -> Group C"
123 Scenario: Students in one group can only post in their group
124 Given I log in as "student1"
125 And I follow "Course 1"
126 When I follow "Standard forum name"
127 Then I should see "Group A"
128 And I click on "Add a new discussion topic" "button"
129 And I should see "Group A"
130 And I should not see "Group B"
131 And I should not see "Group C"
132 And I set the following fields to these values:
133 | Subject | Student -> B |
134 | Message | Student -> B |
135 And I press "Post to forum"
136 And I wait to be redirected
137 And I should see "Group A" in the "Student -> B" "table_row"
138 And I should not see "Group B" in the "Student -> B" "table_row"
140 Scenario: Students in multiple group can post in all of their group individually
141 Given I log in as "student2"
142 And I follow "Course 1"
143 When I follow "Standard forum name"
144 And I select "Group A" from the "Separate groups" singleselect
145 And I click on "Add a new discussion topic" "button"
146 And the "Group" select box should not contain "All participants"
147 And the "Group" select box should contain "Group A"
148 And the "Group" select box should contain "Group B"
149 And the "Group" select box should not contain "Group C"
150 And I set the following fields to these values:
151 | Subject | Student -> B |
152 | Message | Student -> B |
154 And I press "Post to forum"
155 And I wait to be redirected
156 # We should be redirected to the group that we selected when posting.
157 And the field "Separate groups" matches value "Group B"
158 And I should see "Group B" in the "Student -> B" "table_row"
159 And I should not see "Group A" in the "Student -> B" "table_row"
160 And I select "Group A" from the "Separate groups" singleselect
161 And I should not see "Student -> B"
162 # Now try posting in Group A (starting at Group B)
163 And I select "Group B" from the "Separate groups" singleselect
164 And I click on "Add a new discussion topic" "button"
165 And the "Group" select box should not contain "All participants"
166 And the "Group" select box should contain "Group A"
167 And the "Group" select box should contain "Group B"
168 And the "Group" select box should not contain "Group C"
169 And I set the following fields to these values:
170 | Subject | Student -> A |
171 | Message | Student -> A |
173 And I press "Post to forum"
174 And I wait to be redirected
175 # We should be redirected to the group that we selected when posting.
176 And the field "Separate groups" matches value "Group A"
177 And I should see "Group A" in the "Student -> A" "table_row"
178 And I should not see "Group B" in the "Student -> A" "table_row"
179 And I select "Group B" from the "Separate groups" singleselect
180 And I should not see "Student -> A"
182 Scenario: Teacher in all groups but without accessallgroups can only post in their groups
183 And I log in as "admin"
184 And I set the following system permissions of "Non-editing teacher" role:
185 | moodle/site:accessallgroups | Prohibit |
187 Given I log in as "noneditor1"
188 And I follow "Course 1"
189 And I follow "Standard forum name"
190 When I click on "Add a new discussion topic" "button"
191 Then the "Group" select box should not contain "All participants"
192 And the "Group" select box should contain "Group A"
193 And the "Group" select box should contain "Group B"
195 Scenario: Teacher in some groups and without accessallgroups can only post in their groups
196 And I log in as "admin"
197 And I set the following system permissions of "Non-editing teacher" role:
198 | moodle/site:accessallgroups | Prohibit |
200 Given I log in as "noneditor1"
201 And I follow "Course 1"
202 And I follow "Standard forum name"
203 When I click on "Add a new discussion topic" "button"
204 Then the "Group" select box should not contain "All participants"
205 And the "Group" select box should contain "Group A"
206 And the "Group" select box should contain "Group B"
208 Scenario: Students can view all participants discussions in separate groups mode
209 Given I log in as "teacher1"
210 And I follow "Course 1"
211 When I add a new discussion to "Standard forum name" forum with:
212 | Subject | Forum post to all participants |
213 | Message | This is the body |
214 | Group | All participants |
216 And I log in as "student1"
217 And I follow "Course 1"
218 And I follow "Standard forum name"
219 Then I should see "Forum post to all participants"