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
/
results_post_comment_spec.js
56 lines (42 loc) · 2.09 KB
/
results_post_comment_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
// 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.
// ***************************************************************
describe('Search', () => {
it('S14548 Search results Right-Hand-Side: Post a comment', () => {
// # Login and navigate to the app
cy.apiLogin('user-1');
cy.visit('/');
const message = `asparagus${Date.now()}`;
const comment = 'Replying to asparagus';
// # Post a new message
cy.postMessage(message);
// # Search for the text we just entered
cy.get('#searchBox').type(message).type('{enter}');
// # Get last postId
cy.getLastPostId().then((postId) => {
const postMessageText = `#postMessageText_${postId}`;
// * Search results should have our original message
cy.get('#search-items-container').find(postMessageText).should('have.text', `${message}`);
// # Click on the reply button on the search result
cy.clickPostCommentIcon(postId, 'SEARCH');
// # Reply with a comment
cy.get('#reply_textbox').type(`${comment}{enter}`);
// * Verify sidebar is still open
cy.get('#rhsContainer').should('be.visible');
// * Verify that the original message is in the RHS
cy.get('#rhsContainer').find(postMessageText).should('have.text', `${message}`);
});
// # Get the comment id
cy.getLastPostId().then((commentId) => {
const commentText = `#postMessageText_${commentId}`;
// * Verify comment in RHS
cy.get('#rhsContainer').find(commentText).should('have.text', `${comment}`);
// * Verify comment main thread
cy.get('#postListContent').find(commentText).should('have.text', `${comment}`);
});
});
});