1 |
efrain |
1 |
@core @core_message @javascript
|
|
|
2 |
Feature: Message delete conversations
|
|
|
3 |
In order to communicate with fellow users
|
|
|
4 |
As a user
|
|
|
5 |
I need to be able to delete conversations
|
|
|
6 |
|
|
|
7 |
Background:
|
|
|
8 |
Given the following "users" exist:
|
|
|
9 |
| username | firstname | lastname | email |
|
|
|
10 |
| student1 | Student | 1 | student1@example.com |
|
|
|
11 |
| student2 | Student | 2 | student2@example.com |
|
|
|
12 |
And the following "courses" exist:
|
|
|
13 |
| name | shortname |
|
|
|
14 |
| course1 | C1 |
|
|
|
15 |
And the following "course enrolments" exist:
|
|
|
16 |
| user | course | role |
|
|
|
17 |
| student1 | C1 | student |
|
|
|
18 |
| student2 | C1 | student |
|
|
|
19 |
And the following config values are set as admin:
|
|
|
20 |
| messaging | 1 |
|
|
|
21 |
| messagingallusers | 1 |
|
|
|
22 |
| messagingminpoll | 1 |
|
|
|
23 |
And the following "private messages" exist:
|
|
|
24 |
| user | contact | message |
|
|
|
25 |
| student1 | student2 | Hi! |
|
|
|
26 |
| student2 | student1 | What do you need? |
|
|
|
27 |
|
|
|
28 |
Scenario: Delete a private conversation
|
|
|
29 |
And I log in as "student2"
|
|
|
30 |
And I open messaging
|
|
|
31 |
And I select "Student 1" conversation in the "messages" conversations list
|
|
|
32 |
And I open contact menu
|
|
|
33 |
And I click on "Delete conversation" "link" in the "//div[@data-region='header-container']" "xpath_element"
|
|
|
34 |
# Confirm deletion, so conversation should not be there
|
|
|
35 |
And I should see "Delete"
|
|
|
36 |
And I click on "//button[@data-action='confirm-delete-conversation']" "xpath_element"
|
|
|
37 |
And I should not see "Delete"
|
|
|
38 |
And I should not see "Hi!" in the "Student 1" "core_message > Message conversation"
|
|
|
39 |
And I should not see "What do you need?" in the "Student 1" "core_message > Message conversation"
|
|
|
40 |
And I should not see "##today##%d %B##" in the "Student 1" "core_message > Message conversation"
|
|
|
41 |
# Check user is deleting private conversation only for them
|
|
|
42 |
And I log out
|
|
|
43 |
And I log in as "student1"
|
|
|
44 |
And I open messaging
|
|
|
45 |
And I select "Student 2" conversation in the "messages" conversations list
|
|
|
46 |
And I should see "Hi!" in the "Student 2" "core_message > Message conversation"
|
|
|
47 |
And I should see "What do you need?" in the "Student 2" "core_message > Message conversation"
|
|
|
48 |
And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
|
|
|
49 |
|
|
|
50 |
Scenario: Cancel deleting a private conversation
|
|
|
51 |
Given I log in as "student1"
|
|
|
52 |
And I open messaging
|
|
|
53 |
And I select "Student 2" conversation in the "messages" conversations list
|
|
|
54 |
And I open contact menu
|
|
|
55 |
And I click on "Delete conversation" "link" in the "//div[@data-region='header-container']" "xpath_element"
|
|
|
56 |
# Cancel deletion, so conversation should be there
|
|
|
57 |
And I should see "Cancel"
|
|
|
58 |
And I click on "//button[@data-action='cancel-confirm']" "xpath_element"
|
|
|
59 |
And I should not see "Cancel"
|
|
|
60 |
And I should see "Hi!" in the "Student 2" "core_message > Message conversation"
|
|
|
61 |
And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
|
|
|
62 |
|
|
|
63 |
Scenario: Delete a starred conversation
|
|
|
64 |
Given the following "favourite conversations" exist:
|
|
|
65 |
| user | contact |
|
|
|
66 |
| student1 | student2 |
|
|
|
67 |
And I log in as "student1"
|
|
|
68 |
And I open messaging
|
|
|
69 |
And I select "Student 2" conversation in the "favourites" conversations list
|
|
|
70 |
And I open contact menu
|
|
|
71 |
And I click on "Delete conversation" "link" in the "//div[@data-region='header-container']" "xpath_element"
|
|
|
72 |
# Confirm deletion, so conversation should not be there
|
|
|
73 |
And I should see "Delete"
|
|
|
74 |
And I click on "//button[@data-action='confirm-delete-conversation']" "xpath_element"
|
|
|
75 |
And I should not see "Delete"
|
|
|
76 |
And I should not see "Hi!" in the "Student 2" "core_message > Message conversation"
|
|
|
77 |
And I should not see "What do you need?" in the "Student 2" "core_message > Message conversation"
|
|
|
78 |
And I should not see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
|
|
|
79 |
# Check user is deleting private conversation only for them
|
|
|
80 |
And I log out
|
|
|
81 |
And I log in as "student2"
|
|
|
82 |
And I open messaging
|
|
|
83 |
And I select "Student 1" conversation in the "messages" conversations list
|
|
|
84 |
And I should see "Hi!" in the "Student 1" "core_message > Message conversation"
|
|
|
85 |
And I should see "What do you need?" in the "Student 1" "core_message > Message conversation"
|
|
|
86 |
And I should see "##today##%d %B##" in the "Student 1" "core_message > Message conversation"
|
|
|
87 |
|
|
|
88 |
Scenario: Cancel deleting a starred conversation
|
|
|
89 |
Given the following "favourite conversations" exist:
|
|
|
90 |
| user | contact |
|
|
|
91 |
| student1 | student2 |
|
|
|
92 |
When I log in as "student1"
|
|
|
93 |
And I open messaging
|
|
|
94 |
And I select "Student 2" conversation in the "favourites" conversations list
|
|
|
95 |
Then I should see "Hi!" in the "Student 2" "core_message > Message conversation"
|
|
|
96 |
And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
|
|
|
97 |
And I open contact menu
|
|
|
98 |
And I click on "Delete conversation" "link" in the "//div[@data-region='header-container']" "xpath_element"
|
|
|
99 |
# Cancel deletion, so conversation should be there
|
|
|
100 |
And I should see "Cancel"
|
|
|
101 |
And I click on "//button[@data-action='cancel-confirm']" "xpath_element"
|
|
|
102 |
And I should not see "Cancel"
|
|
|
103 |
And I should see "Hi!" in the "Student 2" "core_message > Message conversation"
|
|
|
104 |
And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
|
|
|
105 |
|
|
|
106 |
Scenario: Check a deleted starred conversation is still starred
|
|
|
107 |
Given the following "favourite conversations" exist:
|
|
|
108 |
| user | contact |
|
|
|
109 |
| student1 | student2 |
|
|
|
110 |
When I log in as "student1"
|
|
|
111 |
And I open messaging
|
|
|
112 |
And I select "Student 2" conversation in the "favourites" conversations list
|
|
|
113 |
And I open contact menu
|
|
|
114 |
And I click on "Delete conversation" "link" in the "//div[@data-region='header-container']" "xpath_element"
|
|
|
115 |
Then I should see "Delete"
|
|
|
116 |
And I click on "//button[@data-action='confirm-delete-conversation']" "xpath_element"
|
|
|
117 |
And I should not see "Delete"
|
|
|
118 |
And I should not see "Hi!" in the "Student 2" "core_message > Message conversation"
|
|
|
119 |
And I go back in "view-conversation" message drawer
|
|
|
120 |
And I should not see "Student 2" in the "favourites" "core_message > Message list area"
|
|
|
121 |
And the following "private messages" exist:
|
|
|
122 |
| user | contact | message |
|
|
|
123 |
| student1 | student2 | Hi! |
|
|
|
124 |
And I open messaging
|
|
|
125 |
And I should see "Student 2" in the "favourites" "core_message > Message list area"
|