From 3cc4b51258cd99feccf80bbdf6d1d152fd42d1b8 Mon Sep 17 00:00:00 2001 From: Dan Caseley Date: Sun, 26 Jul 2020 15:28:48 +0100 Subject: [PATCH] [TESTS] Stabilise Room Actions test (#2333) * Stabilise Room Actions test * Fix Create Room test * Be more tolerant of slow starting apps in CI * Be more tolerant of slow running apps in CI * Switch visibility checks ti stabilise Room Create test in CI * Move slow simulator readiness waiting to initial navigateToX methods rather than repeatedly in tests without description of purpose --- e2e/helpers/app.js | 2 + e2e/tests/onboarding/01-onboarding.spec.js | 2 +- e2e/tests/room/01-createroom.spec.js | 52 ++++++++++------------ e2e/tests/room/03-roomactions.spec.js | 1 + 4 files changed, 28 insertions(+), 29 deletions(-) diff --git a/e2e/helpers/app.js b/e2e/helpers/app.js index 92feb61d3..fcc6dc2ea 100644 --- a/e2e/helpers/app.js +++ b/e2e/helpers/app.js @@ -14,6 +14,7 @@ async function navigateToWorkspace() { } async function navigateToLogin() { + await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000); await navigateToWorkspace(); await element(by.id('workspace-view-login')).tap(); await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000); @@ -21,6 +22,7 @@ async function navigateToLogin() { } async function navigateToRegister() { + await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000); await navigateToWorkspace(); await element(by.id('workspace-view-register')).tap(); await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000); diff --git a/e2e/tests/onboarding/01-onboarding.spec.js b/e2e/tests/onboarding/01-onboarding.spec.js index 9c049099e..4806dcb57 100644 --- a/e2e/tests/onboarding/01-onboarding.spec.js +++ b/e2e/tests/onboarding/01-onboarding.spec.js @@ -6,7 +6,7 @@ const data = require('../../data'); describe('Onboarding', () => { before(async() => { await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); - await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(2000); + await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(20000); }); describe('Render', () => { diff --git a/e2e/tests/room/01-createroom.spec.js b/e2e/tests/room/01-createroom.spec.js index 35b007dba..3fb464458 100644 --- a/e2e/tests/room/01-createroom.spec.js +++ b/e2e/tests/room/01-createroom.spec.js @@ -30,14 +30,14 @@ describe('Create room screen', () => { describe('Usage', async() => { it('should back to rooms list', async() => { - await waitFor(element(by.id('new-message-view-close'))).toBeVisible().withTimeout(2000); + await waitFor(element(by.id('new-message-view-close'))).toBeVisible().withTimeout(5000); await element(by.id('new-message-view-close')).tap(); - await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000); + await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(5000); await tryTapping(element(by.id('rooms-list-view-create-channel')), 3000); //await element(by.id('rooms-list-view-create-channel')).tap(); - await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(5000); }); it('should search user and navigate', async() => { @@ -47,14 +47,14 @@ describe('Create room screen', () => { await waitFor(element(by.id('room-view'))).toExist().withTimeout(10000); await waitFor(element(by.id('room-view-title-rocket.cat'))).toExist().withTimeout(60000); await tapBack(); - await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(5000); }); it('should navigate to select users', async() => { await element(by.id('rooms-list-view-create-channel')).tap(); - await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(5000); await element(by.id('new-message-view-create-channel')).tap(); - await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000); }); }) }); @@ -62,35 +62,31 @@ describe('Create room screen', () => { describe('Select Users', async() => { it('should search users', async() => { await element(by.id('select-users-view-search')).replaceText('rocket.cat'); - await waitFor(element(by.id(`select-users-view-item-rocket.cat`))).toExist().withTimeout(10000); - await expect(element(by.id(`select-users-view-item-rocket.cat`))).toExist(); + await waitFor(element(by.id(`select-users-view-item-rocket.cat`))).toBeVisible().withTimeout(10000); }); it('should select/unselect user', async() => { await element(by.id('select-users-view-item-rocket.cat')).tap(); - await waitFor(element(by.id('selected-user-rocket.cat'))).toExist().withTimeout(5000); - await expect(element(by.id('selected-user-rocket.cat'))).toExist(); + 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(5000); - await expect(element(by.id('selected-user-rocket.cat'))).toBeNotVisible(); + await waitFor(element(by.id('selected-user-rocket.cat'))).toBeNotVisible().withTimeout(10000); await element(by.id('select-users-view-item-rocket.cat')).tap(); - await waitFor(element(by.id('selected-user-rocket.cat'))).toExist().withTimeout(5000); + await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000); }); it('should navigate to create channel view', async() => { await element(by.id('selected-users-view-submit')).tap(); - await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(5000); - await expect(element(by.id('create-channel-view'))).toExist(); + await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000); }); }) describe('Create Channel', async() => { describe('Render', async() => { it('should render all fields', async() => { - await expect(element(by.id('create-channel-name'))).toExist(); - await expect(element(by.id('create-channel-type'))).toExist(); - await expect(element(by.id('create-channel-readonly'))).toExist(); - await expect(element(by.id('create-channel-broadcast'))).toExist(); + await expect(element(by.id('create-channel-name'))).toBeVisible(); + await expect(element(by.id('create-channel-type'))).toBeVisible(); + await expect(element(by.id('create-channel-readonly'))).toBeVisible(); + await expect(element(by.id('create-channel-broadcast'))).toBeVisible(); }) }) @@ -113,18 +109,18 @@ describe('Create room screen', () => { await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(60000); await expect(element(by.id(`room-view-title-${ room }`))).toExist(); await tapBack(); - await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(10000); await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(60000); await expect(element(by.id(`rooms-list-view-item-${ room }`))).toExist(); }); it('should create private room', async() => { const room = `private${ data.random }`; - await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(5000); await element(by.id('rooms-list-view-create-channel')).tap(); - await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(5000); await element(by.id('new-message-view-create-channel')).tap(); - await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000); await element(by.id('select-users-view-item-rocket.cat')).tap(); await waitFor(element(by.id('selected-user-rocket.cat'))).toExist().withTimeout(5000); await element(by.id('selected-users-view-submit')).tap(); @@ -136,21 +132,21 @@ describe('Create room screen', () => { await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(60000); await expect(element(by.id(`room-view-title-${ room }`))).toExist(); await tapBack(); - await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(5000); await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(60000); await expect(element(by.id(`rooms-list-view-item-${ room }`))).toExist(); }); it('should create empty room', async() => { const room = `empty${ data.random }`; - await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(10000); // await device.launchApp({ newInstance: true }); await element(by.id('rooms-list-view-create-channel')).tap(); - await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(5000); await element(by.id('new-message-view-create-channel')).tap(); - await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000); await element(by.id('selected-users-view-submit')).tap(); - await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(5000); + await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000); await element(by.id('create-channel-name')).replaceText(room); await element(by.id('create-channel-submit')).tap(); await waitFor(element(by.id('room-view'))).toExist().withTimeout(60000); diff --git a/e2e/tests/room/03-roomactions.spec.js b/e2e/tests/room/03-roomactions.spec.js index bd5b7c6bc..43ff025ef 100644 --- a/e2e/tests/room/03-roomactions.spec.js +++ b/e2e/tests/room/03-roomactions.spec.js @@ -344,6 +344,7 @@ describe('Room actions screen', () => { it('should add user to the room', async() => { await waitFor(element(by.id('room-actions-add-user'))).toExist().withTimeout(4000); await element(by.id('room-actions-add-user')).tap(); + await waitFor(element(by.id('select-users-view-search'))).toExist().withTimeout(4000); await element(by.id('select-users-view-search')).tap(); await element(by.id('select-users-view-search')).replaceText(user.username); await waitFor(element(by.id(`select-users-view-item-${ user.username }`))).toExist().withTimeout(10000);