Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
@core @core_message @javascript
2
Feature: Delete messages from conversations
3
  In order to manage a course group in a course
4
  As a user
5
  I need to be able to delete messages from conversations
6
 
7
  Background:
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:
23
      | user     | group |
24
      | student1 | G1 |
25
      | student2 | G1 |
26
    And the following "group messages" exist:
27
      | user     | group  | message                   |
28
      | student1 | G1     | Hi!                       |
29
      | student2 | G1     | How are you?              |
30
      | student1 | G1     | Can somebody help me?     |
31
    And the following "private messages" exist:
32
      | user     | contact  | message       |
33
      | student1 | student2 | Hi!           |
34
      | student2 | student1 | Hello!        |
35
      | student1 | student2 | Are you free? |
36
    And the following config values are set as admin:
37
      | messaging        | 1 |
38
      | messagingminpoll | 1 |
39
 
40
  Scenario: Delete a message sent by the user from a group conversation
41
    Given I log in as "student1"
42
    And I open messaging
43
    And "Group 1" "core_message > Message" should exist
44
    And I select "Group 1" conversation in messaging
45
    And I click on "Hi!" "core_message > Message content"
46
    And I click on "How are you?" "core_message > Message content"
47
    And I click on "Can somebody help me?" "core_message > Message content"
48
    And I should see "3" in the "[data-region='message-selected-court']" "css_element"
49
#   Clicking to unselect
50
    And I click on "How are you?" "core_message > Message content"
51
    And I click on "Can somebody help me?" "core_message > Message content"
52
    And I should see "1" in the "[data-region='message-selected-court']" "css_element"
53
    And "Delete selected messages" "button" should exist
54
    When I click on "Delete selected messages" "button"
55
#   Deleting, so messages should not be there
56
    And I should see "Delete"
57
    And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element"
58
    Then I should not see "Delete"
59
    And I should not see "Hi!"
60
    And I should see "##today##%d %B##" in the "Group 1" "core_message > Message conversation"
61
    And I should see "How are you?" in the "Group 1" "core_message > Message conversation"
62
    And I should see "Can somebody help me?" in the "Group 1" "core_message > Message conversation"
63
    And I should not see "Messages selected"
64
 
65
  Scenario: Delete two messages from a group conversation; one sent by another user.
66
    Given I log in as "student1"
67
    And I open messaging
68
    And "Group 1" "core_message > Message" should exist
69
    And I select "Group 1" conversation in messaging
70
    And I click on "Hi!" "core_message > Message content"
71
    And I should see "1" in the "[data-region='message-selected-court']" "css_element"
72
    And I click on "How are you?" "core_message > Message content"
73
    And I should see "2" in the "[data-region='message-selected-court']" "css_element"
74
    And "Delete selected messages" "button" should exist
75
    When I click on "Delete selected messages" "button"
76
#   Deleting, so messages should not be there
77
    And I should see "Delete"
78
    And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element"
79
    Then I should not see "Delete"
80
    And I should not see "Hi!"
81
    And I should see "##today##%d %B##" in the "Group 1" "core_message > Message conversation"
82
    And I should not see "How are you?" in the "Group 1" "core_message > Message conversation"
83
    And I should see "Can somebody help me?" in the "Group 1" "core_message > Message conversation"
84
    And I should not see "Messages selected"
85
#   Check messages were not deleted for other users
86
    And I log out
87
    And I log in as "student2"
88
    And I open messaging
89
    And I select "Group 1" conversation in messaging
90
    And I should see "Hi!"
91
    And I should see "How are you?"
92
    And I should see "Can somebody help me?"
93
 
94
  Scenario: Cancel deleting two messages from a group conversation
95
    Given I log in as "student1"
96
    And I open messaging
97
    And "Group 1" "core_message > Message" should exist
98
    And I select "Group 1" conversation in messaging
99
    And I click on "Hi!" "core_message > Message content"
100
    And I click on "How are you?" "core_message > Message content"
101
    And "Delete selected messages" "button" should exist
102
    When I click on "Delete selected messages" "button"
103
#   Canceling deletion, so messages should be there
104
    And I should see "Cancel"
105
    And I click on "//button[@data-action='cancel-confirm']" "xpath_element"
106
    Then I should not see "Cancel"
107
    And I should see "Hi!"
108
    And I should see "How are you?" in the "Group 1" "core_message > Message conversation"
109
    And I should see "2" in the "[data-region='message-selected-court']" "css_element"
110
 
111
  Scenario: Delete a message sent by the user from a private conversation
112
    Given I log in as "student1"
113
    And I open messaging
114
    And I should see "Private"
115
    And I open the "Private" conversations list
116
    And I should see "Student 2"
117
    And I select "Student 2" conversation in messaging
118
    And I click on "Hi!" "core_message > Message content"
119
    And I should see "1" in the "[data-region='message-selected-court']" "css_element"
120
    And "Delete selected messages" "button" should exist
121
    When I click on "Delete selected messages" "button"
122
#   Deleting, so messages should not be there
123
    And I should see "Delete"
124
    And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element"
125
    Then I should not see "Delete"
126
    And I should not see "Hi!"
127
    And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
128
    And I should see "Hello!" in the "Student 2" "core_message > Message conversation"
129
    And I should see "Are you free?" in the "Student 2" "core_message > Message conversation"
130
    And I should not see "Messages selected"
131
 
132
  Scenario: Delete two messages from a private conversation; one sent by another user
133
    Given I log in as "student1"
134
    And I open messaging
135
    And I should see "Private"
136
    And I open the "Private" conversations list
137
    And I should see "Student 2"
138
    And I select "Student 2" conversation in messaging
139
    And I click on "Hi!" "core_message > Message content"
140
    And I should see "1" in the "[data-region='message-selected-court']" "css_element"
141
    And I click on "Hello!" "core_message > Message content"
142
    And I should see "2" in the "[data-region='message-selected-court']" "css_element"
143
    And "Delete selected messages" "button" should exist
144
    When I click on "Delete selected messages" "button"
145
#   Deleting, so messages should not be there
146
    And I should see "Delete"
147
    And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element"
148
    Then I should not see "Delete"
149
    And I should not see "Hi!"
150
    And I should not see "Hello!" in the "Student 2" "core_message > Message conversation"
151
    And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
152
    And I should see "Are you free?" in the "Student 2" "core_message > Message conversation"
153
    And I should not see "Messages selected"
154
#   Check messages were not deleted for the other user
155
    And I log out
156
    And I log in as "student2"
157
    And I open messaging
158
    And I open the "Private" conversations list
159
    And I select "Student 1" conversation in messaging
160
    And I should see "Hi!"
161
    And I should see "Hello!"
162
    And I should see "Are you free?"
163
 
164
  Scenario: Cancel deleting two messages from a private conversation
165
    Given I log in as "student1"
166
    And I open messaging
167
    And I should see "Private"
168
    And I open the "Private" conversations list
169
    And I should see "Student 2"
170
    And I select "Student 2" conversation in messaging
171
    And I click on "Hi!" "core_message > Message content"
172
    And I click on "Hello!" "core_message > Message content"
173
    And "Delete selected messages" "button" should exist
174
    When I click on "Delete selected messages" "button"
175
#   Canceling deletion, so messages should be there
176
    And I should see "Cancel"
177
    And I click on "//button[@data-action='cancel-confirm']" "xpath_element"
178
    Then I should not see "Cancel"
179
    And I should see "Hi!"
180
    And I should see "Hello!" in the "Student 2" "core_message > Message conversation"
181
    And I should see "2" in the "[data-region='message-selected-court']" "css_element"
182
 
183
  Scenario: Delete a message sent by the user from a favorite conversation
184
    Given the following "favourite conversations" exist:
185
      | user     | contact  |
186
      | student1 | student2 |
187
    And I log in as "student1"
188
    And I open messaging
189
    And I should see "Student 2"
190
    And I select "Student 2" conversation in messaging
191
    And I click on "Hi!" "core_message > Message content"
192
    And I should see "1" in the "[data-region='message-selected-court']" "css_element"
193
    And "Delete selected messages" "button" should exist
194
    When I click on "Delete selected messages" "button"
195
#   Deleting, so messages should not be there
196
    And I should see "Delete"
197
    And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element"
198
    Then I should not see "Delete"
199
    And I should not see "Hi!"
200
    And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
201
    And I should see "Hello!" in the "Student 2" "core_message > Message conversation"
202
    And I should not see "Messages selected"
203
 
204
  Scenario: Delete two messages from a favourite conversation; one sent by another user
205
    Given the following "favourite conversations" exist:
206
      | user     | contact  |
207
      | student1 | student2 |
208
    And I log in as "student1"
209
    And I open messaging
210
    And I should see "Student 2"
211
    And I select "Student 2" conversation in messaging
212
    And I click on "Hi!" "core_message > Message content"
213
    And I should see "1" in the "[data-region='message-selected-court']" "css_element"
214
    And I click on "Hello!" "core_message > Message content"
215
    And I should see "2" in the "[data-region='message-selected-court']" "css_element"
216
    And "Delete selected messages" "button" should exist
217
    When I click on "Delete selected messages" "button"
218
#   Deleting, so messages should not be there
219
    And I should see "Delete"
220
    And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element"
221
    Then I should not see "Delete"
222
    And I should not see "Hi!"
223
    And I should not see "Hello!" in the "Student 2" "core_message > Message conversation"
224
    And I should see "##today##%d %B##" in the "Student 2" "core_message > Message conversation"
225
    And I should see "Are you free?" in the "Student 2" "core_message > Message conversation"
226
    And I should not see "Messages selected"
227
 
228
  Scenario: Cancel deleting two messages from a favourite conversation
229
    Given the following "favourite conversations" exist:
230
      | user     | contact  |
231
      | student1 | student2 |
232
    And I log in as "student1"
233
    And I open messaging
234
    And I should see "Student 2"
235
    And I select "Student 2" conversation in messaging
236
    And I click on "Hi!" "core_message > Message content"
237
    And I click on "Hello!" "core_message > Message content"
238
    And "Delete selected messages" "button" should exist
239
    When I click on "Delete selected messages" "button"
240
#   Canceling deletion, so messages should be there
241
    And I should see "Cancel"
242
    And I click on "//button[@data-action='cancel-confirm']" "xpath_element"
243
    Then I should not see "Cancel"
244
    And I should see "Hi!"
245
    And I should see "Hello!" in the "Student 2" "core_message > Message conversation"
246
    And I should see "2" in the "[data-region='message-selected-court']" "css_element"
247
 
248
  Scenario: Check an empty favourite conversation is still favourite
249
    Given the following "favourite conversations" exist:
250
      | user     | contact  |
251
      | student1 | student2 |
252
    And I log in as "student1"
253
    And I open messaging
254
    And I should see "Student 2"
255
    And I select "Student 2" conversation in the "favourites" conversations list
256
    And I click on "Hi!" "core_message > Message content"
257
    And I click on "Hello!" "core_message > Message content"
258
    And I click on "Are you free?" "core_message > Message content"
259
    And "Delete selected messages" "button" should exist
260
    When I click on "Delete selected messages" "button"
261
    And I should see "Delete"
262
    And I click on "//button[@data-action='confirm-delete-selected-messages']" "xpath_element"
263
    And I go back in "view-conversation" message drawer
264
    Then I should not see "Student 2" in the "//*[@data-region='message-drawer']//div[@data-region='view-overview-favourites']" "xpath_element"
265
    And the following "private messages" exist:
266
      | user     | contact  | message       |
267
      | student1 | student2 | Hi!           |
268
    And I open messaging
269
    And I open the "Starred" conversations list
270
    And I select "Student 2" conversation in the "favourites" conversations list
271
    And I should see "Hi!" in the "Student 2" "core_message > Message conversation"