1 @core @core_message @javascript
2 Feature: Create conversations for course's groups
3 In order to manage a course group in a course
5 I need to be able to ensure group conversations reflect the memberships of course groups
8 Given the following "courses" exist:
9 | fullname | shortname | category | groupmode |
10 | Course 1 | C1 | 0 | 1 |
11 And the following "users" exist:
12 | username | firstname | lastname | email |
13 | teacher1 | Teacher | 1 | teacher1@example.com |
14 | student0 | Student | 0 | student0@example.com |
15 | student1 | Student | 1 | student1@example.com |
16 | student2 | Student | 2 | student2@example.com |
17 | student3 | Student | 3 | student3@example.com |
18 | student4 | Student | 4 | student4@example.com |
19 And the following "course enrolments" exist:
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 | student4 | C1 | student |
27 And the following "groups" exist:
28 | name | course | idnumber | enablemessaging |
29 | Group 1 | C1 | G1 | 1 |
30 | Group 2 | C1 | G2 | 1 |
31 | Group 3 | C1 | G3 | 0 |
32 And the following "group members" exist:
42 And the following config values are set as admin:
44 | messagingminpoll | 1 |
46 Scenario: Group conversations are restricted to members
47 Given I log in as "teacher1"
49 And I open the "Group" conversations list
50 And "Group 1" "core_message > Message" should exist
51 And "Group 2" "core_message > Message" should exist
52 And "Group 3" "core_message > Message" should not exist
54 And I log in as "student1"
56 And I open the "Group" conversations list
57 And "Group 1" "core_message > Message" should exist
58 And "Group 2" "core_message > Message" should not exist
59 And "Group 3" "core_message > Message" should not exist
61 Scenario: View group conversation's participants numbers
62 Given I log in as "teacher1"
64 And I open the "Group" conversations list
65 And I select "Group 1" conversation in messaging
66 And I should see "5 participants" in the "Group 1" "core_message > Message header"
67 And I go back in "view-conversation" message drawer
68 And I select "Group 2" conversation in messaging
69 And I should see "1 participants" in the "Group 2" "core_message > Message header"
71 Scenario: View group conversation's participants list
72 Given I log in as "teacher1"
74 And I open the "Group" conversations list
75 # Check Group 1 participants list.
76 And I select "Group 1" conversation in messaging
77 And I open messaging information
78 And "Teacher 1" "core_message > Message member" should not exist
79 And "Student 0" "core_message > Message member" should exist
80 And "Student 1" "core_message > Message member" should exist
81 And "Student 2" "core_message > Message member" should exist
82 And "Student 3" "core_message > Message member" should exist
83 And "Student 4" "core_message > Message member" should not exist
84 And I go back in "group-info-content-container" message drawer
85 And I go back in "view-conversation" message drawer
86 # Check Group 2 participants list.
87 And I select "Group 2" conversation in messaging
88 And I open messaging information
89 And "Teacher 1" "core_message > Message member" should not exist
90 And "No participants" "core_message > Message member" should exist
91 And "Student 4" "core_message > Message member" should not exist
93 Scenario: Check group conversation members are synced when a new group member is added
94 Given I log in as "teacher1"
95 Then I am on "Course 1" course homepage
96 And I navigate to "Users > Groups" in current page administration
97 And I add "Student 4 (student4@example.com)" user to "Group 1" group members
98 And I add "Student 4 (student4@example.com)" user to "Group 2" group members
100 And I open the "Group" conversations list
101 And I select "Group 1" conversation in messaging
102 And I should see "6 participants" in the "Group 1" "core_message > Message header"
103 And I open messaging information
104 And "Student 4" "core_message > Message member" should exist
105 And I go back in "group-info-content-container" message drawer
106 And I go back in "view-conversation" message drawer
107 And I select "Group 2" conversation in messaging
108 And I should see "2 participants" in the "Group 2" "core_message > Message header"
109 And I open messaging information
110 And "No participants" "core_message > Message member" should not exist
111 And "Student 4" "core_message > Message member" should exist