From a32817202f6c8324c8b8f3895316faaeb0ff9b81 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Fri, 24 Feb 2023 08:57:08 -0300 Subject: [PATCH] threads --- e2e/helpers/app.ts | 17 +++++++++++++---- e2e/tests/room/05-threads.spec.ts | 2 -- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/e2e/helpers/app.ts b/e2e/helpers/app.ts index 0ab67d036..54415a8a6 100644 --- a/e2e/helpers/app.ts +++ b/e2e/helpers/app.ts @@ -114,16 +114,25 @@ async function mockMessage(message: string, isThread = false) { } async function mockRandomMessage(message: string, isThread = false) { + const matchMessage = async () => { + await waitFor(element(by[textMatcher](message))) + .toExist() + .withTimeout(60000); + await element(by[textMatcher](message)).atIndex(0).tap(); + }; const deviceType = device.getPlatform(); const { textMatcher } = platformTypes[deviceType]; const input = isThread ? 'messagebox-input-thread' : 'messagebox-input'; await element(by.id(input)).replaceText(message); await sleep(300); await element(by.id('messagebox-send-message')).tap(); - await waitFor(element(by[textMatcher](message))) - .toExist() - .withTimeout(60000); - await element(by[textMatcher](message)).atIndex(0).tap(); + try { + await matchMessage(); + } catch { + // TODO: Create a proper test for this elsewhere. + await dismissReviewNag(); + await matchMessage(); + } return message; } diff --git a/e2e/tests/room/05-threads.spec.ts b/e2e/tests/room/05-threads.spec.ts index 3b49d06b4..1e939d6d9 100644 --- a/e2e/tests/room/05-threads.spec.ts +++ b/e2e/tests/room/05-threads.spec.ts @@ -156,8 +156,6 @@ describe('Threads', () => { it('should navigate to thread from thread name', async () => { const messageText = 'navthreadname'; await mockRandomMessage('dummymessagebetweenthethread'); - // TODO: Create a proper test for this elsewhere. - await dismissReviewNag(); await element(by.id(`message-thread-button-${thread}`)).tap(); await waitFor(element(by.id('messagebox-input-thread'))) .toExist()