* MM-30286 Detox/E2E: Add e2e test for MM-T3236 * Fix more testID hierarchies * Fix typo * Fix failing test * Remove extra lines * Updated to use string interpolation * Update channels list element query * Updated channel item unit test to be more consistent * Fix error text testID hierarchies; fix edit channel info testIDs * Fix snap file * Fix line return
82 lines
3.2 KiB
JavaScript
82 lines
3.2 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {
|
|
CameraQuickAction,
|
|
FileQuickAction,
|
|
ImageQuickAction,
|
|
InputQuickAction,
|
|
PostDraft,
|
|
SendButton,
|
|
} from '@support/ui/component';
|
|
import {
|
|
LongPostScreen,
|
|
PostListScreen,
|
|
} from '@support/ui/screen';
|
|
import {timeouts, wait} from '@support/utils';
|
|
|
|
class ThreadScreen {
|
|
testID = {
|
|
threadScreenPrefix: 'thread.',
|
|
threadScreen: 'thread.screen',
|
|
backButton: 'screen.back.button',
|
|
}
|
|
|
|
threadScreen = element(by.id(this.testID.threadScreen));
|
|
backButton = element(by.id(this.testID.backButton));
|
|
|
|
// convenience props
|
|
atInputQuickAction = InputQuickAction.getAtInputQuickAction(this.testID.threadScreenPrefix);
|
|
atInputQuickActionDisabled = InputQuickAction.getAtInputQuickActionDisabled(this.testID.threadScreenPrefix);
|
|
slashInputQuickAction = InputQuickAction.getSlashInputQuickAction(this.testID.threadScreenPrefix);
|
|
slashInputQuickActionDisabled = InputQuickAction.getSlashInputQuickActionDisabled(this.testID.threadScreenPrefix);
|
|
fileQuickAction = FileQuickAction.getFileQuickAction(this.testID.threadScreenPrefix);
|
|
fileQuickActionDisabled = FileQuickAction.getFileQuickActionDisabled(this.testID.threadScreenPrefix);
|
|
imageQuickAction = ImageQuickAction.getImageQuickAction(this.testID.threadScreenPrefix);
|
|
imageQuickActionDisabled = ImageQuickAction.getImageQuickActionDisabled(this.testID.threadScreenPrefix);
|
|
cameraQuickAction = CameraQuickAction.getCameraQuickAction(this.testID.threadScreenPrefix);
|
|
cameraQuickActionDisabled = CameraQuickAction.getCameraQuickActionDisabled(this.testID.threadScreenPrefix);
|
|
postDraft = PostDraft.getPostDraft(this.testID.threadScreenPrefix);
|
|
postDraftArchived = PostDraft.getPostDraftArchived(this.testID.threadScreenPrefix);
|
|
postDraftReadOnly = PostDraft.getPostDraftReadOnly(this.testID.threadScreenPrefix);
|
|
postInput = PostDraft.getPostInput(this.testID.threadScreenPrefix);
|
|
sendButton = SendButton.getSendButton(this.testID.threadScreenPrefix);
|
|
sendButtonDisabled = SendButton.getSendButtonDisabled(this.testID.threadScreenPrefix);
|
|
|
|
getLongPostPostItem = (postId, text) => {
|
|
return LongPostScreen.getPost(postId, text);
|
|
}
|
|
|
|
getPostListPostItem = (postId, text) => {
|
|
return PostListScreen.getPost(this.testID.threadScreenPrefix, postId, text);
|
|
}
|
|
|
|
toBeVisible = async () => {
|
|
await wait(timeouts.HALF_SEC);
|
|
await expect(this.threadScreen).toBeVisible();
|
|
|
|
return this.threadScreen;
|
|
}
|
|
|
|
back = async () => {
|
|
await this.backButton.tap();
|
|
await expect(this.threadScreen).not.toBeVisible();
|
|
}
|
|
|
|
postMessage = async (message) => {
|
|
// # Post message
|
|
await this.postInput.tap();
|
|
await this.postInput.typeText(message);
|
|
await this.tapSendButton();
|
|
}
|
|
|
|
tapSendButton = async () => {
|
|
// # Tap send button
|
|
await this.sendButton.tap();
|
|
await expect(this.sendButton).not.toExist();
|
|
await expect(this.sendButtonDisabled).toBeVisible();
|
|
}
|
|
}
|
|
|
|
const threadScreen = new ThreadScreen();
|
|
export default threadScreen;
|