From b4b9192ba098322b6d1958d5247e7bf229800bd2 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Fri, 17 Feb 2023 09:21:42 -0300 Subject: [PATCH] Room Actions --- e2e/helpers/app.ts | 5 +++-- e2e/jest.config.js | 2 +- e2e/tests/room/03-roomactions.spec.ts | 17 ++++++++--------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/e2e/helpers/app.ts b/e2e/helpers/app.ts index 2c7198951..f11db0848 100644 --- a/e2e/helpers/app.ts +++ b/e2e/helpers/app.ts @@ -128,6 +128,7 @@ async function pinMessage(message: string) { const { textMatcher } = platformTypes[deviceType]; const messageLabel = `${data.random}${message}`; await waitFor(element(by[textMatcher](messageLabel)).atIndex(0)).toExist(); + await element(by[textMatcher](messageLabel)).atIndex(0).tap(); await element(by[textMatcher](messageLabel)).atIndex(0).longPress(); await expect(element(by.id('action-sheet'))).toExist(); await expect(element(by.id('action-sheet-handle'))).toBeVisible(); @@ -190,8 +191,8 @@ async function tryTapping( } async function tapAndWaitFor( - elementToTap: Detox.IndexableNativeElement, - elementToWaitFor: Detox.IndexableNativeElement, + elementToTap: Detox.IndexableNativeElement | Detox.NativeElement, + elementToWaitFor: Detox.IndexableNativeElement | Detox.NativeElement, timeout: number ) { try { diff --git a/e2e/jest.config.js b/e2e/jest.config.js index 1a80c2a41..d6f0625b9 100644 --- a/e2e/jest.config.js +++ b/e2e/jest.config.js @@ -2,7 +2,7 @@ module.exports = { rootDir: '..', testSequencer: '/e2e/testSequencer.js', - testMatch: ['/e2e/tests/onboarding/*.spec.ts', '/e2e/tests/assorted/*.spec.ts'], + testMatch: ['/e2e/tests/**/*.spec.ts'], testTimeout: 120000, maxWorkers: 1, globalSetup: '/e2e/globalSetup.ts', diff --git a/e2e/tests/room/03-roomactions.spec.ts b/e2e/tests/room/03-roomactions.spec.ts index 98a8fbcd8..f44ce57b1 100644 --- a/e2e/tests/room/03-roomactions.spec.ts +++ b/e2e/tests/room/03-roomactions.spec.ts @@ -11,7 +11,8 @@ import { starMessage, pinMessage, platformTypes, - TTextMatcher + TTextMatcher, + tapAndWaitFor } from '../../helpers/app'; const { sendMessage } = require('../../helpers/data_setup'); @@ -396,10 +397,7 @@ describe('Room actions screen', () => { await waitFor(element(by.id('room-actions-members'))) .toExist() .withTimeout(2000); - await element(by.id('room-actions-members')).tap(); - await waitFor(element(by.id('room-members-view'))) - .toExist() - .withTimeout(2000); + await tapAndWaitFor(element(by.id('room-actions-members')), element(by.id('room-members-view')), 2000); }); const openActionSheet = async (username: string) => { @@ -591,10 +589,11 @@ describe('Room actions screen', () => { await waitFor(element(by[textMatcher]('Message ignored. Tap to display it.')).atIndex(0)) .toExist() .withTimeout(60000); - await element(by[textMatcher]('Message ignored. Tap to display it.')).atIndex(0).tap(); - await waitFor(element(by[textMatcher](message)).atIndex(0)) - .toExist() - .withTimeout(60000); + await tapAndWaitFor( + element(by[textMatcher]('Message ignored. Tap to display it.')).atIndex(0), + element(by[textMatcher](message)).atIndex(0), + 2000 + ); await element(by[textMatcher](message)).atIndex(0).tap(); });