mattermost-mobile/detox/e2e/support/ui/screen/permalink.ts
Joseph Baylon 6a3c600c8a
Detox/E2E: Messaging (at-mentions, channel mentions, autocomplete etc) e2e tests in Gekidou (#6428)
* Detox/E2E: Messaging (at-mentions, channel mentions, autocomplete etc) e2e tests in Gekidou

* Enable other failing tests so they're visible

* Detox/E2E: Messaging markdown e2e tests in Gekidou (#6450)

* Detox/E2E: Messaging markdown e2e tests in Gekidou

* Added zephyr test ids

* Added markdown smoke test

* Enable disabled tests

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2022-07-05 10:01:46 -07:00

54 lines
1.8 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {PostList} from '@support/ui/component';
import {expect} from 'detox';
class PermalinkScreen {
testID = {
permalinkScreenPrefix: 'permalink.',
permalinkScreen: 'permalink.screen',
permalinkPostList: 'permalink.post_list',
jumpToRecentMessagesButton: 'permalink.jump_to_recent_messages.button',
};
permalinkScreen = element(by.id(this.testID.permalinkScreen));
permalinkPostList = element(by.id(this.testID.permalinkPostList));
jumpToRecentMessagesButton = element(by.id(this.testID.jumpToRecentMessagesButton));
postList = new PostList(this.testID.permalinkScreenPrefix);
getPostListPostItem = (postId: string, text = '', postProfileOptions = {}) => {
return this.postList.getPost(postId, text, postProfileOptions);
};
getPostMessageAtIndex = (index: number) => {
return this.postList.getPostMessageAtIndex(index);
};
toBeVisible = async () => {
await expect(this.permalinkScreen).toBeVisible();
return this.permalinkScreen;
};
jumpToRecentMessages = async () => {
// # Jump to recent messages
await this.jumpToRecentMessagesButton.tap();
await expect(this.permalinkScreen).not.toBeVisible();
};
hasPostMessage = async (postId: string, postMessage: string) => {
const {postListPostItem} = this.getPostListPostItem(postId, postMessage);
await expect(postListPostItem).toBeVisible();
};
hasPostMessageAtIndex = async (index: number, postMessage: string) => {
await expect(
this.getPostMessageAtIndex(index),
).toHaveText(postMessage);
};
}
const permalinkScreen = new PermalinkScreen();
export default permalinkScreen;