This commit is contained in:
Diego Mello 2020-05-14 16:05:36 -03:00
parent 5ffd8749d0
commit 125b7e61dc
16 changed files with 97 additions and 147 deletions

View File

@ -3,7 +3,7 @@ const {
} = require('detox');
const data = require('./data');
describe.skip('Onboarding', () => {
describe('Onboarding', () => {
before(async() => {
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(2000);
});

View File

@ -1,50 +0,0 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const { tapBack } = require('./helpers/app');
describe('Welcome screen', () => {
before(async() => {
await device.launchApp({ newInstance: true });
await element(by.id('join-community-button')).tap();
await waitFor(element(by.id('welcome-view'))).toBeVisible().withTimeout(60000);
})
describe('Render', async() => {
it('should have welcome screen', async() => {
await expect(element(by.id('welcome-view'))).toBeVisible();
});
it('should have register button', async() => {
await expect(element(by.id('welcome-view-register'))).toBeVisible();
});
it('should have login button', async() => {
await expect(element(by.id('welcome-view-login'))).toBeVisible();
});
// TODO: oauth
});
describe('Usage', async() => {
it('should navigate to login', async() => {
await element(by.id('welcome-view-login')).tap();
await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('login-view'))).toBeVisible();
});
it('should navigate to register', async() => {
await tapBack();
await element(by.id('welcome-view-register')).tap();
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('register-view'))).toBeVisible();
});
it('should navigate to legal', async() => {
await tapBack();
await element(by.id('welcome-view-more')).tap();
await waitFor(element(by.id('legal-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('legal-view'))).toBeVisible();
});
});
});

57
e2e/02-legal.spec.js Normal file
View File

@ -0,0 +1,57 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const { navigateToRegister, navigateToLogin } = require('./helpers/app');
describe('Legal screen', () => {
it('should have legal button on login', async() => {
await device.launchApp({ newInstance: true });
await navigateToLogin();
await waitFor(element(by.id('login-view-more'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('login-view-more'))).toBeVisible();
});
it('should navigate to legal from login', async() => {
await waitFor(element(by.id('login-view-more'))).toBeVisible().withTimeout(60000);
await element(by.id('login-view-more')).tap();
});
it('should have legal button on register', async() => {
await device.launchApp({ newInstance: true });
await navigateToRegister();
await waitFor(element(by.id('register-view-more'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('register-view-more'))).toBeVisible();
});
it('should navigate to legal from register', async() => {
await waitFor(element(by.id('register-view-more'))).toBeVisible().withTimeout(60000);
await element(by.id('register-view-more')).tap();
});
it('should have legal screen', async() => {
await expect(element(by.id('legal-view'))).toBeVisible();
});
it('should have terms of service button', async() => {
await expect(element(by.id('legal-terms-button'))).toBeVisible();
});
it('should have privacy policy button', async() => {
await expect(element(by.id('legal-privacy-button'))).toBeVisible();
});
// We can't simulate how webview behaves, so I had to disable :(
// it('should navigate to terms', async() => {
// await element(by.id('legal-terms-button')).tap();
// await waitFor(element(by.id('terms-view'))).toBeVisible().withTimeout(2000);
// await expect(element(by.id('terms-view'))).toBeVisible();
// });
// it('should navigate to privacy', async() => {
// await tapBack();
// await element(by.id('legal-privacy-button')).tap();
// await waitFor(element(by.id('privacy-view'))).toBeVisible().withTimeout(2000);
// await expect(element(by.id('privacy-view'))).toBeVisible();
// });
});

View File

@ -1,47 +0,0 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const { tapBack } = require('./helpers/app');
describe('Legal screen', () => {
before(async() => {
await waitFor(element(by.id('legal-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('legal-view'))).toBeVisible();
})
describe('Render', async() => {
it('should have legal screen', async() => {
await expect(element(by.id('legal-view'))).toBeVisible();
});
it('should have terms of service button', async() => {
await expect(element(by.id('legal-terms-button'))).toBeVisible();
});
it('should have privacy policy button', async() => {
await expect(element(by.id('legal-privacy-button'))).toBeVisible();
});
});
describe('Usage', async() => {
// We can't simulate how webview behaves, so I had to disable :(
// it('should navigate to terms', async() => {
// await element(by.id('legal-terms-button')).tap();
// await waitFor(element(by.id('terms-view'))).toBeVisible().withTimeout(2000);
// await expect(element(by.id('terms-view'))).toBeVisible();
// });
// it('should navigate to privacy', async() => {
// await tapBack();
// await element(by.id('legal-privacy-button')).tap();
// await waitFor(element(by.id('privacy-view'))).toBeVisible().withTimeout(2000);
// await expect(element(by.id('privacy-view'))).toBeVisible();
// });
it('should navigate to welcome', async() => {
await tapBack();
await waitFor(element(by.id('welcome-view'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('welcome-view'))).toBeVisible();
});
});
});

View File

@ -4,7 +4,7 @@ const {
const data = require('./data');
const { navigateToLogin } = require('./helpers/app');
describe.only('Forgot password screen', () => {
describe('Forgot password screen', () => {
before(async() => {
await device.launchApp({ newInstance: true });
await navigateToLogin();

View File

@ -1,22 +1,10 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const { logout, sleep } = require('./helpers/app');
const { navigateToRegister, sleep } = require('./helpers/app');
const data = require('./data');
async function navigateToRegister() {
await device.launchApp({ newInstance: true });
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(2000);
await element(by.id('join-workspace')).tap();
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
await element(by.id('new-server-view-input')).replaceText(data.server);
await element(by.id('new-server-view-button')).tap();
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('workspace-view'))).toBeVisible();
await element(by.id('workspace-view-register')).tap();
}
describe.skip('Create user screen', () => {
describe('Create user screen', () => {
before(async() => {
await device.launchApp({ newInstance: true });
await navigateToRegister();

View File

@ -4,7 +4,7 @@ const {
const { navigateToLogin, tapBack, sleep } = require('./helpers/app');
const data = require('./data');
describe.skip('Login screen', () => {
describe('Login screen', () => {
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, newInstance: true, delete: true });
await navigateToLogin();

View File

@ -4,7 +4,7 @@ const {
const { login, logout, navigateToLogin, tapBack, sleep } = require('./helpers/app');
const data = require('./data');
describe.skip('Rooms list screen', () => {
describe('Rooms list screen', () => {
describe('Render', () => {
it('should have rooms list screen', async() => {
await expect(element(by.id('rooms-list-view'))).toBeVisible();

View File

@ -4,7 +4,7 @@ const {
const data = require('./data');
const { tapBack, sleep, login, navigateToLogin } = require('./helpers/app');
describe.skip('Create room screen', () => {
describe('Create room screen', () => {
before(async() => {
// await sleep(5000);
await device.launchApp({ newInstance: true });

View File

@ -21,7 +21,7 @@ async function navigateToRoom() {
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
}
describe.skip('Room screen', () => {
describe('Room screen', () => {
const mainRoom = `private${ data.random }`;
before(async() => {

View File

@ -38,7 +38,7 @@ async function backToRoomsList() {
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
}
describe.skip('Room actions screen', () => {
describe('Room actions screen', () => {
describe('Render', async() => {
describe('Direct', async() => {
before(async() => {

View File

@ -12,7 +12,7 @@ async function navigateToRoomInfo(type) {
room = `private${ data.random }`;
}
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
await element(by.type('UIScrollView')).atIndex(1).scrollTo('top');
await element(by.type('UIScrollView')).atIndex(1).swipe('down');
await element(by.id('rooms-list-view-search')).typeText(room);
await sleep(2000);
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(60000);
@ -34,7 +34,7 @@ async function waitForToast() {
await sleep(5000);
}
describe.skip('Room info screen', () => {
describe('Room info screen', () => {
describe('Direct', async() => {
before(async() => {
await device.launchApp({ newInstance: true });
@ -84,7 +84,7 @@ describe.skip('Room info screen', () => {
await sleep(1000);
await waitFor(element(by.id('room-info-view-edit-button'))).toBeVisible().withTimeout(10000);
await element(by.id('room-info-view-edit-button')).tap();
await waitFor(element(by.id('room-info-edit-view'))).toBeVisible().withTimeout(2000);
await waitFor(element(by.id('room-info-edit-view'))).toExist().withTimeout(2000);
});
it('should have room info edit view', async() => {
@ -169,7 +169,8 @@ describe.skip('Room info screen', () => {
// change name to original
await element(by.id('room-info-view-edit-button')).tap();
await sleep(1000);
await waitFor(element(by.id('room-info-edit-view'))).toBeVisible().withTimeout(2000);
await waitFor(element(by.id('room-info-edit-view'))).toExist().withTimeout(2000);
await sleep(1000);
await element(by.id('room-info-edit-view-name')).replaceText(`${ room }`);
await element(by.type('UIScrollView')).atIndex(1).swipe('up');
await sleep(1000);
@ -186,8 +187,11 @@ describe.skip('Room info screen', () => {
await element(by.id('room-info-edit-view-password')).replaceText('abc');
await element(by.type('UIScrollView')).atIndex(1).swipe('up');
await element(by.id('room-info-edit-view-t')).tap();
await sleep(1000);
await element(by.id('room-info-edit-view-ro')).tap();
await sleep(1000);
await element(by.id('room-info-edit-view-react-when-ro')).tap();
await sleep(1000);
await element(by.id('room-info-edit-view-reset')).tap();
// after reset
await expect(element(by.id('room-info-edit-view-name'))).toHaveText(room);
@ -217,7 +221,8 @@ describe.skip('Room info screen', () => {
await sleep(1000);
await waitFor(element(by.id('room-info-view-edit-button'))).toBeVisible().withTimeout(10000);
await element(by.id('room-info-view-edit-button')).tap();
await waitFor(element(by.id('room-info-edit-view'))).toBeVisible().withTimeout(2000);
await waitFor(element(by.id('room-info-edit-view'))).toExist().withTimeout(2000);
await sleep(1000);
await element(by.id('room-info-edit-view-topic')).replaceText('new topic');
await element(by.type('UIScrollView')).atIndex(1).swipe('up');
await element(by.id('room-info-edit-view-submit')).tap();
@ -232,7 +237,8 @@ describe.skip('Room info screen', () => {
await sleep(1000);
await waitFor(element(by.id('room-info-view-edit-button'))).toBeVisible().withTimeout(10000);
await element(by.id('room-info-view-edit-button')).tap();
await waitFor(element(by.id('room-info-edit-view'))).toBeVisible().withTimeout(2000);
await waitFor(element(by.id('room-info-edit-view'))).toExist().withTimeout(2000);
await sleep(1000);
await element(by.id('room-info-edit-view-announcement')).replaceText('new announcement');
await element(by.type('UIScrollView')).atIndex(1).swipe('up');
await element(by.id('room-info-edit-view-submit')).tap();
@ -247,7 +253,8 @@ describe.skip('Room info screen', () => {
await sleep(1000);
await waitFor(element(by.id('room-info-view-edit-button'))).toBeVisible().withTimeout(10000);
await element(by.id('room-info-view-edit-button')).tap();
await waitFor(element(by.id('room-info-edit-view'))).toBeVisible().withTimeout(2000);
await waitFor(element(by.id('room-info-edit-view'))).toExist().withTimeout(2000);
await sleep(1000);
await element(by.type('UIScrollView')).atIndex(1).swipe('up');
await element(by.id('room-info-edit-view-password')).replaceText('password');
await element(by.id('room-info-edit-view-submit')).tap();

View File

@ -4,7 +4,7 @@ const {
const data = require('./data');
const { sleep, logout } = require('./helpers/app');
describe.skip('Change server', () => {
describe('Change server', () => {
before(async() => {
await device.launchApp({ newInstance: true });
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);

View File

@ -6,7 +6,7 @@ const GA = OTP.googleAuthenticator;
const { navigateToLogin, login, tapBack, sleep, logout } = require('./helpers/app');
const data = require('./data');
describe.skip('Broadcast room', () => {
describe('Broadcast room', () => {
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
});

View File

@ -1,5 +1,5 @@
const random = require('./helpers/random');
const value = 'soevdgehintktmoldtby' // random(20);
const value = random(20);
const data = {
server: 'https://ilarion.rocket.chat',
alternateServer: 'https://stable.rocket.chat',

View File

@ -3,24 +3,7 @@ const {
} = require('detox');
const data = require('../data');
// async function addServer() {
// // await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(2000);
// // await element(by.id('connect-server-button')).tap();
// // await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
// // await expect(element(by.id('new-server-view'))).toBeVisible();
// // await element(by.id('new-server-view-input')).replaceText(data.server);
// // await element(by.id('new-server-view-button')).tap();
// await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(2000);
// await element(by.id('join-workspace')).tap();
// await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
// await element(by.id('new-server-view-input')).replaceText(data.server);
// await element(by.id('new-server-view-button')).tap();
// await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
// await expect(element(by.id('workspace-view'))).toBeVisible();
// await element(by.id('workspace-view-login')).tap();
// }
async function navigateToLogin() {
async function navigateToWorkspace() {
await waitFor(element(by.id('onboarding-view'))).toBeVisible().withTimeout(2000);
await element(by.id('join-workspace')).tap();
await waitFor(element(by.id('new-server-view'))).toBeVisible().withTimeout(60000);
@ -28,11 +11,22 @@ async function navigateToLogin() {
await element(by.id('new-server-view-button')).tap();
await waitFor(element(by.id('workspace-view'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('workspace-view'))).toBeVisible();
}
async function navigateToLogin() {
await navigateToWorkspace();
await element(by.id('workspace-view-login')).tap();
await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('login-view'))).toBeVisible();
}
async function navigateToRegister() {
await navigateToWorkspace();
await element(by.id('workspace-view-register')).tap();
await waitFor(element(by.id('register-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('register-view'))).toBeVisible();
}
async function login() {
await waitFor(element(by.id('login-view'))).toBeVisible().withTimeout(2000);
await element(by.id('login-view-email')).replaceText(data.user);
@ -67,8 +61,9 @@ async function sleep(ms) {
}
module.exports = {
// addServer,
navigateToWorkspace,
navigateToLogin,
navigateToRegister,
login,
logout,
tapBack,