mattermost-mobile/detox/e2e/support/ui/screen/custom_status.js
Elias Nahum 5ea470a235
V1 dependencies and bump to RN 0.67.2 (#5908)
* update dependencies

* eslint fixes

* Upgrade to RN 67

* update other deps

* Update to RN 0.67.2

* fix Android build (mmkv)

* Fix crash when root message is deleted from the thread screen

* Fix gif emoji playing at high speed on iOS ProMotion capable devices
2022-02-02 15:28:57 -03:00

75 lines
2.6 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {SettingsSidebar} from '@support/ui/component';
class CustomStatusScreen {
testID = {
customStatusScreen: 'custom_status.screen',
input: 'custom_status.input',
selectedEmojiPrefix: 'custom_status.emoji.',
selectedDurationPrefix: 'custom_status.duration.',
inputClearButton: 'custom_status.input.clear.button',
doneButton: 'custom_status.done.button',
suggestionPrefix: 'custom_status_suggestion.',
suggestionClearButton: 'custom_status_suggestion.clear.button',
clearAfterAction: 'custom_status.clear_after.action',
};
customStatusScreen = element(by.id(this.testID.customStatusScreen));
input = element(by.id(this.testID.input));
inputClearButton = element(by.id(this.testID.inputClearButton));
doneButton = element(by.id(this.testID.doneButton));
getCustomStatusSelectedEmoji = (emoji) => {
const emojiTestID = `${this.testID.selectedEmojiPrefix}${emoji}`;
return element(by.id(emojiTestID));
};
getCustomStatusSelectedDuration = (duration) => {
const durationTestID = `${this.testID.selectedDurationPrefix}${duration}`;
return element(by.id(durationTestID));
};
getCustomStatusSuggestion = (text) => {
const suggestionID = `${this.testID.suggestionPrefix}${text}`;
return element(by.id(suggestionID));
};
getSuggestionClearButton = (text) => {
const suggestionID = `${this.testID.suggestionPrefix}${text}`;
return element(by.id(this.testID.suggestionClearButton).withAncestor(by.id(suggestionID)));
};
toBeVisible = async () => {
await expect(this.customStatusScreen).toBeVisible();
return this.customStatusScreen;
};
open = async () => {
// # Open custom status screen
await SettingsSidebar.tapCustomStatusAction();
return this.toBeVisible();
};
tapSuggestion = async ({emoji, text}) => {
await this.getCustomStatusSuggestion(text).tap();
await expect(this.input).toHaveText(text);
await expect(this.getCustomStatusSelectedEmoji(emoji)).toBeVisible();
};
openClearAfterModal = async () => {
await element(by.id(this.testID.clearAfterAction)).tap();
};
close = async () => {
await this.doneButton.tap();
return expect(this.customStatusScreen).not.toBeVisible();
};
}
const customStatusScreen = new CustomStatusScreen();
export default customStatusScreen;