2021-03-18 16:52:47 +00:00
|
|
|
const data = require('../../data');
|
2021-09-13 20:41:05 +00:00
|
|
|
const { navigateToLogin, login, searchRoom, sleep } = require('../../helpers/app');
|
2021-07-02 17:39:39 +00:00
|
|
|
const { sendMessage } = require('../../helpers/data_setup');
|
2021-03-18 16:52:47 +00:00
|
|
|
|
|
|
|
async function navigateToRoom(user) {
|
2021-09-13 20:41:05 +00:00
|
|
|
await searchRoom(`${user}`);
|
|
|
|
await element(by.id(`rooms-list-view-item-${user}`)).tap();
|
|
|
|
await waitFor(element(by.id('room-view')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(5000);
|
2021-03-18 16:52:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
describe('Mark as unread', () => {
|
2021-07-02 17:39:39 +00:00
|
|
|
const user = data.users.alternate.username;
|
2021-03-18 16:52:47 +00:00
|
|
|
|
2021-09-13 20:41:05 +00:00
|
|
|
before(async () => {
|
2021-03-18 16:52:47 +00:00
|
|
|
await device.launchApp({ permissions: { notifications: 'YES' }, delete: true });
|
|
|
|
await navigateToLogin();
|
|
|
|
await login(data.users.regular.username, data.users.regular.password);
|
|
|
|
await navigateToRoom(user);
|
|
|
|
});
|
|
|
|
|
2021-07-02 17:39:39 +00:00
|
|
|
describe('Usage', () => {
|
|
|
|
describe('Mark message as unread', () => {
|
2021-09-13 20:41:05 +00:00
|
|
|
it('should mark message as unread', async () => {
|
|
|
|
const message = `${data.random}message-mark-as-unread`;
|
|
|
|
const channelName = `@${data.users.regular.username}`;
|
2021-04-19 14:31:43 +00:00
|
|
|
await sendMessage(data.users.alternate, channelName, message);
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.label(message)).atIndex(0))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(30000);
|
2021-06-11 18:23:43 +00:00
|
|
|
await sleep(300);
|
2021-04-19 14:31:43 +00:00
|
|
|
await element(by.label(message)).atIndex(0).longPress();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('action-sheet-handle')))
|
|
|
|
.toBeVisible()
|
|
|
|
.withTimeout(3000);
|
2021-03-18 16:52:47 +00:00
|
|
|
await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5);
|
2021-06-11 18:23:43 +00:00
|
|
|
await element(by.label('Mark Unread')).atIndex(0).tap();
|
2021-09-13 20:41:05 +00:00
|
|
|
await waitFor(element(by.id('rooms-list-view')))
|
|
|
|
.toExist()
|
|
|
|
.withTimeout(5000);
|
|
|
|
await expect(element(by.id(`rooms-list-view-item-${data.users.alternate.username}`))).toExist();
|
2021-03-18 16:52:47 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|