2018-05-23 13:39:18 +00:00
|
|
|
const {
|
|
|
|
device, expect, element, by, waitFor
|
|
|
|
} = require('detox');
|
2020-05-20 16:33:40 +00:00
|
|
|
const data = require('../../data');
|
2020-07-22 16:32:21 +00:00
|
|
|
const { navigateToLogin, login, tapBack, sleep, searchRoom, mockMessage, starMessage, pinMessage } = require('../../helpers/app');
|
2020-11-30 20:00:31 +00:00
|
|
|
const { sendMessage } = require('../../helpers/data_setup')
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
async function navigateToRoomActions(type) {
|
|
|
|
let room;
|
|
|
|
if (type === 'd') {
|
|
|
|
room = 'rocket.cat';
|
|
|
|
} else {
|
2020-07-22 16:32:21 +00:00
|
|
|
room = data.groups.private.name;
|
2018-05-23 13:39:18 +00:00
|
|
|
}
|
2020-07-06 20:56:28 +00:00
|
|
|
await searchRoom(room);
|
2021-01-20 19:53:12 +00:00
|
|
|
await element(by.id(`rooms-list-view-item-${ room }`)).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(2000);
|
2021-04-07 18:31:25 +00:00
|
|
|
await element(by.id('room-header')).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
|
2018-05-23 13:39:18 +00:00
|
|
|
}
|
|
|
|
|
2018-10-23 21:39:48 +00:00
|
|
|
async function backToActions() {
|
|
|
|
await tapBack();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000);
|
2018-05-23 13:39:18 +00:00
|
|
|
}
|
|
|
|
|
2018-08-31 18:13:30 +00:00
|
|
|
async function backToRoomsList() {
|
|
|
|
await tapBack();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(2000);
|
2018-10-23 21:39:48 +00:00
|
|
|
await tapBack();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000);
|
2018-05-23 13:39:18 +00:00
|
|
|
}
|
|
|
|
|
2020-11-30 20:00:31 +00:00
|
|
|
async function waitForToast() {
|
|
|
|
await sleep(1000);
|
|
|
|
}
|
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
describe('Room actions screen', () => {
|
2020-07-22 16:32:21 +00:00
|
|
|
|
|
|
|
before(async() => {
|
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
|
|
|
await navigateToLogin();
|
|
|
|
await login(data.users.regular.username, data.users.regular.password);
|
|
|
|
});
|
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
describe('Render', async() => {
|
|
|
|
describe('Direct', async() => {
|
|
|
|
before(async() => {
|
|
|
|
await navigateToRoomActions('d');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have room actions screen', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-view'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have info', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-info'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2020-03-03 20:27:38 +00:00
|
|
|
// it('should have voice', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
// await expect(element(by.id('room-actions-voice'))).toExist();
|
2020-03-03 20:27:38 +00:00
|
|
|
// });
|
2018-05-23 13:39:18 +00:00
|
|
|
|
2020-03-03 20:27:38 +00:00
|
|
|
// it('should have video', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
// await expect(element(by.id('room-actions-video'))).toExist();
|
2020-03-03 20:27:38 +00:00
|
|
|
// });
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
it('should have files', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-files'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have mentions', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-mentioned'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have starred', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-starred'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have search', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-search'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have share', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-share'))).toExist();
|
|
|
|
await expect(element(by.id('room-actions-share'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have pinned', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-pinned'))).toExist();
|
|
|
|
await expect(element(by.id('room-actions-pinned'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have notifications', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-notifications'))).toExist();
|
|
|
|
await expect(element(by.id('room-actions-notifications'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have block user', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-block-user'))).toExist();
|
|
|
|
await expect(element(by.id('room-actions-block-user'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
after(async() => {
|
2018-08-31 18:13:30 +00:00
|
|
|
await backToRoomsList();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Channel/Group', async() => {
|
|
|
|
before(async() => {
|
|
|
|
await navigateToRoomActions('c');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should have room actions screen', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-view'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have info', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-info'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2020-03-03 20:27:38 +00:00
|
|
|
// it('should have voice', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
// await expect(element(by.id('room-actions-voice'))).toExist();
|
2020-03-03 20:27:38 +00:00
|
|
|
// });
|
2018-05-23 13:39:18 +00:00
|
|
|
|
2020-03-03 20:27:38 +00:00
|
|
|
// it('should have video', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
// await expect(element(by.id('room-actions-video'))).toExist();
|
2020-03-03 20:27:38 +00:00
|
|
|
// });
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
it('should have members', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-members'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have add user', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-add-user'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have files', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-files'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have mentions', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-mentioned'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have starred', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-starred'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have search', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('room-actions-search'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have share', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-share'))).toExist();
|
|
|
|
await expect(element(by.id('room-actions-share'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have pinned', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-pinned'))).toExist();
|
|
|
|
await expect(element(by.id('room-actions-pinned'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have notifications', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-notifications'))).toExist();
|
|
|
|
await expect(element(by.id('room-actions-notifications'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have leave channel', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-leave-channel'))).toExist();
|
|
|
|
await expect(element(by.id('room-actions-leave-channel'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Usage', async() => {
|
|
|
|
describe('TDB', async() => {
|
2019-09-18 17:32:12 +00:00
|
|
|
// TODO: test into a jitsi call
|
|
|
|
// it('should NOT navigate to voice call', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
// await waitFor(element(by.id('room-actions-voice'))).toExist();
|
2019-09-18 17:32:12 +00:00
|
|
|
// await element(by.id('room-actions-voice')).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
// await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000);
|
|
|
|
// await expect(element(by.id('room-actions-view'))).toExist();
|
2019-09-18 17:32:12 +00:00
|
|
|
// });
|
2018-05-23 13:39:18 +00:00
|
|
|
|
2019-09-18 17:32:12 +00:00
|
|
|
// TODO: test into a jitsi call
|
|
|
|
// it('should NOT navigate to video call', async() => {
|
|
|
|
// await element(by.id('room-actions-video')).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
// await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000);
|
|
|
|
// await expect(element(by.id('room-actions-view'))).toExist();
|
2019-09-18 17:32:12 +00:00
|
|
|
// });
|
2018-05-23 13:39:18 +00:00
|
|
|
|
2019-05-29 21:19:12 +00:00
|
|
|
// TODO: test share room link
|
|
|
|
// it('should NOT navigate to share room', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
// await waitFor(element(by.id('room-actions-share'))).toExist();
|
2019-05-29 21:19:12 +00:00
|
|
|
// await element(by.id('room-actions-share')).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
// await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000);
|
|
|
|
// await expect(element(by.id('room-actions-view'))).toExist();
|
2019-05-29 21:19:12 +00:00
|
|
|
// });
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Common', async() => {
|
|
|
|
it('should show mentioned messages', async() => {
|
|
|
|
await element(by.id('room-actions-mentioned')).tap();
|
|
|
|
await waitFor(element(by.id('mentioned-messages-view'))).toExist().withTimeout(2000);
|
2020-06-15 14:00:46 +00:00
|
|
|
// await waitFor(element(by.text(` ${ data.random }mention`))).toExist().withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await backToActions();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should show starred message and unstar it', async() => {
|
2020-07-22 16:32:21 +00:00
|
|
|
|
|
|
|
//Go back to room and send a message
|
|
|
|
await tapBack();
|
|
|
|
await mockMessage('messageToStar');
|
|
|
|
|
|
|
|
//Star the message
|
|
|
|
await starMessage('messageToStar')
|
|
|
|
|
|
|
|
//Back into Room Actions
|
2021-04-07 18:31:25 +00:00
|
|
|
await element(by.id('room-header')).tap();
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
|
|
|
|
|
|
|
|
//Go to starred messages
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('room-actions-starred')).tap();
|
|
|
|
await waitFor(element(by.id('starred-messages-view'))).toExist().withTimeout(2000);
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.label(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toBeVisible().withTimeout(60000);
|
|
|
|
|
|
|
|
//Unstar message
|
|
|
|
await element(by.label(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view'))).longPress();
|
2020-06-15 19:35:45 +00:00
|
|
|
await expect(element(by.id('action-sheet'))).toExist();
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.label('Unstar')).tap();
|
|
|
|
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.label(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toBeNotVisible().withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await backToActions();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should show pinned message and unpin it', async() => {
|
2020-07-22 16:32:21 +00:00
|
|
|
|
|
|
|
//Go back to room and send a message
|
|
|
|
await tapBack();
|
|
|
|
await mockMessage('messageToPin');
|
|
|
|
|
|
|
|
//Pin the message
|
|
|
|
await pinMessage('messageToPin')
|
|
|
|
|
|
|
|
//Back into Room Actions
|
2021-04-07 18:31:25 +00:00
|
|
|
await element(by.id('room-header')).tap();
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
|
2020-09-11 14:31:38 +00:00
|
|
|
await element(by.type('UIScrollView')).atIndex(1).scrollTo('bottom');
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-pinned'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('room-actions-pinned')).tap();
|
|
|
|
await waitFor(element(by.id('pinned-messages-view'))).toExist().withTimeout(2000);
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.label(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view')))).toBeVisible().withTimeout(60000);
|
|
|
|
await element(by.label(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view'))).longPress();
|
2020-06-15 19:35:45 +00:00
|
|
|
|
|
|
|
await expect(element(by.id('action-sheet'))).toExist();
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
await element(by.label('Unpin')).tap();
|
|
|
|
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.label(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view')))).toBeNotVisible().withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await backToActions();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search and find a message', async() => {
|
2020-07-22 16:32:21 +00:00
|
|
|
|
|
|
|
//Go back to room and send a message
|
|
|
|
await tapBack();
|
|
|
|
await mockMessage('messageToFind');
|
|
|
|
|
|
|
|
//Back into Room Actions
|
2021-04-07 18:31:25 +00:00
|
|
|
await element(by.id('room-header')).tap();
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
|
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('room-actions-search')).tap();
|
|
|
|
await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(2000);
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('search-message-view-input'))).toExist();
|
2020-07-22 16:32:21 +00:00
|
|
|
await element(by.id('search-message-view-input')).replaceText(`/${ data.random }messageToFind/`);
|
|
|
|
await waitFor(element(by.label(`${ data.random }messageToFind`).withAncestor(by.id('search-messages-view')))).toExist().withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await backToActions();
|
|
|
|
});
|
2019-08-23 16:24:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Notification', async() => {
|
|
|
|
it('should navigate to notification preference view', async() => {
|
2020-09-11 14:31:38 +00:00
|
|
|
await element(by.type('UIScrollView')).atIndex(1).scrollTo('bottom');
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('room-actions-notifications'))).toExist().withTimeout(2000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('room-actions-notifications')).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('notification-preference-view'))).toExist().withTimeout(2000);
|
2019-08-23 16:24:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have receive notification option', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('notification-preference-view-receive-notification'))).toExist();
|
2019-08-23 16:24:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have show unread count option', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('notification-preference-view-unread-count'))).toExist();
|
2019-08-23 16:24:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have notification alert option', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await expect(element(by.id('notification-preference-view-alert'))).toExist();
|
2019-08-23 16:24:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have push notification option', async() => {
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('notification-preference-view-push-notification'))).toExist().withTimeout(4000);
|
2019-08-23 16:24:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have notification audio option', async() => {
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('notification-preference-view-audio'))).toExist().withTimeout(4000);
|
2019-08-23 16:24:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have notification sound option', async() => {
|
2020-03-03 20:27:38 +00:00
|
|
|
// Ugly hack to scroll on detox
|
|
|
|
await element(by.type('UIScrollView')).atIndex(1).scrollTo('bottom');
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('notification-preference-view-sound'))).toExist().withTimeout(4000);
|
2019-08-23 16:24:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have notification duration option', async() => {
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('notification-preference-view-notification-duration'))).toExist().withTimeout(4000);
|
2019-08-23 16:24:15 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should have email alert option', async() => {
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('notification-preference-view-email-alert'))).toExist().withTimeout(4000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2019-08-23 16:24:15 +00:00
|
|
|
after(async() => {
|
|
|
|
await backToActions();
|
|
|
|
});
|
|
|
|
})
|
2018-05-23 13:39:18 +00:00
|
|
|
|
|
|
|
describe('Channel/Group', async() => {
|
|
|
|
// Currently, there's no way to add more owners to the room
|
|
|
|
// So we test only for the 'You are the last owner...' message
|
2020-07-15 16:28:34 +00:00
|
|
|
|
|
|
|
const user = data.users.alternate
|
|
|
|
|
2018-05-23 13:39:18 +00:00
|
|
|
it('should tap on leave channel and raise alert', async() => {
|
2020-08-26 19:28:16 +00:00
|
|
|
await element(by.type('UIScrollView')).atIndex(1).scrollTo('bottom');
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('room-actions-leave-channel'))).toExist().withTimeout(2000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('room-actions-leave-channel')).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.text('Yes, leave it!'))).toExist().withTimeout(2000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.text('Yes, leave it!')).tap();
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.text('You are the last owner. Please set new owner before leaving the room.'))).toExist().withTimeout(8000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.text('OK')).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2020-11-30 20:00:31 +00:00
|
|
|
it('should add users to the room', async() => {
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id('room-actions-add-user'))).toExist().withTimeout(4000);
|
2020-03-03 20:27:38 +00:00
|
|
|
await element(by.id('room-actions-add-user')).tap();
|
2020-11-30 20:00:31 +00:00
|
|
|
|
|
|
|
// add rocket.cat
|
|
|
|
const rocketCat = 'rocket.cat';
|
|
|
|
await waitFor(element(by.id(`select-users-view-item-${ rocketCat }`))).toExist().withTimeout(10000);
|
|
|
|
await element(by.id(`select-users-view-item-${ rocketCat }`)).tap();
|
|
|
|
await waitFor(element(by.id(`selected-user-${ rocketCat }`))).toExist().withTimeout(5000);
|
|
|
|
|
2020-07-26 14:28:48 +00:00
|
|
|
await waitFor(element(by.id('select-users-view-search'))).toExist().withTimeout(4000);
|
2020-03-03 20:27:38 +00:00
|
|
|
await element(by.id('select-users-view-search')).tap();
|
2020-07-15 16:28:34 +00:00
|
|
|
await element(by.id('select-users-view-search')).replaceText(user.username);
|
2020-07-22 16:32:21 +00:00
|
|
|
await waitFor(element(by.id(`select-users-view-item-${ user.username }`))).toExist().withTimeout(10000);
|
2020-07-15 16:28:34 +00:00
|
|
|
await element(by.id(`select-users-view-item-${ user.username }`)).tap();
|
|
|
|
await waitFor(element(by.id(`selected-user-${ user.username }`))).toExist().withTimeout(5000);
|
2020-11-30 20:00:31 +00:00
|
|
|
|
2020-03-03 20:27:38 +00:00
|
|
|
await element(by.id('selected-users-view-submit')).tap();
|
2020-11-30 20:00:31 +00:00
|
|
|
await sleep(300);
|
|
|
|
await waitFor(element(by.id('room-actions-members'))).toExist().withTimeout(10000);
|
2020-03-03 20:27:38 +00:00
|
|
|
await element(by.id('room-actions-members')).tap();
|
|
|
|
await element(by.id('room-members-view-toggle-status')).tap();
|
2020-07-15 16:28:34 +00:00
|
|
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
|
2020-03-03 20:27:38 +00:00
|
|
|
await backToActions(1);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Room Members', async() => {
|
|
|
|
before(async() => {
|
|
|
|
await element(by.id('room-actions-members')).tap();
|
|
|
|
await waitFor(element(by.id('room-members-view'))).toExist().withTimeout(2000);
|
|
|
|
});
|
|
|
|
|
2018-07-10 13:40:32 +00:00
|
|
|
it('should show all users', async() => {
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('room-members-view-toggle-status')).tap();
|
2020-07-15 16:28:34 +00:00
|
|
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should filter user', async() => {
|
2020-07-15 16:28:34 +00:00
|
|
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('room-members-view-search')).replaceText('rocket');
|
2020-07-15 16:28:34 +00:00
|
|
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toBeNotVisible().withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('room-members-view-search')).tap();
|
|
|
|
await element(by.id('room-members-view-search')).clearText('');
|
2020-07-15 16:28:34 +00:00
|
|
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
|
2020-11-30 20:00:31 +00:00
|
|
|
it('should remove user from room', async() => {
|
|
|
|
await openActionSheet('rocket.cat');
|
|
|
|
await element(by.label('Remove from room')).tap();
|
|
|
|
await waitFor(element(by.label('Are you sure?'))).toExist().withTimeout(5000);
|
|
|
|
await element(by.label('Yes, remove user!').and(by.type('_UIAlertControllerActionView'))).tap();
|
|
|
|
await waitFor(element(by.id('room-members-view-item-rocket.cat'))).toBeNotVisible().withTimeout(60000);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should clear search', async() => {
|
|
|
|
await element(by.id('room-members-view-search')).tap();
|
|
|
|
await element(by.id('room-members-view-search')).clearText('');
|
|
|
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
|
|
|
|
});
|
|
|
|
|
|
|
|
const openActionSheet = async(username) => {
|
|
|
|
await waitFor(element(by.id(`room-members-view-item-${ username }`))).toExist().withTimeout(5000);
|
|
|
|
await element(by.id(`room-members-view-item-${ username }`)).tap();
|
|
|
|
await sleep(300);
|
|
|
|
await expect(element(by.id('action-sheet'))).toExist();
|
|
|
|
await expect(element(by.id('action-sheet-handle'))).toBeVisible();
|
|
|
|
}
|
|
|
|
|
|
|
|
const closeActionSheet = async() => {
|
|
|
|
await element(by.id('action-sheet-backdrop')).tap();
|
|
|
|
}
|
|
|
|
|
|
|
|
it('should set/remove as owner', async() => {
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
await element(by.label('Set as owner')).tap();
|
|
|
|
await waitForToast();
|
|
|
|
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
await element(by.label('Remove as owner')).tap();
|
|
|
|
await waitForToast();
|
|
|
|
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
// Tests if Remove as owner worked
|
|
|
|
await waitFor(element(by.label('Set as owner'))).toExist().withTimeout(5000);
|
|
|
|
await closeActionSheet();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should set/remove as leader', async() => {
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
await element(by.label('Set as leader')).tap();
|
|
|
|
await waitForToast();
|
|
|
|
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
await element(by.label('Remove as leader')).tap();
|
|
|
|
await waitForToast();
|
|
|
|
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
// Tests if Remove as leader worked
|
|
|
|
await waitFor(element(by.label('Set as leader'))).toExist().withTimeout(5000);
|
|
|
|
await closeActionSheet();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should set/remove as moderator', async() => {
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
await element(by.label('Set as moderator')).tap();
|
|
|
|
await waitForToast();
|
|
|
|
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
await element(by.label('Remove as moderator')).tap();
|
|
|
|
await waitForToast();
|
|
|
|
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
// Tests if Remove as moderator worked
|
|
|
|
await waitFor(element(by.label('Set as moderator'))).toExist().withTimeout(5000);
|
|
|
|
await closeActionSheet();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should set/remove as mute', async() => {
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
await element(by.label('Mute')).tap();
|
|
|
|
await waitFor(element(by.label('Are you sure?'))).toExist().withTimeout(5000);
|
|
|
|
await element(by.label('Mute').and(by.type('_UIAlertControllerActionView'))).tap();
|
|
|
|
await waitForToast();
|
|
|
|
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
await element(by.label('Unmute')).tap();
|
|
|
|
await waitFor(element(by.label('Are you sure?'))).toExist().withTimeout(5000);
|
|
|
|
await element(by.label('Unmute').and(by.type('_UIAlertControllerActionView'))).tap();
|
|
|
|
await waitForToast();
|
|
|
|
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
// Tests if Remove as mute worked
|
|
|
|
await waitFor(element(by.label('Mute'))).toExist().withTimeout(5000);
|
|
|
|
await closeActionSheet();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should ignore user', async() => {
|
|
|
|
const message = `${ data.random }ignoredmessagecontent`;
|
|
|
|
const channelName = data.groups.private.name;
|
|
|
|
await sendMessage(user, channelName, message);
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
await element(by.label('Ignore')).tap();
|
|
|
|
await waitForToast();
|
|
|
|
await backToActions();
|
|
|
|
await tapBack();
|
|
|
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(60000);
|
|
|
|
await waitFor(element(by.label('Message ignored. Tap to display it.')).atIndex(0)).toExist().withTimeout(60000);
|
|
|
|
await element(by.label('Message ignored. Tap to display it.')).atIndex(0).tap();
|
|
|
|
await waitFor(element(by.label(message)).atIndex(0)).toExist().withTimeout(60000);
|
|
|
|
await element(by.label(message)).atIndex(0).tap();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate to direct message', async() => {
|
2021-04-07 18:31:25 +00:00
|
|
|
await element(by.id('room-header')).tap();
|
2020-11-30 20:00:31 +00:00
|
|
|
await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000);
|
|
|
|
await element(by.id('room-actions-members')).tap();
|
|
|
|
await waitFor(element(by.id('room-members-view'))).toExist().withTimeout(2000);
|
|
|
|
await element(by.id('room-members-view-toggle-status')).tap();
|
|
|
|
await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000);
|
|
|
|
await openActionSheet(user.username);
|
|
|
|
await element(by.label('Direct message')).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-view'))).toExist().withTimeout(60000);
|
2020-07-15 16:28:34 +00:00
|
|
|
await waitFor(element(by.id(`room-view-title-${ user.username }`))).toExist().withTimeout(60000);
|
2018-10-23 21:39:48 +00:00
|
|
|
await tapBack();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Direct', async() => {
|
|
|
|
before(async() => {
|
|
|
|
await navigateToRoomActions('d');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should block/unblock user', async() => {
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.id('room-actions-block-user'))).toExist();
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('room-actions-block-user')).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.label('Unblock user'))).toExist().withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
await element(by.id('room-actions-block-user')).tap();
|
2020-06-15 14:00:46 +00:00
|
|
|
await waitFor(element(by.label('Block user'))).toExist().withTimeout(60000);
|
2018-05-23 13:39:18 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|