1 @core @core_message @javascript
2 Feature: Message send messages
3 In order to communicate with fellow users
5 I need to be able to send a message
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 | student1 | Student | 1 | student1@example.com |
14 | student2 | Student | 2 | student2@example.com |
15 And the following "course enrolments" exist:
16 | user | course | role |
17 | student1 | C1 | student |
18 | student2 | C1 | student |
19 And the following "groups" exist:
20 | name | course | idnumber | enablemessaging |
21 | Group 1 | C1 | G1 | 1 |
22 And the following "group members" exist:
26 And the following config values are set as admin:
28 | messagingminpoll | 1 |
30 Scenario: Send a message to a group conversation
31 Given I log in as "student1"
33 And I open the "Group" conversations list
34 And "Group 1" "core_message > Message" should exist
35 And I select "Group 1" conversation in messaging
36 When I send "Hi!" message in the message area
37 Then I should see "Hi!" in the "Group 1" "core_message > Message conversation"
38 And I should see "##today##%d %B##" in the "Group 1" "core_message > Message conversation"
40 And I log in as "student2"
42 And "Group 1" "core_message > Message" should exist
43 And I select "Group 1" conversation in messaging
44 And I should see "Hi!" in the "Group 1" "core_message > Message conversation"
46 Scenario: Send a message to a starred conversation
47 Given I log in as "student1"
49 And I open the "Group" conversations list
50 Then "Group 1" "core_message > Message" should exist
51 And I select "Group 1" conversation in the "group-messages" conversations list
52 And I open contact menu
53 And I click on "Star conversation" "link" in the "conversation-actions-menu" "region"
54 And I go back in "view-conversation" message drawer
55 And I open the "Starred" conversations list
56 And I should see "Group 1"
57 And I select "Group 1" conversation in the "favourites" conversations list
58 And I send "Hi!" message in the message area
59 And I should see "Hi!" in the "Group 1" "core_message > Message conversation"
60 And I should see "##today##%d %B##" in the "Group 1" "core_message > Message conversation"
61 And I go back in "view-conversation" message drawer
62 And I open the "Group" conversations list
63 And I should not see "Group 1" in the "Group" "core_message > Message tab"
65 Scenario: Send a message to a private conversation via contact tab
66 Given the following "message contacts" exist:
68 | student1 | student2 |
69 And I log in as "student1"
71 And I click on "Contacts" "link"
72 And I click on "Student 2" "link" in the "//*[@data-section='contacts']" "xpath_element"
73 When I send "Hi!" message in the message area
74 Then I should see "Hi!" in the "Student 2" "core_message > Message conversation"
75 And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
77 Scenario: Try to send a message to a private conversation is not contact but you are allowed to send a message
78 Given I log in as "student1"
80 When I send "Hi!" message to "Student 2" user
81 Then I should see "Hi!" in the "Student 2" "core_message > Message conversation"
82 And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
84 And I log in as "student2"
86 And I select "Student 1" conversation in messaging
87 And I should see "Hi!" in the "Student 1" "core_message > Message conversation"