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