room and onboarding

This commit is contained in:
Diego Mello 2020-05-15 14:06:14 -03:00
parent 125b7e61dc
commit 13612474fe
13 changed files with 54 additions and 37 deletions

View File

@ -52,6 +52,18 @@ async function logout() {
await expect(element(by.id('onboarding-view'))).toBeVisible();
}
async function createUser() {
await navigateToRegister();
await element(by.id('register-view-name')).replaceText(data.user);
await element(by.id('register-view-username')).replaceText(data.user);
await element(by.id('register-view-email')).replaceText(data.email);
await element(by.id('register-view-password')).replaceText(data.password);
await sleep(300);
await element(by.id('register-view-submit')).tap();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('rooms-list-view'))).toBeVisible();
}
async function tapBack() {
await element(by.id('header-back')).atIndex(0).tap();
}
@ -66,6 +78,7 @@ module.exports = {
navigateToRegister,
login,
logout,
createUser,
tapBack,
sleep
};

View File

@ -1,7 +1,7 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('./data');
const data = require('../data');
describe('Onboarding', () => {
before(async() => {

View File

@ -1,7 +1,7 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const { navigateToRegister, navigateToLogin } = require('./helpers/app');
const { navigateToRegister, navigateToLogin } = require('../helpers/app');
describe('Legal screen', () => {
it('should have legal button on login', async() => {

View File

@ -1,8 +1,8 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('./data');
const { navigateToLogin } = require('./helpers/app');
const data = require('../data');
const { navigateToLogin } = require('../helpers/app');
describe('Forgot password screen', () => {
before(async() => {

View File

@ -1,8 +1,8 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const { navigateToRegister, sleep } = require('./helpers/app');
const data = require('./data');
const { navigateToRegister, sleep } = require('../helpers/app');
const data = require('../data');
describe('Create user screen', () => {
before(async() => {
@ -83,9 +83,5 @@ describe('Create user screen', () => {
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('rooms-list-view'))).toBeVisible();
});
// afterAll(async() => {
// await logout();
// });
});
});

View File

@ -1,8 +1,8 @@
const {
expect, element, by, waitFor
} = require('detox');
const { navigateToLogin, tapBack, sleep } = require('./helpers/app');
const data = require('./data');
const { navigateToLogin, tapBack, sleep } = require('../helpers/app');
const data = require('../data');
describe('Login screen', () => {
before(async() => {

View File

@ -1,8 +1,7 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const { login, logout, navigateToLogin, tapBack, sleep } = require('./helpers/app');
const data = require('./data');
const { logout, tapBack, sleep } = require('../helpers/app');
describe('Rooms list screen', () => {
describe('Render', () => {
@ -10,10 +9,6 @@ describe('Rooms list screen', () => {
await expect(element(by.id('rooms-list-view'))).toBeVisible();
});
// it('should have rooms list', async() => {
// await expect(element(by.id('rooms-list-view-list'))).toBeVisible();
// });
it('should have room item', async() => {
await expect(element(by.id('rooms-list-view-item-general')).atIndex(0)).toExist();
});
@ -26,7 +21,6 @@ describe('Rooms list screen', () => {
it('should have sidebar button', async() => {
await expect(element(by.id('rooms-list-view-sidebar'))).toBeVisible();
// await expect(element(by.id('rooms-list-view-sidebar'))).toHaveLabel(`Connected to ${ data.server }. Tap to view servers list.`);
});
});
});
@ -72,10 +66,5 @@ describe('Rooms list screen', () => {
await logout();
});
});
// afterAll(async() => {
// await navigateToLogin();
// await login();
// });
});
});

11
e2e/onboarding/init.js Normal file
View File

@ -0,0 +1,11 @@
const detox = require('detox');
const config = require('../../package.json').detox;
before(async() => {
await detox.init(config, { launchApp: false });
await device.launchApp({ permissions: { notifications: 'YES' } });
});
after(async() => {
await detox.cleanup();
});

View File

@ -1,16 +1,13 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('./data');
const { tapBack, sleep, login, navigateToLogin } = require('./helpers/app');
const data = require('../data');
const { tapBack, sleep, createUser } = require('../helpers/app');
describe('Create room screen', () => {
before(async() => {
// await sleep(5000);
await device.launchApp({ newInstance: true });
await navigateToLogin();
await login();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
// await device.launchApp({ newInstance: true });
await createUser();
await element(by.id('rooms-list-view-create-channel')).tap();
await waitFor(element(by.id('new-message-view'))).toBeVisible().withTimeout(2000);
});

View File

@ -1,8 +1,8 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('./data');
const { tapBack, sleep } = require('./helpers/app');
const data = require('../data');
const { tapBack, sleep } = require('../helpers/app');
async function mockMessage(message) {
await element(by.id('messagebox-input')).tap();

View File

@ -1,8 +1,8 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('./data');
const { tapBack, sleep } = require('./helpers/app');
const data = require('../data');
const { tapBack, sleep } = require('../helpers/app');
const scrollDown = 200;

View File

@ -1,8 +1,8 @@
const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('./data');
const { tapBack, sleep } = require('./helpers/app');
const data = require('../data');
const { tapBack, sleep } = require('../helpers/app');
async function navigateToRoomInfo(type) {
let room;

11
e2e/room/init.js Normal file
View File

@ -0,0 +1,11 @@
const detox = require('detox');
const config = require('../../package.json').detox;
before(async() => {
await detox.init(config, { launchApp: false });
await device.launchApp({ permissions: { notifications: 'YES' } });
});
after(async() => {
await detox.cleanup();
});