From 355a45b29ee5ad333a3f0775144763579b8b7703 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Fri, 24 Nov 2023 12:09:02 -0600 Subject: [PATCH 1/3] test(update): add more methods for emoji suggestion tests --- tests/screenobjects/chats/EmojiSuggestions.ts | 16 ++++++++++++++++ .../reusable-accounts/04-message-input.spec.ts | 13 ++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/tests/screenobjects/chats/EmojiSuggestions.ts b/tests/screenobjects/chats/EmojiSuggestions.ts index 4d7bb139cb..d33b85b8ca 100644 --- a/tests/screenobjects/chats/EmojiSuggestions.ts +++ b/tests/screenobjects/chats/EmojiSuggestions.ts @@ -102,4 +102,20 @@ export default class EmojiSuggestions extends UplinkMainScreen { async pressEscKey() { await keyboard.type(Key.Escape); } + + async validateEmojiSuggestionsContainerIsShown() { + 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/specs/reusable-accounts/04-message-input.spec.ts b/tests/specs/reusable-accounts/04-message-input.spec.ts index 36ab0b559f..7fd0a1c7e5 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 () => { From 05c20be06b133a79bc55d90afb3ebfa5e57f22e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Fri, 24 Nov 2023 16:48:02 -0600 Subject: [PATCH 2/3] screenobject(update): minor fixes to screenobject and config for ci issues --- config/wdio.mac.multiremote.conf.ts | 9 +++++++++ tests/screenobjects/chats/EmojiSuggestions.ts | 1 + tests/screenobjects/chats/InputBar.ts | 4 ++-- tests/screenobjects/chats/Messages.ts | 4 ++-- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/config/wdio.mac.multiremote.conf.ts b/config/wdio.mac.multiremote.conf.ts index 42edd54734..f8dcfdffc7 100644 --- a/config/wdio.mac.multiremote.conf.ts +++ b/config/wdio.mac.multiremote.conf.ts @@ -40,6 +40,15 @@ export const config: WebdriverIO.Config = { exclude: [ // 'path/to/excluded/files' ], + mochaOpts: { + ui: "bdd", + /** + * NOTE: This has been increased for more stable Appium Native app + * tests because they can take a bit longer. + */ + timeout: 180000, // 3min + bail: true, + }, // // ============ // Capabilities diff --git a/tests/screenobjects/chats/EmojiSuggestions.ts b/tests/screenobjects/chats/EmojiSuggestions.ts index d33b85b8ca..c38b54c0b0 100644 --- a/tests/screenobjects/chats/EmojiSuggestions.ts +++ b/tests/screenobjects/chats/EmojiSuggestions.ts @@ -104,6 +104,7 @@ export default class EmojiSuggestions extends UplinkMainScreen { } async validateEmojiSuggestionsContainerIsShown() { + await browser.pause(1000); const emojiSuggestionsContainer = await this.emojiSuggestionsContainer; await emojiSuggestionsContainer.waitForDisplayed(); } diff --git a/tests/screenobjects/chats/InputBar.ts b/tests/screenobjects/chats/InputBar.ts index b7f1fc8196..bed9108ff0 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/screenobjects/chats/Messages.ts b/tests/screenobjects/chats/Messages.ts index 7c9c01a9db..eb5940201a 100644 --- a/tests/screenobjects/chats/Messages.ts +++ b/tests/screenobjects/chats/Messages.ts @@ -574,8 +574,8 @@ export default class Messages extends UplinkMainScreen { return await this.instance.$(receivedMessageLocator); }, { - timeout: 15000, - timeoutMsg: "Expected chat message was not received after 15 seconds", + timeout: 30000, + timeoutMsg: "Expected chat message was not received after 30 seconds", }, ); } From f7dd0352c0b9d59ce15e7f5676af50aa94b160ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Carden=CC=83a?= <35935591+luisecm@users.noreply.github.com> Date: Fri, 24 Nov 2023 20:15:33 -0600 Subject: [PATCH 3/3] test(update): fixing config and screenobject messages --- config/wdio.mac.multiremote.conf.ts | 9 --------- tests/screenobjects/chats/Messages.ts | 4 ++-- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/config/wdio.mac.multiremote.conf.ts b/config/wdio.mac.multiremote.conf.ts index f8dcfdffc7..42edd54734 100644 --- a/config/wdio.mac.multiremote.conf.ts +++ b/config/wdio.mac.multiremote.conf.ts @@ -40,15 +40,6 @@ export const config: WebdriverIO.Config = { exclude: [ // 'path/to/excluded/files' ], - mochaOpts: { - ui: "bdd", - /** - * NOTE: This has been increased for more stable Appium Native app - * tests because they can take a bit longer. - */ - timeout: 180000, // 3min - bail: true, - }, // // ============ // Capabilities diff --git a/tests/screenobjects/chats/Messages.ts b/tests/screenobjects/chats/Messages.ts index eb5940201a..7c9c01a9db 100644 --- a/tests/screenobjects/chats/Messages.ts +++ b/tests/screenobjects/chats/Messages.ts @@ -574,8 +574,8 @@ export default class Messages extends UplinkMainScreen { return await this.instance.$(receivedMessageLocator); }, { - timeout: 30000, - timeoutMsg: "Expected chat message was not received after 30 seconds", + timeout: 15000, + timeoutMsg: "Expected chat message was not received after 15 seconds", }, ); }