From 1d38ff0831292aca731cb628a370fe7ebb697711 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Wed, 26 Aug 2020 16:28:16 -0300 Subject: [PATCH] [FIX] Detox tests (#2433) * Spotlight issues * Fix room tests * Fix roomactions tests --- app/views/RoomView/Header/Header.js | 1 + e2e/tests/room/01-createroom.spec.js | 6 ++++-- e2e/tests/room/02-room.spec.js | 4 ++-- e2e/tests/room/03-roomactions.spec.js | 6 ++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/app/views/RoomView/Header/Header.js b/app/views/RoomView/Header/Header.js index 9022514ab..6acc6646e 100644 --- a/app/views/RoomView/Header/Header.js +++ b/app/views/RoomView/Header/Header.js @@ -129,6 +129,7 @@ const Header = React.memo(({ return ( { }); it('should select/unselect user', async() => { - await element(by.id('select-users-view-item-rocket.cat')).tap(); + // Spotlight issues + await element(by.id('select-users-view-item-rocket.cat')).atIndex(0).tap(); await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000); await element(by.id('selected-user-rocket.cat')).tap(); await waitFor(element(by.id('selected-user-rocket.cat'))).toBeNotVisible().withTimeout(10000); - await element(by.id('select-users-view-item-rocket.cat')).tap(); + // Spotlight issues + await element(by.id('select-users-view-item-rocket.cat')).atIndex(0).tap(); await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000); }); diff --git a/e2e/tests/room/02-room.spec.js b/e2e/tests/room/02-room.spec.js index 00d5d434d..224c8c9fb 100644 --- a/e2e/tests/room/02-room.spec.js +++ b/e2e/tests/room/02-room.spec.js @@ -298,8 +298,8 @@ describe('Room screen', () => { }); it('should navigate to thread from thread name', async() => { - await waitFor(element(by.id('room-view-header-actions').and(by.label(` ${ mainRoom }`)))).toBeVisible().withTimeout(2000); - await waitFor(element(by.id('room-view-header-actions').and(by.label(` ${ data.random }thread`)))).toBeNotVisible().withTimeout(2000); + await waitFor(element(by.id('room-view-header-actions').and(by.label(`${ mainRoom }`)))).toBeVisible().withTimeout(2000); + await waitFor(element(by.id('room-view-header-actions').and(by.label(`${ data.random }thread`)))).toBeNotVisible().withTimeout(2000); await sleep(500) //TODO: Find a better way to wait for the animation to finish and the messagebox-input to be available and usable :( await mockMessage('dummymessagebetweenthethread'); diff --git a/e2e/tests/room/03-roomactions.spec.js b/e2e/tests/room/03-roomactions.spec.js index 43ff025ef..cdd6b5aba 100644 --- a/e2e/tests/room/03-roomactions.spec.js +++ b/e2e/tests/room/03-roomactions.spec.js @@ -14,8 +14,8 @@ async function navigateToRoomActions(type) { room = data.groups.private.name; } await searchRoom(room); - await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(60000); - await element(by.id(`rooms-list-view-item-${ room }`)).tap(); + await waitFor(element(by.id(`rooms-list-view-item-${ room }`)).atIndex(0)).toExist().withTimeout(60000); + await element(by.id(`rooms-list-view-item-${ room }`)).atIndex(0).tap(); await waitFor(element(by.id('room-view'))).toExist().withTimeout(2000); await element(by.id('room-view-header-actions')).tap(); await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000); @@ -332,6 +332,7 @@ describe('Room actions screen', () => { const user = data.users.alternate it('should tap on leave channel and raise alert', async() => { + await element(by.type('UIScrollView')).atIndex(1).scrollTo('bottom'); await waitFor(element(by.id('room-actions-leave-channel'))).toExist().withTimeout(2000); await element(by.id('room-actions-leave-channel')).tap(); await waitFor(element(by.text('Yes, leave it!'))).toExist().withTimeout(2000); @@ -352,6 +353,7 @@ describe('Room actions screen', () => { await waitFor(element(by.id(`selected-user-${ user.username }`))).toExist().withTimeout(5000); await element(by.id('selected-users-view-submit')).tap(); await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('room-actions-members'))).toExist().withTimeout(2000); await element(by.id('room-actions-members')).tap(); await element(by.id('room-members-view-toggle-status')).tap(); await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);