[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
This commit is contained in:
Dan Caseley 2020-07-26 15:28:48 +01:00 committed by GitHub
parent e5aaa667e7
commit 3cc4b51258
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 28 additions and 29 deletions

View File

@ -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);

View File

@ -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', () => {

View File

@ -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);

View File

@ -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);