verdnatura-chat/e2e/09-roomactions.spec.js

439 lines
21 KiB
JavaScript
Raw Permalink Normal View History

2018-05-23 13:39:18 +00:00
const {
device, expect, element, by, waitFor
} = require('detox');
const { takeScreenshot } = require('./helpers/screenshot');
const data = require('./data');
2019-01-29 19:52:56 +00:00
const { tapBack, sleep } = require('./helpers/app');
2018-05-23 13:39:18 +00:00
const scrollDown = 200;
async function navigateToRoomActions(type) {
let room;
if (type === 'd') {
room = 'rocket.cat';
} else {
room = `private${ data.random }`;
}
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(10000);
await element(by.id('rooms-list-view-search')).replaceText(room);
2019-01-29 19:52:56 +00:00
await sleep(2000);
await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(60000);
2018-05-23 13:39:18 +00:00
await element(by.id(`rooms-list-view-item-${ room }`)).tap();
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(2000);
await element(by.id('room-view-header-actions')).tap();
await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(5000);
}
async function backToActions() {
await tapBack();
await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('room-actions-view'))).toBeVisible();
2018-05-23 13:39:18 +00:00
}
async function backToRoomsList() {
await tapBack();
2018-05-23 13:39:18 +00:00
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(2000);
await tapBack();
2018-05-23 13:39:18 +00:00
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
}
describe('Room actions screen', () => {
describe('Render', async() => {
describe('Direct', async() => {
before(async() => {
await navigateToRoomActions('d');
});
it('should have room actions screen', async() => {
await expect(element(by.id('room-actions-view'))).toBeVisible();
});
it('should have info', async() => {
await expect(element(by.id('room-actions-info'))).toBeVisible();
});
it('should have voice', async() => {
await expect(element(by.id('room-actions-voice'))).toBeVisible();
});
it('should have video', async() => {
await expect(element(by.id('room-actions-video'))).toBeVisible();
});
it('should have files', async() => {
await expect(element(by.id('room-actions-files'))).toBeVisible();
});
it('should have mentions', async() => {
await expect(element(by.id('room-actions-mentioned'))).toBeVisible();
});
it('should have starred', async() => {
await expect(element(by.id('room-actions-starred'))).toBeVisible();
});
it('should have search', async() => {
await expect(element(by.id('room-actions-search'))).toBeVisible();
});
it('should have share', async() => {
await waitFor(element(by.id('room-actions-share'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.id('room-actions-share'))).toBeVisible();
});
it('should have pinned', async() => {
await waitFor(element(by.id('room-actions-pinned'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.id('room-actions-pinned'))).toBeVisible();
});
it('should have notifications', async() => {
await waitFor(element(by.id('room-actions-notifications'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.id('room-actions-notifications'))).toBeVisible();
});
it('should have block user', async() => {
await waitFor(element(by.id('room-actions-block-user'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.id('room-actions-block-user'))).toBeVisible();
});
after(async() => {
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() => {
await expect(element(by.id('room-actions-view'))).toBeVisible();
});
it('should have info', async() => {
await expect(element(by.id('room-actions-info'))).toBeVisible();
});
it('should have voice', async() => {
await expect(element(by.id('room-actions-voice'))).toBeVisible();
});
it('should have video', async() => {
await expect(element(by.id('room-actions-video'))).toBeVisible();
});
it('should have members', async() => {
await expect(element(by.id('room-actions-members'))).toBeVisible();
});
it('should have add user', async() => {
await expect(element(by.id('room-actions-add-user'))).toBeVisible();
});
it('should have files', async() => {
await expect(element(by.id('room-actions-files'))).toBeVisible();
});
it('should have mentions', async() => {
await expect(element(by.id('room-actions-mentioned'))).toBeVisible();
});
it('should have starred', async() => {
await expect(element(by.id('room-actions-starred'))).toBeVisible();
});
it('should have search', async() => {
await expect(element(by.id('room-actions-search'))).toBeVisible();
});
it('should have share', async() => {
await waitFor(element(by.id('room-actions-share'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.id('room-actions-share'))).toBeVisible();
});
it('should have pinned', async() => {
await waitFor(element(by.id('room-actions-pinned'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.id('room-actions-pinned'))).toBeVisible();
});
it('should have notifications', async() => {
await waitFor(element(by.id('room-actions-notifications'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.id('room-actions-notifications'))).toBeVisible();
});
it('should have leave channel', async() => {
await waitFor(element(by.id('room-actions-leave-channel'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.id('room-actions-leave-channel'))).toBeVisible();
});
});
afterEach(async() => {
takeScreenshot();
});
});
describe('Usage', async() => {
describe('TDB', async() => {
[NEW] Jitsi integration (#1196) * Stash * Rooms list listing :) * Animated set state * Search working * Fix load rooms on login * stash db class * set active db with path * Remove db on logout * stash * Created updateMessages * Inserting/updating threads * Persisting thread messages * Removed unused list * Loading messages from watermelon * Debounce updates and rerender message * optional fields * Fix realm conflict issues * Fix some render issues * stash * List mount * stash * fix message id * Fix tmsg * - Save subscription.rid as id on watermelon and _id as _id - Send room as param to room view * Throttle room updates * stash * comment removeClippedSubviews * Fetch thread name * try/catch updateMessages * Show loading while RoomView.init is still running * stash * Fix updateMessages * Threads * Delete message * Permalink * Pin * Star * Report * MessageActions refactor * Edit message * Reply message * Add reaction * Auto translate * Fix connection issues * Mark message as error if something happened on the call * Error actions * get custom emoji * Always run console.log when __DEV__ * Try to create serversDB * Don't call updateMessages. Execute that entire logic for one message id instead. * Refactor update messages * ServersDB User [Realm -> Watermelon] * Fix models * Custom emojis * Custom emojis on emoji picker * Frequently used emojis * Fix add reaction on message * stash * Fix * Read messages * Fix thread * Fetch thread header * Follow/unfollow thread * Fix thread * Upload file * Thread tweak * Realm -> Watermelon [Share Extension] * Add RoomsUpdatedAt to Servers Table * Settings * Settings * Fix logout * SendFileMessage ServersDB * ServersDB on serverDropdown * Remove serversDB from Realm * Load thread messages * Delete message * Improve getSettings * Improve * Remove subscription * Remove update * Update room via socket * Small refactor * Fix logout and improve migration * Refactor updateMessages * Improve migration * Remove unnecessary update * Revert remove runAfterInteractions * Fix serverDropdown * Fix merge * Init room actions Watermelon * Room actions Watermelon * Remove realm on room members * Room swipe -> Watermelon * Fix hideChannel * Get roles watermelon * Get permissions watermelon * Users typing + memory db * Auto translate watermelon * New Message View * Selected Users View * try/catch * Get Slash Commands watermelon * Slash Commands message box * Custom emojis message box * Get rooms message box * Room info view * Room info edit * Save active users * Small refactor * Message Actions * hasPermission await * last hasPermission fix * Active users on redux * Add user roles * Users typing on redux and remove memory db * Fix saga delay * Fix few issues * Fix slash commands preview * Draft message * Add muted * Unread count watermelon * Remove realm * Fiz RoomItem rerenders * Remove realm config * Rerender status update on RoomItem * Refactor RoomsListView * Fix load missed messages * Fix room update * Message refactor * Fixing lint * Jitsi config (iOS) * removeClippedSubviews on iOS only * Added few interaction managers * Create jitsiBaseURL * Call buttons * Fix few rerenders * Fix RoomItem status typo * Fix RoomView.SCU * Fix broadcast * Fix user status on RoomActionsView * Jitsi config (Android) * Fix RocketChat.hasPermission * Fix database inconsistencies * Fix few update issues * Add rxjs and remove with observables * Fix tests * Remove subscriptions * Fix RoomsListView SCU * Change database structure and set all schemas to 1 * Fix RoomsListView search * Call Jitsi method * Create onlyAudio option (iOS) * Create onlyAudio option (Android) * Fixed errors, removed rerenders and added animation * Fixed a few errors * Fix lint * Fix issues caught by LGTM * fix ios build * Revert patch * jitsiTimeout * Self-builded Android SDK * Fix load unjoined channel messages * Log on database path on startup * Fix join channel * Remove react-native-realm-path * Set user status on login.user reducer * Fix status not rendering on RoomsListView * Fix few reducers * Fix users going offline * Never use "watermelon" term directly. Replaced by "database" * Fix jitsiTimeout * Fix custom emoji * Fix duplicated call messsage * Creating room from app must update roomUpdatedAt * Log subscribeRoom start * Fix room subscribe right after creating a DM * Fix jest * Move self-builded sdk to node_modules * Refactor is read only on messages actions * Fix typo * Fix typo * Review * Fix schema * Fix muted & freq emoji & unpin & unstar * Remove throttleTime to room info & fix reset on edit room * Fix openServerDropdown spec & Fix unarchive * Fix MessageAction * Refactor RoomInfoEditView * Remove unnecessary condition * Remove unnecessary condition * Remove unnecessary condition * Remove get database * Rename Command.js to SlashCommand.js * Create sanitizer util * Fix indentation * Create subscription.t index * Refactor queries on RoomsListView * Create subscription.name index * Fix getPermissions * Fix indentation * Add missing await * Fix rocketchat.hasPermission * Unnecessary change * Star, pin e delete message refactored * Refactor customEmojis reducer * Remove code * Remove logs * Remove throttle * Call this.init on foreground focus on RoomView * Bump servers schema migration * Always mark message as sent after a success * Fetch only messages needed on updateMessages * Just leave a comment for now * Fetch only subscriptions returned by fetch * Fix send message * Create migration - jitsi_timeout * Fixes & Update e2e tests * Add translations pt-br * Bind callJitsi on RocketChat * Remove unnecessary mocks * Remove listeners when call finished * Use gradlew instead self-builded sdk * Fix lastmessage call username * Add react-native-background-timer * Fix background interval * Remove unnecessary timeout * Clear timeout in case there's one active * Add catch to method call
2019-09-18 17:32:12 +00:00
// TODO: test into a jitsi call
// it('should NOT navigate to voice call', async() => {
// await waitFor(element(by.id('room-actions-voice'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'up');
// await element(by.id('room-actions-voice')).tap();
// await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(2000);
// await expect(element(by.id('room-actions-view'))).toBeVisible();
// });
2018-05-23 13:39:18 +00:00
[NEW] Jitsi integration (#1196) * Stash * Rooms list listing :) * Animated set state * Search working * Fix load rooms on login * stash db class * set active db with path * Remove db on logout * stash * Created updateMessages * Inserting/updating threads * Persisting thread messages * Removed unused list * Loading messages from watermelon * Debounce updates and rerender message * optional fields * Fix realm conflict issues * Fix some render issues * stash * List mount * stash * fix message id * Fix tmsg * - Save subscription.rid as id on watermelon and _id as _id - Send room as param to room view * Throttle room updates * stash * comment removeClippedSubviews * Fetch thread name * try/catch updateMessages * Show loading while RoomView.init is still running * stash * Fix updateMessages * Threads * Delete message * Permalink * Pin * Star * Report * MessageActions refactor * Edit message * Reply message * Add reaction * Auto translate * Fix connection issues * Mark message as error if something happened on the call * Error actions * get custom emoji * Always run console.log when __DEV__ * Try to create serversDB * Don't call updateMessages. Execute that entire logic for one message id instead. * Refactor update messages * ServersDB User [Realm -> Watermelon] * Fix models * Custom emojis * Custom emojis on emoji picker * Frequently used emojis * Fix add reaction on message * stash * Fix * Read messages * Fix thread * Fetch thread header * Follow/unfollow thread * Fix thread * Upload file * Thread tweak * Realm -> Watermelon [Share Extension] * Add RoomsUpdatedAt to Servers Table * Settings * Settings * Fix logout * SendFileMessage ServersDB * ServersDB on serverDropdown * Remove serversDB from Realm * Load thread messages * Delete message * Improve getSettings * Improve * Remove subscription * Remove update * Update room via socket * Small refactor * Fix logout and improve migration * Refactor updateMessages * Improve migration * Remove unnecessary update * Revert remove runAfterInteractions * Fix serverDropdown * Fix merge * Init room actions Watermelon * Room actions Watermelon * Remove realm on room members * Room swipe -> Watermelon * Fix hideChannel * Get roles watermelon * Get permissions watermelon * Users typing + memory db * Auto translate watermelon * New Message View * Selected Users View * try/catch * Get Slash Commands watermelon * Slash Commands message box * Custom emojis message box * Get rooms message box * Room info view * Room info edit * Save active users * Small refactor * Message Actions * hasPermission await * last hasPermission fix * Active users on redux * Add user roles * Users typing on redux and remove memory db * Fix saga delay * Fix few issues * Fix slash commands preview * Draft message * Add muted * Unread count watermelon * Remove realm * Fiz RoomItem rerenders * Remove realm config * Rerender status update on RoomItem * Refactor RoomsListView * Fix load missed messages * Fix room update * Message refactor * Fixing lint * Jitsi config (iOS) * removeClippedSubviews on iOS only * Added few interaction managers * Create jitsiBaseURL * Call buttons * Fix few rerenders * Fix RoomItem status typo * Fix RoomView.SCU * Fix broadcast * Fix user status on RoomActionsView * Jitsi config (Android) * Fix RocketChat.hasPermission * Fix database inconsistencies * Fix few update issues * Add rxjs and remove with observables * Fix tests * Remove subscriptions * Fix RoomsListView SCU * Change database structure and set all schemas to 1 * Fix RoomsListView search * Call Jitsi method * Create onlyAudio option (iOS) * Create onlyAudio option (Android) * Fixed errors, removed rerenders and added animation * Fixed a few errors * Fix lint * Fix issues caught by LGTM * fix ios build * Revert patch * jitsiTimeout * Self-builded Android SDK * Fix load unjoined channel messages * Log on database path on startup * Fix join channel * Remove react-native-realm-path * Set user status on login.user reducer * Fix status not rendering on RoomsListView * Fix few reducers * Fix users going offline * Never use "watermelon" term directly. Replaced by "database" * Fix jitsiTimeout * Fix custom emoji * Fix duplicated call messsage * Creating room from app must update roomUpdatedAt * Log subscribeRoom start * Fix room subscribe right after creating a DM * Fix jest * Move self-builded sdk to node_modules * Refactor is read only on messages actions * Fix typo * Fix typo * Review * Fix schema * Fix muted & freq emoji & unpin & unstar * Remove throttleTime to room info & fix reset on edit room * Fix openServerDropdown spec & Fix unarchive * Fix MessageAction * Refactor RoomInfoEditView * Remove unnecessary condition * Remove unnecessary condition * Remove unnecessary condition * Remove get database * Rename Command.js to SlashCommand.js * Create sanitizer util * Fix indentation * Create subscription.t index * Refactor queries on RoomsListView * Create subscription.name index * Fix getPermissions * Fix indentation * Add missing await * Fix rocketchat.hasPermission * Unnecessary change * Star, pin e delete message refactored * Refactor customEmojis reducer * Remove code * Remove logs * Remove throttle * Call this.init on foreground focus on RoomView * Bump servers schema migration * Always mark message as sent after a success * Fetch only messages needed on updateMessages * Just leave a comment for now * Fetch only subscriptions returned by fetch * Fix send message * Create migration - jitsi_timeout * Fixes & Update e2e tests * Add translations pt-br * Bind callJitsi on RocketChat * Remove unnecessary mocks * Remove listeners when call finished * Use gradlew instead self-builded sdk * Fix lastmessage call username * Add react-native-background-timer * Fix background interval * Remove unnecessary timeout * Clear timeout in case there's one active * Add catch to method call
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();
// await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(2000);
// await expect(element(by.id('room-actions-view'))).toBeVisible();
// });
2018-05-23 13:39:18 +00:00
// TODO: test share room link
// it('should NOT navigate to share room', async() => {
// await waitFor(element(by.id('room-actions-share'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
// await element(by.id('room-actions-share')).tap();
// await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(2000);
// await expect(element(by.id('room-actions-view'))).toBeVisible();
// });
2018-05-23 13:39:18 +00:00
after(async() => {
takeScreenshot();
});
});
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);
await expect(element(by.id('mentioned-messages-view'))).toExist();
// await waitFor(element(by.text(` ${ data.random }mention`))).toBeVisible().withTimeout(60000);
// await expect(element(by.text(` ${ data.random }mention`))).toBeVisible();
2018-05-23 13:39:18 +00:00
await backToActions();
});
it('should show starred message and unstar it', async() => {
await element(by.id('room-actions-starred')).tap();
await waitFor(element(by.id('starred-messages-view'))).toExist().withTimeout(2000);
await waitFor(element(by.text(`${ data.random }message`).withAncestor(by.id('starred-messages-view')))).toBeVisible().withTimeout(60000);
await expect(element(by.text(`${ data.random }message`).withAncestor(by.id('starred-messages-view')))).toBeVisible();
await element(by.text(`${ data.random }message`).withAncestor(by.id('starred-messages-view'))).longPress();
await waitFor(element(by.text('Unstar'))).toBeVisible().withTimeout(2000);
await expect(element(by.text('Unstar'))).toBeVisible();
await element(by.text('Unstar')).tap();
await waitFor(element(by.text(`${ data.random }message`).withAncestor(by.id('starred-messages-view')))).toBeNotVisible().withTimeout(60000);
await expect(element(by.text(`${ data.random }message`).withAncestor(by.id('starred-messages-view')))).toBeNotVisible();
await backToActions();
});
it('should show pinned message and unpin it', async() => {
await waitFor(element(by.id('room-actions-pinned'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await element(by.id('room-actions-pinned')).tap();
await waitFor(element(by.id('pinned-messages-view'))).toExist().withTimeout(2000);
await waitFor(element(by.text(`${ data.random }edited (edited)`).withAncestor(by.id('pinned-messages-view'))).atIndex(0)).toBeVisible().withTimeout(60000);
await expect(element(by.text(`${ data.random }edited (edited)`).withAncestor(by.id('pinned-messages-view')))).toBeVisible();
await element(by.text(`${ data.random }edited (edited)`).withAncestor(by.id('pinned-messages-view'))).longPress();
2018-05-23 13:39:18 +00:00
await waitFor(element(by.text('Unpin'))).toBeVisible().withTimeout(2000);
await expect(element(by.text('Unpin'))).toBeVisible();
await element(by.text('Unpin')).tap();
await waitFor(element(by.text(`${ data.random }edited (edited)`).withAncestor(by.id('pinned-messages-view'))).atIndex(0)).toBeNotVisible().withTimeout(60000);
await expect(element(by.text(`${ data.random }edited (edited)`).withAncestor(by.id('pinned-messages-view')))).toBeNotVisible();
2018-05-23 13:39:18 +00:00
await backToActions();
});
it('should search and find a message', async() => {
await element(by.id('room-actions-search')).tap();
await waitFor(element(by.id('search-messages-view'))).toExist().withTimeout(2000);
await expect(element(by.id('search-message-view-input'))).toBeVisible();
await element(by.id('search-message-view-input')).replaceText(`/${ data.random }message/`);
await waitFor(element(by.text(`${ data.random }message`).withAncestor(by.id('search-messages-view'))).atIndex(0)).toBeVisible().withTimeout(60000);
await expect(element(by.text(`${ data.random }message`).withAncestor(by.id('search-messages-view'))).atIndex(0)).toBeVisible();
await element(by.traits(['button'])).atIndex(0).tap();
2018-05-23 13:39:18 +00:00
await backToActions();
});
afterEach(async() => {
takeScreenshot();
});
});
describe('Notification', async() => {
it('should navigate to notification preference view', async() => {
2018-05-23 13:39:18 +00:00
await waitFor(element(by.id('room-actions-notifications'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.id('room-actions-notifications'))).toBeVisible();
2018-05-23 13:39:18 +00:00
await element(by.id('room-actions-notifications')).tap();
await waitFor(element(by.text('notification-preference-view'))).toBeVisible().withTimeout(2000);
await expect(element(by.id('notification-preference-view'))).toBeVisible();
});
it('should have receive notification option', async() => {
await expect(element(by.id('notification-preference-view-receive-notification'))).toBeVisible();
});
it('should have show unread count option', async() => {
await expect(element(by.id('notification-preference-view-unread-count'))).toBeVisible();
});
it('should have notification alert option', async() => {
await expect(element(by.id('notification-preference-view-alert'))).toBeVisible();
});
it('should have push notification option', async() => {
await waitFor(element(by.id('notification-preference-view-push-notification'))).toBeVisible().whileElement(by.id('notification-preference-view-list')).scroll(scrollDown, 'down');
await expect(element(by.id('notification-preference-view-push-notification'))).toBeVisible();
});
it('should have notification audio option', async() => {
await waitFor(element(by.id('notification-preference-view-audio'))).toBeVisible().whileElement(by.id('notification-preference-view-list')).scroll(scrollDown, 'down');
await expect(element(by.id('notification-preference-view-audio'))).toBeVisible();
});
it('should have notification sound option', async() => {
await waitFor(element(by.id('notification-preference-view-sound'))).toBeVisible().whileElement(by.id('notification-preference-view-list')).scroll(scrollDown, 'down');
await expect(element(by.id('notification-preference-view-sound'))).toBeVisible();
});
it('should have notification duration option', async() => {
await waitFor(element(by.id('notification-preference-view-notification-duration'))).toBeVisible().whileElement(by.id('notification-preference-view-list')).scroll(scrollDown, 'down');
await expect(element(by.id('notification-preference-view-notification-duration'))).toBeVisible();
});
it('should have email alert option', async() => {
await waitFor(element(by.id('notification-preference-view-email-alert'))).toBeVisible().whileElement(by.id('notification-preference-view-list')).scroll(scrollDown, 'down');
await expect(element(by.id('notification-preference-view-email-alert'))).toBeVisible();
2018-05-23 13:39:18 +00:00
});
afterEach(async() => {
takeScreenshot();
});
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
it('should tap on leave channel and raise alert', async() => {
await waitFor(element(by.id('room-actions-leave-channel'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await expect(element(by.id('room-actions-leave-channel'))).toBeVisible();
await element(by.id('room-actions-leave-channel')).tap();
await waitFor(element(by.text('Yes, leave it!'))).toBeVisible().withTimeout(2000);
await expect(element(by.text('Yes, leave it!'))).toBeVisible();
await element(by.text('Yes, leave it!')).tap();
await waitFor(element(by.text('You are the last owner. Please set new owner before leaving the room.'))).toBeVisible().withTimeout(60000);
await expect(element(by.text('You are the last owner. Please set new owner before leaving the room.'))).toBeVisible();
await takeScreenshot();
await element(by.text('OK')).tap();
await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(2000);
2018-05-23 13:39:18 +00:00
});
describe('Add User', async() => {
it('should add user to the room', async() => {
await waitFor(element(by.id('room-actions-add-user'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'up');
await element(by.id('room-actions-add-user')).tap();
await element(by.id('select-users-view-search')).tap();
await element(by.id('select-users-view-search')).replaceText(data.alternateUser);
await waitFor(element(by.id(`select-users-view-item-${ data.alternateUser }`))).toBeVisible().withTimeout(60000);
await expect(element(by.id(`select-users-view-item-${ data.alternateUser }`))).toBeVisible();
await element(by.id(`select-users-view-item-${ data.alternateUser }`)).tap();
await waitFor(element(by.id(`selected-user-${ data.alternateUser }`))).toBeVisible().withTimeout(5000);
await expect(element(by.id(`selected-user-${ data.alternateUser }`))).toBeVisible();
2018-05-23 13:39:18 +00:00
await element(by.id('selected-users-view-submit')).tap();
await waitFor(element(by.id('room-actions-view'))).toBeVisible().withTimeout(2000);
await element(by.id('room-actions-members')).tap();
await element(by.id('room-members-view-toggle-status')).tap();
await waitFor(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toBeVisible().withTimeout(60000);
await expect(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toBeVisible();
await backToActions(1);
2018-05-23 13:39:18 +00:00
});
after(async() => {
takeScreenshot();
});
});
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);
await expect(element(by.id('room-members-view'))).toExist();
});
it('should show all users', async() => {
2018-05-23 13:39:18 +00:00
await element(by.id('room-members-view-toggle-status')).tap();
await waitFor(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toBeVisible().withTimeout(60000);
await expect(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toBeVisible();
2018-05-23 13:39:18 +00:00
});
it('should filter user', async() => {
await waitFor(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toBeVisible().withTimeout(60000);
await expect(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toBeVisible();
2018-05-23 13:39:18 +00:00
await element(by.id('room-members-view-search')).replaceText('rocket');
await waitFor(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toBeNotVisible().withTimeout(60000);
await expect(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toBeNotVisible();
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('');
await waitFor(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toBeVisible().withTimeout(60000);
await expect(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toBeVisible();
2018-05-23 13:39:18 +00:00
});
it('should mute user', async() => {
await element(by.id(`room-members-view-item-${ data.alternateUser }`)).longPress();
2018-05-23 13:39:18 +00:00
await waitFor(element(by.text('Mute'))).toBeVisible().withTimeout(5000);
await expect(element(by.text('Mute'))).toBeVisible();
await element(by.text('Mute')).tap();
await waitFor(element(by.text('User has been muted!'))).toBeVisible().withTimeout(10000);
// await expect(element(by.text('User has been muted!'))).toBeVisible();
await waitFor(element(by.text('User has been muted!'))).toBeNotVisible().withTimeout(10000);
2018-05-23 13:39:18 +00:00
await expect(element(by.text('User has been muted!'))).toBeNotVisible();
await element(by.id(`room-members-view-item-${ data.alternateUser }`)).longPress();
2018-05-23 13:39:18 +00:00
await waitFor(element(by.text('Unmute'))).toBeVisible().withTimeout(2000);
await expect(element(by.text('Unmute'))).toBeVisible();
await element(by.text('Unmute')).tap();
await waitFor(element(by.text('User has been unmuted!'))).toBeVisible().withTimeout(10000);
// await expect(element(by.text('User has been unmuted!'))).toBeVisible();
await waitFor(element(by.text('User has been unmuted!'))).toBeNotVisible().withTimeout(10000);
2018-05-23 13:39:18 +00:00
await expect(element(by.text('User has been unmuted!'))).toBeNotVisible();
});
it('should navigate to direct room', async() => {
await waitFor(element(by.id(`room-members-view-item-${ data.alternateUser }`))).toExist().withTimeout(5000);
await element(by.id(`room-members-view-item-${ data.alternateUser }`)).tap();
2018-05-23 13:39:18 +00:00
await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(60000);
await expect(element(by.id('room-view'))).toBeVisible();
await waitFor(element(by.text(data.alternateUser))).toBeVisible().withTimeout(60000);
await expect(element(by.text(data.alternateUser))).toBeVisible();
await tapBack();
await waitFor(element(by.id('rooms-list-view'))).toBeVisible().withTimeout(2000);
2018-05-23 13:39:18 +00:00
});
afterEach(async() => {
takeScreenshot();
});
});
})
describe('Direct', async() => {
before(async() => {
await navigateToRoomActions('d');
});
it('should block/unblock user', async() => {
await waitFor(element(by.id('room-actions-block-user'))).toBeVisible().whileElement(by.id('room-actions-list')).scroll(scrollDown, 'down');
await element(by.id('room-actions-block-user')).tap();
await waitFor(element(by.text('Unblock user'))).toBeVisible().withTimeout(60000);
await expect(element(by.text('Unblock user'))).toBeVisible();
await element(by.id('room-actions-block-user')).tap();
await waitFor(element(by.text('Block user'))).toBeVisible().withTimeout(60000);
await expect(element(by.text('Block user'))).toBeVisible();
});
after(async() => {
takeScreenshot();
});
});
});
});