vn-verdnaturachat/e2e/tests/assorted/08-joinprotectedroom.spec.js

61 lines
2.1 KiB
JavaScript
Raw Normal View History

[FIX] App not prompting join code for password protected channels (#2514) * Adding joinCode parameter Co-authored-by: Vitor Leal <vitor_leal2201@hotmail.com> Co-authored-by: Fernando Aguilar <fernando.aguilar@hotmail.com.br> * Insert join code input Signed-off-by: Vitor.Leal <vitor_leal2201@hotmail.com> * Add joinCode field on db Signed-off-by: Vitor.Leal <vitor_leal2201@hotmail.com> * Add label i18 pt-br and en-us Signed-off-by: Vitor.Leal <vitor_leal2201@hotmail.com> * Add insert join code text Signed-off-by: Vitor.Leal <vitor_leal2201@hotmail.com> * Fix atribute name Signed-off-by: Vitor.Leal <vitor_leal2201@hotmail.com> * Add join text Signed-off-by: Vitor.Leal <vitor_leal2201@hotmail.com> Co-authored-by: Daniel Maike <danmke@hotmail.com> Co-authored-by: Fernando Aguilar <fernando.aguilar@hotmail.com.br> * Fix attributes joinCode, joinCodeRequired and pass attribute param in navigation Signed-off-by: Daniel Maike <danmke@hotmail.com> Co-authored-by: Vitor Leal <vitor_leal2201@hotmail.com> * Fixing attribute joinCodeRequired pass to goRoom Signed-off-by: Daniel Maike <danmke@hotmail.com> * Changed textinput style Signed-off-by: Daniel Maike <danmke@hotmail.com> Co-authored-by: Vitor Leal <vitor_leal2201@hotmail.com> * Delete not necessary attribute Signed-off-by: Daniel Maike <danmke@hotmail.com> * Fixing input style Co-authored-by: Vitor Leal <vitor_leal2201@hotmail.com> * Undo unncessary changes * use a join code modal * tests: e2e tests to join protected channel * fix: undo unnecessary change * tests: cancel join code * Remove some tests * Minor fixes Co-authored-by: Vitor Leal <vitor_leal2201@hotmail.com> Co-authored-by: Fernando Aguilar <fernando.aguilar@hotmail.com.br> Co-authored-by: Djorkaeff Alexandre <djorkaeff.unb@gmail.com> Co-authored-by: youssef-md <emaildeyoussefmuhamad@gmail.com> Co-authored-by: Diego Mello <diegolmello@gmail.com>
2020-12-01 17:30:39 +00:00
const {
device, expect, element, by, waitFor
} = require('detox');
const data = require('../../data');
const { navigateToLogin, login, mockMessage, tapBack, sleep, searchRoom } = require('../../helpers/app');
const testuser = data.users.regular
const room = data.channels.detoxpublicprotected.name
const joinCode = data.channels.detoxpublicprotected.joinCode
async function navigateToRoom() {
await searchRoom(room);
await waitFor(element(by.id(`rooms-list-view-item-${ room }`)).atIndex(0)).toBeVisible().withTimeout(60000);
await element(by.id(`rooms-list-view-item-${ room }`)).atIndex(0).tap();
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000);
}
async function navigateToRoomActions() {
await element(by.id('room-view-header-actions')).tap();
await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(5000);
}
async function openJoinCode() {
await element(by.id('room-view-join-button')).tap();
await waitFor(element(by.id('join-code'))).toBeVisible().withTimeout(5000);
}
describe('Join public room', () => {
before(async() => {
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
await navigateToLogin();
await login(testuser.username, testuser.password);
await navigateToRoom();
});
describe('Usage', async() => {
it('should tap join and ask for join code', async() => {
await openJoinCode();
})
it('should cancel join room', async() => {
await element(by.id('join-code-cancel')).tap();
await waitFor(element(by.id('join-code'))).toBeNotVisible().withTimeout(5000);
});
it('should join room', async() => {
await openJoinCode();
await element(by.id('join-code-input')).replaceText(joinCode);
await element(by.id('join-code-submit')).tap();
await waitFor(element(by.id('join-code'))).toBeNotVisible().withTimeout(5000);
await waitFor(element(by.id('messagebox'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('messagebox'))).toBeVisible();
await expect(element(by.id('room-view-join'))).toBeNotVisible();
});
it('should send message', async() => {
await mockMessage('message');
});
});
});