Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@mod @mod_forum
2
Feature: Posting to all groups in a visible group discussion is restricted to users with access to all groups
3
  In order to post to all groups in a forum with visible groups
4
  As a teacher
5
  I need to have the accessallgroups capability
6
 
7
  Background:
8
    Given the following "users" exist:
9
      | username | firstname | lastname | email |
10
      | teacher1 | Teacher | 1 | teacher1@example.com |
11
      | student1 | Student | 1 | student1@example.com |
12
      | student2 | Student | 2 | student2@example.com |
13
      | student3 | Student | 3 | student3@example.com |
14
      | student4 | Student | 4 | student4@example.com |
15
    And the following "courses" exist:
16
      | fullname | shortname | category |
17
      | Course 1 | C1 | 0 |
18
    And the following "course enrolments" exist:
19
      | user | course | role |
20
      | teacher1 | C1 | editingteacher |
21
      | student1 | C1 | student |
22
      | student2 | C1 | student |
23
      | student3 | C1 | student |
24
      | student4 | C1 | student |
25
    And the following "groups" exist:
26
      | name    | course | idnumber | participation |
27
      | Group A | C1     | G1       | 1             |
28
      | Group B | C1     | G2       | 1             |
29
      | Group C | C1     | G3       | 1             |
30
      | Group D | C1     | G4       | 0             |
31
    And the following "group members" exist:
32
      | user | group |
33
      | teacher1 | G1 |
34
      | teacher1 | G2 |
35
      | student1 | G1 |
36
      | student2 | G1 |
37
      | student2 | G2 |
38
      | student3 | G4 |
39
    And the following "activities" exist:
40
      | activity   | name                   | course | idnumber     | groupmode |
41
      | forum      | Standard forum name    | C1     | groups       | 2         |
42
    And the following "mod_forum > discussions" exist:
43
      | forum  | name             | subject          | message          | group            |
44
      | groups | Initial Disc ALL | Initial Disc ALL | Disc ALL content | All participants |
45
      | groups | Initial Disc G1  | Initial Disc G1  | Disc G1 content  | G1               |
46
      | groups | Initial Disc G2  | Initial Disc G2  | Disc G2 content  | G2               |
47
      | groups | Initial Disc G3  | Initial Disc G3  | Disc G3 content  | G3               |
48
 
49
  Scenario: Teacher with accessallgroups can view all groups
50
    When I am on the "Standard forum name" "forum activity" page logged in as teacher1
51
    Then the "Visible groups" select box should contain "All participants"
52
    And the "Visible groups" select box should contain "Group A"
53
    And the "Visible groups" select box should contain "Group B"
54
    And the "Visible groups" select box should contain "Group C"
55
    And the "Visible groups" select box should not contain "Group D"
56
    And I select "All participants" from the "Visible groups" singleselect
57
    And I should see "Initial Disc ALL"
58
    And I should see "Initial Disc G1"
59
    And I should see "Initial Disc G2"
60
    And I should see "Initial Disc G2"
61
    And I select "Group A" from the "Visible groups" singleselect
62
    And I should see "Initial Disc ALL"
63
    And I should see "Initial Disc G1"
64
    But I should not see "Initial Disc G2"
65
    And I should not see "Initial Disc G3"
66
    And I select "Group B" from the "Visible groups" singleselect
67
    And I should see "Initial Disc ALL"
68
    And I should see "Initial Disc G2"
69
    But I should not see "Initial Disc G1"
70
    And I should not see "Initial Disc G3"
71
 
72
  Scenario: Teacher with accessallgroups can select any group when posting
73
    Given I am on the "Standard forum name" "forum activity" page logged in as teacher1
74
    When I click on "Add discussion topic" "link"
75
    And I click on "Advanced" "button"
76
    Then the "Group" select box should contain "All participants"
77
    And the "Group" select box should contain "Group A"
78
    And the "Group" select box should contain "Group B"
79
    And the "Group" select box should contain "Group C"
80
    And the "Group" select box should not contain "Group D"
81
    And I should see "Post a copy to all groups"
82
 
83
  Scenario: Teacher with accessallgroups can post in groups they are a member of
84
    Given I am on the "Standard forum name" "forum activity" page logged in as teacher1
85
    And I select "Group A" from the "Visible groups" singleselect
86
    When I click on "Add discussion topic" "link"
87
    And I click on "Advanced" "button"
88
    Then I should see "Post a copy to all groups"
89
    And I set the following fields to these values:
90
      | Subject | Teacher 1 -> Group B  |
91
      | Message | Teacher 1 -> Group B  |
92
      # Change the group in the post form.
93
      | Group   | Group B               |
94
    And I press "Post to forum"
95
    And I wait to be redirected
96
    # We should be redirected to the group that we selected when posting.
97
    And the field "Visible groups" matches value "Group B"
98
    And I should see "Group B" in the "Teacher 1 -> Group B" "table_row"
99
    And I should not see "Group A" in the "Teacher 1 -> Group B" "table_row"
100
    And I should not see "Group C" in the "Teacher 1 -> Group B" "table_row"
101
    # It should also be displayed under All participants
102
    And I select "All participants" from the "Visible groups" singleselect
103
    And I should see "Group B" in the "Teacher 1 -> Group B" "table_row"
104
    And I should not see "Group A" in the "Teacher 1 -> Group B" "table_row"
105
    And I should not see "Group C" in the "Teacher 1 -> Group B" "table_row"
106
    # It should not be displayed in Groups A, or C.
107
    And I select "Group A" from the "Visible groups" singleselect
108
    And I should not see "Teacher 1 -> Group B"
109
    And I select "Group C" from the "Visible groups" singleselect
110
    And I should not see "Teacher 1 -> Group B"
111
 
112
  Scenario: Teacher with accessallgroups can post in groups they are not a member of
113
    Given I am on the "Standard forum name" "forum activity" page logged in as teacher1
114
    And I select "Group A" from the "Visible groups" singleselect
115
    When I click on "Add discussion topic" "link"
116
    And I click on "Advanced" "button"
117
    Then I should see "Post a copy to all groups"
118
    And I set the following fields to these values:
119
      | Subject | Teacher 1 -> Group C  |
120
      | Message | Teacher 1 -> Group C  |
121
      | Group   | Group C               |
122
    And I press "Post to forum"
123
    And I wait to be redirected
124
    # We should be redirected to the group that we selected when posting.
125
    And the field "Visible groups" matches value "Group C"
126
    # We redirect to the group posted in automatically.
127
    And I should see "Group C" in the "Teacher 1 -> Group C" "table_row"
128
    And I should not see "Group A" in the "Teacher 1 -> Group C" "table_row"
129
    And I should not see "Group B" in the "Teacher 1 -> Group C" "table_row"
130
    # It should also be displayed under All participants
131
    And I select "All participants" from the "Visible groups" singleselect
132
    And I should see "Group C" in the "Teacher 1 -> Group C" "table_row"
133
    And I should not see "Group A" in the "Teacher 1 -> Group C" "table_row"
134
    And I should not see "Group B" in the "Teacher 1 -> Group C" "table_row"
135
    # It should not be displayed in Groups A, or B.
136
    And I select "Group A" from the "Visible groups" singleselect
137
    And I should not see "Teacher 1 -> Group C"
138
    And I select "Group B" from the "Visible groups" singleselect
139
    And I should not see "Teacher 1 -> Group C"
140
 
141
  Scenario: Teacher with accessallgroups can post to all groups
142
    Given I am on the "Standard forum name" "forum activity" page logged in as teacher1
143
    When I click on "Add discussion topic" "link"
144
    And I click on "Advanced" "button"
145
    And I set the following fields to these values:
146
      | Subject                   | Teacher 1 -> Post to all  |
147
      | Message                   | Teacher 1 -> Post to all  |
148
      | Post a copy to all groups | 1                       |
149
    And I press "Post to forum"
150
    And I wait to be redirected
151
    # Posting to all groups means that we should be redirected to the page we started from.
152
    And the field "Visible groups" matches value "All participants"
153
    And I select "Group A" from the "Visible groups" singleselect
154
    Then I should see "Group A" in the "Teacher 1 -> Post to all" "table_row"
155
    And I should not see "Group B" in the "Teacher 1 -> Post to all" "table_row"
156
    And I should not see "Group C" in the "Teacher 1 -> Post to all" "table_row"
157
    And I select "Group B" from the "Visible groups" singleselect
158
    And I should see "Group B" in the "Teacher 1 -> Post to all" "table_row"
159
    And I should not see "Group A" in the "Teacher 1 -> Post to all" "table_row"
160
    And I should not see "Group C" in the "Teacher 1 -> Post to all" "table_row"
161
    And I select "Group C" from the "Visible groups" singleselect
162
    And I should see "Group C" in the "Teacher 1 -> Post to all" "table_row"
163
    And I should not see "Group A" in the "Teacher 1 -> Post to all" "table_row"
164
    And I should not see "Group B" in the "Teacher 1 -> Post to all" "table_row"
165
    # No point testing the "All participants".
166
 
167
  Scenario: Students can view all groups
168
    When I am on the "Standard forum name" "forum activity" page logged in as student1
169
    Then the "Visible groups" select box should contain "All participants"
170
    And the "Visible groups" select box should contain "Group A"
171
    And the "Visible groups" select box should contain "Group B"
172
    And the "Visible groups" select box should contain "Group C"
173
    And the "Visible groups" select box should not contain "Group D"
174
    And I select "All participants" from the "Visible groups" singleselect
175
    And I should see "Initial Disc ALL"
176
    And I should see "Initial Disc G1"
177
    And I should see "Initial Disc G2"
178
    And I should see "Initial Disc G2"
179
    And I select "Group A" from the "Visible groups" singleselect
180
    And I should see "Initial Disc ALL"
181
    And I should see "Initial Disc G1"
182
    But I should not see "Initial Disc G2"
183
    And I should not see "Initial Disc G3"
184
    And I select "Group B" from the "Visible groups" singleselect
185
    And I should see "Initial Disc ALL"
186
    And I should see "Initial Disc G2"
187
    But I should not see "Initial Disc G1"
188
    And I should not see "Initial Disc G3"
189
 
190
  Scenario: Students in one group can only post in their group
191
    When I am on the "Standard forum name" "forum activity" page logged in as student1
192
    Then I should see "Group A"
193
    And I click on "Add discussion topic" "link"
194
    And I click on "Advanced" "button"
195
    And I should see "Group A"
196
    And I should not see "Group B"
197
    And I should not see "Group C"
198
    And I should not see "Group D"
199
    And I should not see "Post a copy to all groups"
200
    And I set the following fields to these values:
201
      | Subject | Student -> B |
202
      | Message | Student -> B |
203
    And I press "Post to forum"
204
    And I wait to be redirected
205
    And I should see "Group A" in the "Student -> B" "table_row"
206
    And I should not see "Group B" in the "Student -> B" "table_row"
207
 
208
  Scenario: Students in multiple group can post in all of their group individually
209
    When I am on the "Standard forum name" "forum activity" page logged in as student2
210
    And I select "Group A" from the "Visible groups" singleselect
211
    And I click on "Add discussion topic" "link"
212
    And I click on "Advanced" "button"
213
    And the "Group" select box should not contain "All participants"
214
    And the "Group" select box should contain "Group A"
215
    And the "Group" select box should contain "Group B"
216
    And the "Group" select box should not contain "Group C"
217
    And the "Group" select box should not contain "Group D"
218
    And I should not see "Post a copy to all groups"
219
    And I set the following fields to these values:
220
      | Subject | Student -> B  |
221
      | Message | Student -> B  |
222
      | Group   | Group B       |
223
    And I press "Post to forum"
224
    And I wait to be redirected
225
    # We should be redirected to the group that we selected when posting.
226
    And the field "Visible groups" matches value "Group B"
227
    And I should see "Group B" in the "Student -> B" "table_row"
228
    And I should not see "Group A" in the "Student -> B" "table_row"
229
    And I select "Group A" from the "Visible groups" singleselect
230
    And I should not see "Student -> B"
231
    # Now try posting in Group A (starting at Group B)
232
    And I select "Group B" from the "Visible groups" singleselect
233
    And I click on "Add discussion topic" "link"
234
    And I click on "Advanced" "button"
235
    And the "Group" select box should not contain "All participants"
236
    And the "Group" select box should contain "Group A"
237
    And the "Group" select box should contain "Group B"
238
    And the "Group" select box should not contain "Group C"
239
    And I should not see "Post a copy to all groups"
240
    And I set the following fields to these values:
241
      | Subject | Student -> A  |
242
      | Message | Student -> A  |
243
      | Group   | Group A       |
244
    And I press "Post to forum"
245
    And I wait to be redirected
246
    # We should be redirected to the group that we selected when posting.
247
    And the field "Visible groups" matches value "Group A"
248
    And I should see "Group A" in the "Student -> A" "table_row"
249
    And I should not see "Group B" in the "Student -> A" "table_row"
250
    And I select "Group B" from the "Visible groups" singleselect
251
    And I should not see "Student -> A"
252
 
253
  Scenario: Students in no group can see all discussions, but not post.
254
    Given I log in as "student4"
255
    And I am on "Course 1" course homepage
256
    When I follow "Standard forum name"
257
    And I select "All participants" from the "Visible groups" singleselect
258
    Then I should see "Initial Disc ALL"
259
    And I should see "Initial Disc G1"
260
    And I should see "Initial Disc G2"
261
    And I should see "Initial Disc G2"
262
    And I should see "You are not able to create a discussion"
263
    And I should not see "Add discussion topic"
264
 
265
  Scenario: Students in non-participation groups can see all discussions, but not post.
266
    Given I log in as "student3"
267
    And I am on "Course 1" course homepage
268
    When I follow "Standard forum name"
269
    And I select "All participants" from the "Visible groups" singleselect
270
    Then I should see "Initial Disc ALL"
271
    And I should see "Initial Disc G1"
272
    And I should see "Initial Disc G2"
273
    And I should see "Initial Disc G2"
274
    And I should see "You are not able to create a discussion"
275
    And I should not see "Add discussion topic"