This repository has been archived by the owner on Mar 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
/
message_deletion_spec.js
70 lines (52 loc) · 2.81 KB
/
message_deletion_spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
// ***************************************************************
// - [#] indicates a test step (e.g. 1. Go to a page)
// - [*] indicates an assertion (e.g. * Check the title)
// - Use element ID when selecting an element. Create one if none.
// ***************************************************************
/* eslint max-nested-callbacks: ["error", 5] */
describe('Message deletion', () => {
before(() => {
// # Go to Main Channel View with "user-1"
cy.toMainChannelView('user-1');
});
it('M13336 Delete both parent post and reply when deleting parent post from center', () => {
// # Post message in center.
cy.postMessage('test message deletion');
cy.getLastPostId().then((parentMessageId) => {
// # Mouseover the post and click post comment icon.
cy.clickPostCommentIcon();
// * Check that the RHS is open
cy.get('#rhsContainer').should('be.visible');
// # Post a reply in RHS.
cy.postMessageReplyInRHS('test message reply in RHS {enter}');
cy.getLastPostId().then((replyMessageId) => {
// # Click post dot menu in center.
cy.clickPostDotMenu(parentMessageId);
// # Click delete button.
cy.get(`#delete_post_${parentMessageId}`).click();
// * Check that confirmation dialog is open.
cy.get('#deletePostModal').should('be.visible');
// * Check that confirmation dialog contains correct text
cy.get('#deletePostModal').should('have', 'Are you sure you want to delete this Post?');
// * Check that confirmation dialog shows that the post has one comment on it
cy.get('#deletePostModal').should('have', 'This post has 1 comment on it.');
// # Confirm deletion.
cy.get('#deletePostModalButton').click();
// * Check that the modal is closed
cy.get('#deletePostModal').should('not.be.visible');
// * Check that the RHS is closed.
cy.get('#rhsContainer').should('not.be.visible');
// * Check that parent message is no longer visible.
cy.get(`#post_${parentMessageId}`).should('not.be.visible');
// * Check that reply message is no longer visible.
cy.get(`#post_${replyMessageId}`).should('not.be.visible');
});
cy.getLastPostId().then((replyMessageId) => {
// * Check that last message do not contain (message deleted)
cy.get(`#post_${replyMessageId}`).should('not.have', '(message deleted)');
});
});
});
});