mattermost-mobile/detox/e2e/support/ui/component/post.js
Joseph Baylon 5b7f522404
MM-30423 Detox/E2E: Add e2e for MM-T3192, MM-T3215, MM-T3219, MM-T3221, MM-T3256 (#5180)
* MM-30423 Detox/E2E: Add e2e for MM-T3192, MM-T3215, MM-T3219, MM-T3221, MM-T3256

* Update detox/e2e/test/smoke_test/direct_messages.e2e.js

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>

* Update detox/e2e/test/smoke_test/email_notifications.e2e.js

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>

* Update detox/e2e/test/smoke_test/email_notifications.e2e.js

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>

* Renamed return object status to userStatus

Co-authored-by: Saturnino Abril <saturnino.abril@gmail.com>
2021-02-23 08:09:47 -08:00

33 lines
1.3 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
class Post {
testID = {
postHeaderReply: 'post_header.reply',
postPreHeaderText: 'post_pre_header.text',
markdownText: 'markdown_text',
}
getPost = (postItemSourceTestID, postId, postMessage) => {
const postTestID = `${postItemSourceTestID}.${postId}`;
const baseMatcher = by.id(postTestID);
const postItemMatcher = postMessage ? baseMatcher.withDescendant(by.text(postMessage)) : baseMatcher;
const postItemHeaderReplyMatcher = by.id(this.testID.postHeaderReply).withAncestor(postItemMatcher);
const postItemPreHeaderTextMatch = by.id(this.testID.postPreHeaderText).withAncestor(postItemMatcher);
const postItemMessageMatcher = by.id(this.testID.markdownText).withAncestor(postItemMatcher);
return {
postItem: element(postItemMatcher),
postItemHeaderReply: element(postItemHeaderReplyMatcher),
postItemPreHeaderText: element(postItemPreHeaderTextMatch),
postItemMessage: element(postItemMessageMatcher),
};
}
getPostMessage = (postItemSourceTestID) => {
return element(by.id(this.testID.markdownText).withAncestor(by.id(postItemSourceTestID)));
}
}
const post = new Post();
export default post;