diff --git a/tests/screenobjects/chats/EmojiSuggestions.ts b/tests/screenobjects/chats/EmojiSuggestions.ts index 4d7bb139cba..c38b54c0b0b 100644 --- a/tests/screenobjects/chats/EmojiSuggestions.ts +++ b/tests/screenobjects/chats/EmojiSuggestions.ts @@ -102,4 +102,21 @@ export default class EmojiSuggestions extends UplinkMainScreen { async pressEscKey() { await keyboard.type(Key.Escape); } + + async validateEmojiSuggestionsContainerIsShown() { + await browser.pause(1000); + const emojiSuggestionsContainer = await this.emojiSuggestionsContainer; + await emojiSuggestionsContainer.waitForDisplayed(); + } + + async validateEmojiSuggestionsHeader(expectedHeader: string) { + const emojiSuggestionsHeader = await this.emojiSuggestionsHeader; + await expect(emojiSuggestionsHeader).toBeDisplayed(); + await expect(emojiSuggestionsHeader).toHaveTextContaining(expectedHeader); + } + + async validateEmojiSuggestionsReceived(expectedEmojiList: string[]) { + const emojiSuggestedList = await this.getEmojisSuggested(); + await expect(emojiSuggestedList).toEqual(expectedEmojiList); + } } diff --git a/tests/screenobjects/chats/InputBar.ts b/tests/screenobjects/chats/InputBar.ts index b7f1fc81968..bed9108ff0c 100644 --- a/tests/screenobjects/chats/InputBar.ts +++ b/tests/screenobjects/chats/InputBar.ts @@ -205,8 +205,8 @@ export default class InputBar extends UplinkMainScreen { } async selectUploadFromLocalDisk() { - const uploadButtonLocalDisk = await this.uploadButtonLocalDisk; - await uploadButtonLocalDisk.click(); + await this.uploadButtonLocalDisk.waitForDisplayed(); + await this.uploadButtonLocalDisk.click(); } async selectUploadFromStorage() { diff --git a/tests/specs/reusable-accounts/04-message-input.spec.ts b/tests/specs/reusable-accounts/04-message-input.spec.ts index 36ab0b559fb..7fd0a1c7e53 100644 --- a/tests/specs/reusable-accounts/04-message-input.spec.ts +++ b/tests/specs/reusable-accounts/04-message-input.spec.ts @@ -49,25 +49,24 @@ export default async function messageInputTests() { it("Emoji Suggested List - Displays expected data", async () => { // Type :en to show emoji suggestions starting with "en" await chatsInputFirstUser.typeMessageOnInput(":en"); - await emojiSuggestionsFirstUser.waitForIsShown(true); + await emojiSuggestionsFirstUser.validateEmojiSuggestionsContainerIsShown(); // Validate header text from Emoji Suggested List - const emojiSuggestionsHeader = - await emojiSuggestionsFirstUser.emojiSuggestionsHeader; - await expect(emojiSuggestionsHeader).toHaveTextContaining( + await emojiSuggestionsFirstUser.validateEmojiSuggestionsHeader( "SUGGESTED EMOJI", ); // Validate results are correct in Emoji Suggestion List - const currentEmojiSuggestedList = - await emojiSuggestionsFirstUser.getEmojisSuggested(); const expectedEmojiSuggestedList = [ "✉️ :envelope:", "🏴󠁧󠁢󠁥󠁮󠁧󠁿 :england:", "📩 :envelope_with_arrow:", "🔚 :end:", ]; - await expect(currentEmojiSuggestedList).toEqual(expectedEmojiSuggestedList); + + await emojiSuggestionsFirstUser.validateEmojiSuggestionsReceived( + expectedEmojiSuggestedList, + ); }); it("Emoji Suggested List - Can be closed without choosing suggestion", async () => {