From c087780ccfa848be8ce744b8607195f510209e35 Mon Sep 17 00:00:00 2001 From: Gerzon Z Date: Fri, 4 Jun 2021 12:16:05 -0400 Subject: [PATCH] [TEST] E2E Tests for Teams (#3178) * Added Create Team * Added actionTypes, actions, ENG strings for Teams and updated NewMessageView * Added createTeam sagas, createTeam reducer, new Team string and update CreateChannelView * Remove unnecessary actionTypes, reducers and sagas, e2e tests and navigation to team view * Minor tweaks * Show TeamChannelsView only if joined the team * Minor tweak * Added AddChannelTeamView * Added permissions, translations strings for teams, deleteTeamRoom and addTeamRooms, AddExistingChannelView, updated CreateChannelView, TeamChannelsView * Refactor touch component and update removeRoom and deleteRoom methods * Minor tweaks * Minor tweaks for removing channels and addExistingChannelView * Added missing events and fixed channels list * Minor tweaks for refactored touch component * Added SelectListView and logic for leaving team * Added addTeamMember and removeTeamMember * Minor tweak * Added deleteTeam function * Minor tweak * Minor tweaks * Remove unnecesary changes, update TeamChannelsView, AddExistingChannelView, AddChannelTeamView, createChannel, goRoom and Touchable * Remove unnecesary prop * Add screens to ModalStack, events, autoJoin, update createChannel, addRoomsToTeam and Touchable * Minor tweak * Update loadMessagesForRoom.js * Updated schema, tag component, touch, AddChannelTeamView, AddExistingChannelView, ActionSheet Item * Fix unnecessary changes * Add i18n, update createChannel, AddExistingChannelTeamView, AddChannelTeamView, RightButton and TeamChannelsView * Updated styles, added tag story * Minor tweak * Minor tweaks * Auto-join tweak * Minor tweaks * Minor tweak on search * Minor refactor to ListItem, add SelectListView to ModalStack, update handleLeaveTeam * Minor tweaks * Update SelectListView * Update handleLeaveTeam, remove unnecessary method, add story * Minor tweak * Minor visual tweaks * Update SelectListView.js * Update index.js * Update RoomMembersView * Updated SelectListView, RoomActionsView, leaveTeam method and string translations * Update SelectListVIew * Minor tweak * Update SelectListView * Minor tweak * Minor tweaks * Fix for List.Item subtitles being pushed down by title's flex * Minor tweaks * Update RoomActionsView * Use showConfirmationAlert and showErrorAlert * Remove addTeamMember, update removeTeamMember * Update Alert * Minor tweaks * Minor tweaks * Minor tweak * Update showActionSheet on RoomMembersView * Remove team main from query and move code around * Fetch roles * Update RoomMembersView and SelectListView * Update rocketchat.js * Updated leaveTeam and handleRemoveFromTeam * Fix validation * Remove unnecessary function * Update RoomActionsView * Update en.json * updated deleteTeam function and permissions * Added showConfirmationAlert * Added string translations for teams * Fix permission * Added moveChannelToTeam and convertToTeam functionality * Fix SelectListView RadioButton * Fix moveToTeam * Added searchBar to SelectListVIew * Update RoomView , SelectListVIew and string translation for error * E2E for Teams * Fix tests and cleanup * Minor refactor * Wrong label * Move/convert * Fix convert Co-authored-by: Diego Mello --- .../__snapshots__/Storyshots.test.js.snap | 2 + app/containers/ActionSheet/Item.js | 4 +- app/containers/List/ListIcon.js | 7 +- app/i18n/locales/en.json | 1 - app/presentation/RoomItem/RoomItem.js | 2 +- app/presentation/RoomItem/Tag.js | 6 +- app/views/AddChannelTeamView.js | 2 +- app/views/AddExistingChannelView.js | 4 +- app/views/CreateChannelView.js | 4 +- app/views/RoomActionsView/index.js | 14 +- app/views/RoomMembersView/index.js | 21 +- app/views/SelectListView.js | 4 +- app/views/TeamChannelsView.js | 13 +- e2e/data/data.cloud.js | 10 + e2e/data/data.docker.js | 10 + e2e/helpers/app.js | 4 +- e2e/tests/assorted/05-joinpublicroom.spec.js | 5 - e2e/tests/room/02-room.spec.js | 12 +- e2e/tests/room/03-roomactions.spec.js | 64 ++-- e2e/tests/room/04-discussion.spec.js | 4 - e2e/tests/team/01-createteam.spec.js | 70 ++--- e2e/tests/team/02-team.spec.js | 296 ++++++++++++++++++ e2e/tests/team/03-moveconvert.spec.js | 89 ++++++ 23 files changed, 526 insertions(+), 122 deletions(-) create mode 100644 e2e/tests/team/02-team.spec.js create mode 100644 e2e/tests/team/03-moveconvert.spec.js diff --git a/__tests__/__snapshots__/Storyshots.test.js.snap b/__tests__/__snapshots__/Storyshots.test.js.snap index eec5b535a..52fa5d01d 100644 --- a/__tests__/__snapshots__/Storyshots.test.js.snap +++ b/__tests__/__snapshots__/Storyshots.test.js.snap @@ -58119,6 +58119,7 @@ exports[`Storyshots Room Item Tag 1`] = ` }, ] } + testID="auto-join-tag" > Auto-join @@ -59020,6 +59021,7 @@ exports[`Storyshots Room Item Tag 1`] = ` }, ] } + testID="auto-join-tag" > Auto-join diff --git a/app/containers/ActionSheet/Item.js b/app/containers/ActionSheet/Item.js index aa76da8bb..2cacd0855 100644 --- a/app/containers/ActionSheet/Item.js +++ b/app/containers/ActionSheet/Item.js @@ -18,6 +18,7 @@ export const Item = React.memo(({ item, hide, theme }) => { onPress={onPress} style={[styles.item, { backgroundColor: themes[theme].focusedBackground }]} theme={theme} + testID={item.testID} > @@ -42,7 +43,8 @@ Item.propTypes = { icon: PropTypes.string, danger: PropTypes.bool, onPress: PropTypes.func, - right: PropTypes.func + right: PropTypes.func, + testID: PropTypes.string }), hide: PropTypes.func, theme: PropTypes.string diff --git a/app/containers/List/ListIcon.js b/app/containers/List/ListIcon.js index 5ab6c3bc9..44941f2ca 100644 --- a/app/containers/List/ListIcon.js +++ b/app/containers/List/ListIcon.js @@ -18,13 +18,15 @@ const ListIcon = React.memo(({ theme, name, color, - style + style, + testID }) => ( )); @@ -33,7 +35,8 @@ ListIcon.propTypes = { theme: PropTypes.string, name: PropTypes.string, color: PropTypes.string, - style: PropTypes.object + style: PropTypes.object, + testID: PropTypes.string }; ListIcon.displayName = 'List.Icon'; diff --git a/app/i18n/locales/en.json b/app/i18n/locales/en.json index 090bf5cd0..a8f8d9635 100644 --- a/app/i18n/locales/en.json +++ b/app/i18n/locales/en.json @@ -755,7 +755,6 @@ "Convert_to_Team": "Convert to Team", "Convert_to_Team_Warning": "This can't be undone. Once you convert a channel to a team, you can not turn it back to a channel.", "Move_to_Team": "Move to Team", - "Move_Channel_to_Team": "Move Channel to Team", "Move_Channel_Paragraph": "Moving a channel inside a team means that this channel will be added in the team’s context, however, all channel’s members, which are not members of the respective team, will still have access to this channel, but will not be added as team’s members. \n\nAll channel’s management will still be made by the owners of this channel.\n\nTeam’s members and even team’s owners, if not a member of this channel, can not have access to the channel’s content. \n\nPlease notice that the Team’s owner will be able remove members from the Channel.", "Move_to_Team_Warning": "After reading the previous intructions about this behavior, do you still want to move this channel to the selected team?", "Load_More": "Load More", diff --git a/app/presentation/RoomItem/RoomItem.js b/app/presentation/RoomItem/RoomItem.js index 065e91331..2ac73a0bb 100644 --- a/app/presentation/RoomItem/RoomItem.js +++ b/app/presentation/RoomItem/RoomItem.js @@ -94,7 +94,7 @@ const RoomItem = ({ alert={alert} /> { - autoJoin ? : null + autoJoin ? : null } { +const Tag = React.memo(({ name, testID }) => { const { theme } = useTheme(); return ( @@ -16,6 +16,7 @@ const Tag = React.memo(({ name }) => { styles.tagText, { color: themes[theme].infoText } ]} numberOfLines={1} + testID={testID} > {name} @@ -24,7 +25,8 @@ const Tag = React.memo(({ name }) => { }); Tag.propTypes = { - name: PropTypes.string + name: PropTypes.string, + testID: PropTypes.string }; export default Tag; diff --git a/app/views/AddChannelTeamView.js b/app/views/AddChannelTeamView.js index fdb166caf..76439b412 100644 --- a/app/views/AddChannelTeamView.js +++ b/app/views/AddChannelTeamView.js @@ -51,7 +51,7 @@ const AddChannelTeamView = ({ navigation.navigate('AddExistingChannelView', { teamId, teamChannels })} - testID='add-channel-team-view-create-channel' + testID='add-channel-team-view-add-existing' left={() => } right={() => } theme={theme} diff --git a/app/views/AddExistingChannelView.js b/app/views/AddExistingChannelView.js index c1c94fec8..e7a590a54 100644 --- a/app/views/AddExistingChannelView.js +++ b/app/views/AddExistingChannelView.js @@ -61,7 +61,7 @@ class AddExistingChannelView extends React.Component { options.headerRight = () => selected.length > 0 && ( - + ); @@ -169,7 +169,7 @@ class AddExistingChannelView extends React.Component { title={RocketChat.getRoomTitle(item)} translateTitle={false} onPress={() => this.toggleChannel(item.rid)} - testID='add-existing-channel-view-item' + testID={`add-existing-channel-view-item-${ item.name }`} left={() => } right={() => (isChecked ? : null)} /> diff --git a/app/views/CreateChannelView.js b/app/views/CreateChannelView.js index 54f402c63..78f4ea42a 100644 --- a/app/views/CreateChannelView.js +++ b/app/views/CreateChannelView.js @@ -334,7 +334,7 @@ class CreateChannelView extends React.Component { keyboardVerticalOffset={128} > - + ({ + rid: team.teamId, + t: team.t, + name: team.name + })); navigation.navigate('SelectListView', { title: 'Move_to_Team', infoText: 'Move_Channel_Paragraph', nextAction: () => { navigation.push('SelectListView', { title: 'Select_Team', - data: teamRooms, + data, isRadio: true, isSearch: true, onSearch: onChangeText => this.searchTeam(onChangeText), @@ -554,7 +559,6 @@ class RoomActionsView extends React.Component { confirmationText: I18n.t('Yes_action_it', { action: I18n.t('move') }), onPress: () => this.handleMoveToTeam(selected) }) - }); } }); @@ -795,11 +799,11 @@ class RoomActionsView extends React.Component { ? ( <> this.onPressTouchable({ event: this.moveToTeam })} - testID='room-actions-convert-to-team' + testID='room-actions-move-to-team' left={() => } showActionIndicator /> diff --git a/app/views/RoomMembersView/index.js b/app/views/RoomMembersView/index.js index 5819cf512..5f0deb326 100644 --- a/app/views/RoomMembersView/index.js +++ b/app/views/RoomMembersView/index.js @@ -265,7 +265,8 @@ class RoomMembersView extends React.Component { options.push({ icon: 'ignore', title: I18n.t(isIgnored ? 'Unignore' : 'Ignore'), - onPress: () => this.handleIgnore(selectedUser, !isIgnored) + onPress: () => this.handleIgnore(selectedUser, !isIgnored), + testID: 'action-sheet-ignore-user' }); } @@ -284,7 +285,8 @@ class RoomMembersView extends React.Component { confirmationText: I18n.t(userIsMuted ? 'Unmute' : 'Mute'), onPress: () => this.handleMute(selectedUser) }); - } + }, + testID: 'action-sheet-mute-user' }); } @@ -296,7 +298,8 @@ class RoomMembersView extends React.Component { icon: 'shield-check', title: I18n.t('Owner'), onPress: () => this.handleOwner(selectedUser, !isOwner), - right: () => + right: () => , + testID: 'action-sheet-set-owner' }); } @@ -308,7 +311,8 @@ class RoomMembersView extends React.Component { icon: 'shield-alt', title: I18n.t('Leader'), onPress: () => this.handleLeader(selectedUser, !isLeader), - right: () => + right: () => , + testID: 'action-sheet-set-leader' }); } @@ -320,7 +324,8 @@ class RoomMembersView extends React.Component { icon: 'shield', title: I18n.t('Moderator'), onPress: () => this.handleModerator(selectedUser, !isModerator), - right: () => + right: () => , + testID: 'action-sheet-set-moderator' }); } @@ -330,7 +335,8 @@ class RoomMembersView extends React.Component { icon: 'logout', danger: true, title: I18n.t('Remove_from_Team'), - onPress: () => this.handleRemoveFromTeam(selectedUser) + onPress: () => this.handleRemoveFromTeam(selectedUser), + testID: 'action-sheet-remove-from-team' }); } @@ -346,7 +352,8 @@ class RoomMembersView extends React.Component { confirmationText: I18n.t('Yes_remove_user'), onPress: () => this.handleRemoveUserFromRoom(selectedUser) }); - } + }, + testID: 'action-sheet-remove-from-room' }); } diff --git a/app/views/SelectListView.js b/app/views/SelectListView.js index a3ad3f889..5767df3f2 100644 --- a/app/views/SelectListView.js +++ b/app/views/SelectListView.js @@ -134,8 +134,8 @@ class SelectListView extends React.Component { const icon = item.teamMain ? teamIcon : channelIcon; const checked = this.isChecked(item.rid) ? 'check' : null; - const showRadio = () => ; - const showCheck = () => ; + const showRadio = () => ; + const showCheck = () => ; return ( <> diff --git a/app/views/TeamChannelsView.js b/app/views/TeamChannelsView.js index 15905a9ee..cee7fe13c 100644 --- a/app/views/TeamChannelsView.js +++ b/app/views/TeamChannelsView.js @@ -217,9 +217,9 @@ class TeamChannelsView extends React.Component { options.headerRight = () => ( { showCreate - ? navigation.navigate('AddChannelTeamView', { teamId: this.teamId, teamChannels: data })} /> + ? navigation.navigate('AddChannelTeamView', { teamId: this.teamId, teamChannels: data })} /> : null} - + ); navigation.setOptions(options); @@ -388,7 +388,8 @@ class TeamChannelsView extends React.Component { title: I18n.t('Auto-join'), icon: item.t === 'p' ? 'channel-private' : 'channel-public', onPress: () => this.toggleAutoJoin(item), - right: () => + right: () => , + testID: 'action-sheet-auto-join' }); } @@ -398,7 +399,8 @@ class TeamChannelsView extends React.Component { title: I18n.t('Remove_from_Team'), icon: 'close', danger: true, - onPress: () => this.remove(item) + onPress: () => this.remove(item), + testID: 'action-sheet-remove-from-team' }); } @@ -408,7 +410,8 @@ class TeamChannelsView extends React.Component { title: I18n.t('Delete'), icon: 'delete', danger: true, - onPress: () => this.delete(item) + onPress: () => this.delete(item), + testID: 'action-sheet-delete' }); } diff --git a/e2e/data/data.cloud.js b/e2e/data/data.cloud.js index 381d939f1..c69b72515 100644 --- a/e2e/data/data.cloud.js +++ b/e2e/data/data.cloud.js @@ -42,6 +42,11 @@ const data = { name: `detox-private-${ value }` } }, + teams: { + private: { + name: `detox-team-${ value }` + } + }, registeringUser: { username: `newuser${ value }`, password: `password${ value }`, @@ -57,6 +62,11 @@ const data = { password: `passwordthree${ value }`, email: `mobile+registeringthree${ value }@rocket.chat` }, + registeringUser4: { + username: `newuserfour${ value }`, + password: `passwordfour${ value }`, + email: `mobile+registeringfour${ value }@rocket.chat` + }, random: value } module.exports = data; diff --git a/e2e/data/data.docker.js b/e2e/data/data.docker.js index 77f9f82c0..1a6bb1569 100644 --- a/e2e/data/data.docker.js +++ b/e2e/data/data.docker.js @@ -42,6 +42,11 @@ const data = { name: `detox-private-${ value }` } }, + teams: { + private: { + name: `detox-team-${ value }` + } + }, registeringUser: { username: `newuser${ value }`, password: `password${ value }`, @@ -57,6 +62,11 @@ const data = { password: `passwordthree${ value }`, email: `mobile+registeringthree${ value }@rocket.chat` }, + registeringUser4: { + username: `newuserfour${ value }`, + password: `passwordfour${ value }`, + email: `mobile+registeringfour${ value }@rocket.chat` + }, random: value } module.exports = data; diff --git a/e2e/helpers/app.js b/e2e/helpers/app.js index af72f73d1..7c71c9f3e 100644 --- a/e2e/helpers/app.js +++ b/e2e/helpers/app.js @@ -67,7 +67,7 @@ async function starMessage(message){ 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('Star')).tap(); + await element(by.label('Star')).atIndex(0).tap(); await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000); }; @@ -78,7 +78,7 @@ async function pinMessage(message){ 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('Pin')).tap(); + await element(by.label('Pin')).atIndex(0).tap(); await waitFor(element(by.id('action-sheet'))).not.toExist().withTimeout(5000); } diff --git a/e2e/tests/assorted/05-joinpublicroom.spec.js b/e2e/tests/assorted/05-joinpublicroom.spec.js index 9b92d33b3..15acbda9c 100644 --- a/e2e/tests/assorted/05-joinpublicroom.spec.js +++ b/e2e/tests/assorted/05-joinpublicroom.spec.js @@ -98,10 +98,6 @@ describe('Join public room', () => { 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 expect(element(by.id('room-actions-share'))).toBeVisible(); }); @@ -150,7 +146,6 @@ describe('Join public room', () => { await expect(element(by.id('room-actions-files'))).toBeVisible(); await expect(element(by.id('room-actions-mentioned'))).toBeVisible(); await expect(element(by.id('room-actions-starred'))).toBeVisible(); - await expect(element(by.id('room-actions-search'))).toBeVisible(); await element(by.type('UIScrollView')).atIndex(1).swipe('down'); await expect(element(by.id('room-actions-share'))).toBeVisible(); await expect(element(by.id('room-actions-pinned'))).toBeVisible(); diff --git a/e2e/tests/room/02-room.spec.js b/e2e/tests/room/02-room.spec.js index 820536fb8..02d874963 100644 --- a/e2e/tests/room/02-room.spec.js +++ b/e2e/tests/room/02-room.spec.js @@ -168,7 +168,7 @@ describe('Room screen', () => { 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('Permalink')).tap(); + await element(by.label('Permalink')).atIndex(0).tap(); // TODO: test clipboard }); @@ -178,7 +178,7 @@ describe('Room screen', () => { 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('Copy')).tap(); + await element(by.label('Copy')).atIndex(0).tap(); // TODO: test clipboard }); @@ -191,7 +191,7 @@ describe('Room screen', () => { 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', 'slow', 0.5); - await waitFor(element(by.label('Unstar'))).toBeVisible().withTimeout(6000); + await waitFor(element(by.label('Unstar')).atIndex(0)).toBeVisible().withTimeout(6000); await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.8); }); @@ -243,7 +243,7 @@ describe('Room screen', () => { 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('Edit')).tap(); + await element(by.label('Edit')).atIndex(0).tap(); await element(by.id('messagebox-input')).typeText('ed'); await element(by.id('messagebox-send-message')).tap(); await waitFor(element(by.label(`${ data.random }edited (edited)`)).atIndex(0)).toExist().withTimeout(60000); @@ -255,7 +255,7 @@ describe('Room screen', () => { 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('Quote')).tap(); + await element(by.label('Quote')).atIndex(0).tap(); await element(by.id('messagebox-input')).typeText(`${ data.random }quoted`); await element(by.id('messagebox-send-message')).tap(); @@ -285,7 +285,7 @@ describe('Room screen', () => { await expect(element(by.id('action-sheet-handle'))).toBeVisible(); await element(by.id('action-sheet-handle')).swipe('up', 'fast', 0.5); await waitFor(element(by.label('Delete'))).toExist().withTimeout(1000); - await element(by.label('Delete')).tap(); + await element(by.label('Delete')).atIndex(0).tap(); const deleteAlertMessage = 'You will not be able to recover this message!'; await waitFor(element(by.text(deleteAlertMessage)).atIndex(0)).toExist().withTimeout(10000); diff --git a/e2e/tests/room/03-roomactions.spec.js b/e2e/tests/room/03-roomactions.spec.js index fcfc86711..204235705 100644 --- a/e2e/tests/room/03-roomactions.spec.js +++ b/e2e/tests/room/03-roomactions.spec.js @@ -77,10 +77,6 @@ describe('Room actions screen', () => { await expect(element(by.id('room-actions-starred'))).toExist(); }); - it('should have search', async() => { - await expect(element(by.id('room-actions-search'))).toExist(); - }); - it('should have share', async() => { await waitFor(element(by.id('room-actions-share'))).toExist(); await expect(element(by.id('room-actions-share'))).toExist(); @@ -147,10 +143,6 @@ describe('Room actions screen', () => { await expect(element(by.id('room-actions-starred'))).toExist(); }); - it('should have search', async() => { - await expect(element(by.id('room-actions-search'))).toExist(); - }); - it('should have share', async() => { await waitFor(element(by.id('room-actions-share'))).toExist(); await expect(element(by.id('room-actions-share'))).toExist(); @@ -229,7 +221,7 @@ describe('Room actions screen', () => { await element(by.label(`${ data.random }messageToStar`)).atIndex(0).longPress(); await expect(element(by.id('action-sheet'))).toExist(); await expect(element(by.id('action-sheet-handle'))).toBeVisible(); - await element(by.label('Unstar')).tap(); + await element(by.label('Unstar')).atIndex(0).tap(); await waitFor(element(by.label(`${ data.random }messageToStar`).withAncestor(by.id('starred-messages-view')))).toBeNotVisible().withTimeout(60000); await backToActions(); @@ -256,29 +248,29 @@ describe('Room actions screen', () => { await expect(element(by.id('action-sheet'))).toExist(); await expect(element(by.id('action-sheet-handle'))).toBeVisible(); - await element(by.label('Unpin')).tap(); + await element(by.label('Unpin')).atIndex(0).tap(); await waitFor(element(by.label(`${ data.random }messageToPin`).withAncestor(by.id('pinned-messages-view')))).not.toExist().withTimeout(6000); await backToActions(); }); - it('should search and find a message', async() => { + // it('should search and find a message', async() => { - //Go back to room and send a message - await tapBack(); - await mockMessage('messageToFind'); + // //Go back to room and send a message + // await tapBack(); + // await mockMessage('messageToFind'); - //Back into Room Actions - await element(by.id('room-header')).tap(); - await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000); + // //Back into Room Actions + // await element(by.id('room-header')).tap(); + // await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000); - 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'))).toExist(); - 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); - await backToActions(); - }); + // 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'))).toExist(); + // 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); + // await backToActions(); + // }); }); describe('Notification', async() => { @@ -419,46 +411,46 @@ describe('Room actions screen', () => { it('should set/remove as owner', async() => { await openActionSheet(user.username); - await element(by.label('Set as owner')).tap(); + await element(by.id('action-sheet-set-owner')).tap(); await waitForToast(); await openActionSheet(user.username); - await element(by.label('Remove as owner')).tap(); + await waitFor(element(by.id('action-sheet-set-owner-checked'))).toBeVisible().withTimeout(6000); + await element(by.id('action-sheet-set-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 waitFor(element(by.id('action-sheet-set-owner-unchecked'))).toBeVisible().withTimeout(60000); await closeActionSheet(); }); it('should set/remove as leader', async() => { await openActionSheet(user.username); - await element(by.label('Set as leader')).tap(); + await element(by.id('action-sheet-set-leader')).tap(); await waitForToast(); await openActionSheet(user.username); - await element(by.label('Remove as leader')).tap(); + await waitFor(element(by.id('action-sheet-set-leader-checked'))).toBeVisible().withTimeout(6000); + await element(by.id('action-sheet-set-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 waitFor(element(by.id('action-sheet-set-owner-unchecked'))).toBeVisible().withTimeout(60000); await closeActionSheet(); }); it('should set/remove as moderator', async() => { await openActionSheet(user.username); - await element(by.label('Set as moderator')).tap(); + await element(by.id('action-sheet-set-moderator')).tap(); await waitForToast(); await openActionSheet(user.username); - await element(by.label('Remove as moderator')).tap(); + await waitFor(element(by.id('action-sheet-set-moderator-checked'))).toBeVisible().withTimeout(6000); + await element(by.id('action-sheet-set-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 waitFor(element(by.id('action-sheet-set-moderator-unchecked'))).toBeVisible().withTimeout(60000); await closeActionSheet(); }); diff --git a/e2e/tests/room/04-discussion.spec.js b/e2e/tests/room/04-discussion.spec.js index e5705b26b..fccc96185 100644 --- a/e2e/tests/room/04-discussion.spec.js +++ b/e2e/tests/room/04-discussion.spec.js @@ -102,10 +102,6 @@ describe('Discussion', () => { 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 element(by.type('UIScrollView')).atIndex(1).swipe('up'); await expect(element(by.id('room-actions-share'))).toBeVisible(); diff --git a/e2e/tests/team/01-createteam.spec.js b/e2e/tests/team/01-createteam.spec.js index 4dfe17ca3..3c9a2260c 100644 --- a/e2e/tests/team/01-createteam.spec.js +++ b/e2e/tests/team/01-createteam.spec.js @@ -2,9 +2,9 @@ const { device, expect, element, by, waitFor } = require('detox'); const data = require('../../data'); -const { tapBack, sleep, navigateToLogin, login, tryTapping } = require('../../helpers/app'); - +const { navigateToLogin, login } = require('../../helpers/app'); +const teamName = `team-${ data.random }`; describe('Create team screen', () => { before(async() => { @@ -18,38 +18,18 @@ describe('Create team screen', () => { await element(by.id('rooms-list-view-create-channel')).tap(); }); - describe('Render', async() => { - it('should have team button', async() => { - await waitFor(element(by.id('new-message-view-create-channel'))).toBeVisible().withTimeout(2000); - }); - }) + it('should have team button', async() => { + await waitFor(element(by.id('new-message-view-create-team'))).toBeVisible().withTimeout(2000); + }); - describe('Usage', async() => { - it('should navigate to select users', async() => { - await element(by.id('new-message-view-create-channel')).tap(); - await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000); - }); - }) + it('should navigate to select users', async() => { + await element(by.id('new-message-view-create-team')).tap(); + await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000); + }); }); describe('Select Users', async() => { - it('should search users', async() => { - await element(by.id('select-users-view-search')).replaceText('rocket.cat'); - await waitFor(element(by.id(`select-users-view-item-rocket.cat`))).toBeVisible().withTimeout(10000); - }); - - it('should select/unselect user', async() => { - // Spotlight issues - await element(by.id('select-users-view-item-rocket.cat')).tap(); - await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000); - await element(by.id('selected-user-rocket.cat')).tap(); - await waitFor(element(by.id('selected-user-rocket.cat'))).toBeNotVisible().withTimeout(10000); - // Spotlight issues - await element(by.id('select-users-view-item-rocket.cat')).tap(); - await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000); - }); - - it('should create team', async() => { + it('should nav to create team', async() => { await element(by.id('selected-users-view-submit')).tap(); await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000); }); @@ -64,19 +44,33 @@ describe('Create team screen', () => { }); it('should create private team', async() => { - const room = `private${ data.random }`; await element(by.id('create-channel-name')).replaceText(''); - await element(by.id('create-channel-name')).typeText(room); + await element(by.id('create-channel-name')).typeText(teamName); await element(by.id('create-channel-submit')).tap(); await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000); await expect(element(by.id('room-view'))).toExist(); - await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(6000); - await expect(element(by.id(`room-view-title-${ room }`))).toExist(); - await tapBack(); - await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(10000); - await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(6000); - await expect(element(by.id(`rooms-list-view-item-${ room }`))).toExist(); + await waitFor(element(by.id(`room-view-title-${ teamName }`))).toExist().withTimeout(6000); + await expect(element(by.id(`room-view-title-${ teamName }`))).toExist(); }); }) }); + + describe('Delete Team', async() => { + it('should navigate to room info edit view', async() => { + await element(by.id('room-header')).tap(); + await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000); + await element(by.id('room-actions-info')).tap(); + await waitFor(element(by.id('room-info-view'))).toExist().withTimeout(2000); + }); + + it('should delete team', async() => { + await element(by.id('room-info-view-edit-button')).tap(); + await element(by.id('room-info-edit-view-list')).swipe('up', 'fast', 0.5); + await element(by.id('room-info-edit-view-delete')).tap(); + await waitFor(element(by.text('Yes, delete it!'))).toExist().withTimeout(5000); + await element(by.text('Yes, delete it!')).tap(); + await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(10000); + await waitFor(element(by.id(`rooms-list-view-item-${ teamName }`))).toBeNotVisible().withTimeout(60000); + }); + }); }); diff --git a/e2e/tests/team/02-team.spec.js b/e2e/tests/team/02-team.spec.js new file mode 100644 index 000000000..f6f4d0329 --- /dev/null +++ b/e2e/tests/team/02-team.spec.js @@ -0,0 +1,296 @@ +const { + device, expect, element, by, waitFor +} = require('detox'); +const data = require('../../data'); +const { navigateToLogin, login, tapBack, sleep, searchRoom } = require('../../helpers/app'); + +async function navigateToRoom(roomName) { + await searchRoom(`${ roomName }`); + await element(by.id(`rooms-list-view-item-${ roomName }`)).tap(); + await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000); +} + +async function openActionSheet(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(); +} + +async function navigateToRoomActions() { + await waitFor(element(by.id('room-view'))).toExist().withTimeout(2000); + await element(by.id('room-header')).tap(); + await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000); +} + +async function backToActions() { + await tapBack(); + await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000); +} +async function closeActionSheet() { + await element(by.id('action-sheet-handle')).swipe('down', 'fast', 0.6); +} + +async function waitForToast() { + await sleep(1000); +} + +describe('Team', () => { + const team = data.teams.private.name; + const user = data.users.alternate; + const room = `private${ data.random }`; + const existingRoom = data.groups.private.name; + + before(async() => { + await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); + await navigateToLogin(); + await login(data.users.regular.username, data.users.regular.password); + await navigateToRoom(team); + }); + + describe('Team Room', async() => { + describe('Team Header', async() => { + it('should have actions button ', async() => { + await expect(element(by.id('room-header'))).toExist(); + }); + + it('should have team channels button ', async() => { + await expect(element(by.id('room-view-header-team-channels'))).toExist(); + }); + + it('should have threads button ', async() => { + await expect(element(by.id('room-view-header-threads'))).toExist(); + }); + + + it('should have threads button ', async() => { + await expect(element(by.id('room-view-search'))).toExist(); + }); + }); + + describe('Team Header Usage', async() => { + it('should navigate to team channels view', async() => { + await element(by.id('room-view-header-team-channels')).tap(); + await waitFor(element(by.id('team-channels-view'))).toExist().withTimeout(5000); + }); + }) + + describe('Team Channels Header', async() => { + it('should have actions button ', async() => { + await expect(element(by.id('room-header'))).toExist(); + }); + + it('should have team channels button ', async() => { + await expect(element(by.id('team-channels-view-create'))).toExist(); + }); + + it('should have threads button ', async() => { + await expect(element(by.id('team-channels-view-search'))).toExist(); + }); + }); + + describe('Team Channels Header Usage', async() => { + it('should navigate to add team channels view', async() => { + await element(by.id('team-channels-view-create')).tap(); + await waitFor(element(by.id('add-channel-team-view'))).toExist().withTimeout(5000); + }); + + it('should have create new button', async() => { + await waitFor(element(by.id('add-channel-team-view-create-channel'))).toExist().withTimeout(5000); + }); + + it('should add existing button', async() => { + await waitFor(element(by.id('add-channel-team-view-add-existing'))).toExist().withTimeout(5000); + }); + }) + + describe('Channels', async() => { + it('should create new channel for team', async() => { + + await element(by.id('add-channel-team-view-create-channel')).tap(); + + await element(by.id('select-users-view-search')).replaceText('rocket.cat'); + await element(by.id('select-users-view-item-rocket.cat')).tap(); + await waitFor(element(by.id('selected-user-rocket.cat'))).toBeVisible().withTimeout(10000); + await element(by.id('selected-users-view-submit')).tap(); + + await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000); + await element(by.id('create-channel-name')).replaceText(''); + await element(by.id('create-channel-name')).typeText(room); + await element(by.id('create-channel-submit')).tap(); + + await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000); + await expect(element(by.id('room-view'))).toExist(); + await expect(element(by.id('room-view-header-team-channels'))).toExist(); + await element(by.id('room-view-header-team-channels')).tap(); + + await waitFor(element(by.id('team-channels-view'))).toExist().withTimeout(5000); + await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(6000); + await expect(element(by.id(`rooms-list-view-item-${ room }`))).toExist(); + await element(by.id(`rooms-list-view-item-${ room }`)).tap(); + await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(60000); + await expect(element(by.id(`room-view-title-${ room }`))).toExist(); + await expect(element(by.id('room-view-header-team-channels'))).toExist(); + await expect(element(by.id('room-view-header-threads'))).toExist(); + await expect(element(by.id('room-view-search'))).toExist(); + await tapBack(); + }); + + it('should add existing channel to team', async() => { + + await element(by.id('team-channels-view-create')).tap(); + await waitFor(element(by.id('add-channel-team-view'))).toExist().withTimeout(5000); + + await element(by.id('add-channel-team-view-add-existing')).tap(); + await waitFor(element(by.id('add-existing-channel-view'))).toExist().withTimeout(60000) + await expect(element(by.id(`add-existing-channel-view-item-${ existingRoom }`))).toExist(); + await element(by.id(`add-existing-channel-view-item-${ existingRoom }`)).tap(); + await waitFor(element(by.id('add-existing-channel-view-submit'))).toExist().withTimeout(6000); + await element(by.id('add-existing-channel-view-submit')).tap(); + + await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000); + await expect(element(by.id('room-view'))).toExist(); + await expect(element(by.id('room-view-header-team-channels'))).toExist(); + await element(by.id('room-view-header-team-channels')).tap(); + + await waitFor(element(by.id(`rooms-list-view-item-${ existingRoom }`))).toExist().withTimeout(10000); + }); + + it('should activate/deactivate auto-join to channel', async() => { + await element(by.id(`rooms-list-view-item-${ existingRoom }`)).atIndex(0).longPress(); + + await waitFor(element(by.id('action-sheet-auto-join'))).toBeVisible().withTimeout(5000); + await waitFor(element(by.id('auto-join-unchecked'))).toBeVisible().withTimeout(5000); + await waitFor(element(by.id('action-sheet-remove-from-team'))).toBeVisible().withTimeout(5000); + await waitFor(element(by.id('action-sheet-delete'))).toBeVisible().withTimeout(5000); + + await element(by.id('auto-join-unchecked')).tap(); + await waitFor(element(by.id('auto-join-tag'))).toBeVisible().withTimeout(5000); + await element(by.id(`rooms-list-view-item-${ existingRoom }`)).atIndex(0).longPress(); + + await waitFor(element(by.id('auto-join-checked'))).toBeVisible().withTimeout(5000); + await element(by.id('auto-join-checked')).tap(); + await waitFor(element(by.id('auto-join-tag'))).toBeNotVisible().withTimeout(5000); + await waitFor(element(by.id(`rooms-list-view-item-${ existingRoom }`))).toExist().withTimeout(6000); + }); + }) + + describe('Team actions', () => { + before(async() => { + await tapBack(); + await navigateToRoomActions(); + }); + + it('should add users to the team', async() => { + await waitFor(element(by.id('room-actions-add-user'))).toExist().withTimeout(10000); + await element(by.id('room-actions-add-user')).tap(); + + const rocketCat = 'rocket.cat'; + await element(by.id('select-users-view-search')).replaceText('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); + + await waitFor(element(by.id('select-users-view-search'))).toExist().withTimeout(4000); + await element(by.id('select-users-view-search')).tap(); + await element(by.id('select-users-view-search')).replaceText(user.username); + await waitFor(element(by.id(`select-users-view-item-${ user.username }`))).toExist().withTimeout(10000); + await element(by.id(`select-users-view-item-${ user.username }`)).tap(); + await waitFor(element(by.id(`selected-user-${ user.username }`))).toExist().withTimeout(5000); + + await element(by.id('selected-users-view-submit')).tap(); + await sleep(300); + await waitFor(element(by.id('room-actions-members'))).toExist().withTimeout(10000); + 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-${ user.username }`))).toExist().withTimeout(60000); + await backToActions(); + }); + + it('should try to leave to leave team and raise alert', async() => { + await element(by.id('room-actions-scrollview')).scrollTo('bottom'); + await waitFor(element(by.id('room-actions-leave-channel'))).toExist().withTimeout(2000); + await element(by.id('room-actions-leave-channel')).tap(); + + await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id(`select-list-view-item-${room}`))).toExist().withTimeout(2000); + await waitFor(element(by.id(`select-list-view-item-${existingRoom}`))).toExist().withTimeout(2000); + await element(by.id(`select-list-view-item-${room}`)).tap(); + + await waitFor(element(by.label('You are the last owner of this channel. Once you leave the team, the channel will be kept inside the team but you will be managing it from outside.'))).toExist().withTimeout(2000); + await element(by.text('OK')).tap(); + await waitFor(element(by.id('select-list-view-submit'))).toExist().withTimeout(2000); + await element(by.id('select-list-view-submit')).tap(); + await waitFor(element(by.text('Last owner cannot be removed'))).toExist().withTimeout(8000); + await element(by.text('OK')).tap(); + await tapBack(); + await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(2000); + }); + + 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); + }); + + it('should show all users', async() => { + await element(by.id('room-members-view-toggle-status')).tap(); + await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000); + }); + + it('should filter user', async() => { + await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toExist().withTimeout(60000); + await element(by.id('room-members-view-search')).replaceText('rocket'); + await waitFor(element(by.id(`room-members-view-item-${ user.username }`))).toBeNotVisible().withTimeout(60000); + 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); + }); + + it('should remove member from team', async() => { + await openActionSheet('rocket.cat'); + await element(by.id('action-sheet-remove-from-team')).tap(); + await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(5000); + await waitFor(element(by.id(`select-list-view-item-${ room }`))).toExist().withTimeout(5000); + await element(by.id(`select-list-view-item-${ room }`)).tap(); + await waitFor(element(by.id(`${ room }-checked`))).toExist().withTimeout(5000); + await element(by.id(`select-list-view-item-${ room }`)).tap(); + await waitFor(element(by.id(`${ room }-unchecked`))).toExist().withTimeout(5000); + await element(by.id('select-list-view-submit')).tap(); + await waitFor(element(by.id('room-members-view-item-rocket.cat'))).toBeNotVisible().withTimeout(60000); + }); + + it('should set member as owner', async() => { + await openActionSheet(user.username); + await element(by.id('action-sheet-set-owner')).tap(); + await waitForToast(); + + await openActionSheet(user.username); + await waitFor(element(by.id('action-sheet-set-owner-checked'))).toBeVisible().withTimeout(6000); + await closeActionSheet(); + }); + + it('should leave team', async() => { + await tapBack(); + await element(by.id('room-actions-scrollview')).scrollTo('bottom'); + await waitFor(element(by.id('room-actions-leave-channel'))).toExist().withTimeout(2000); + await element(by.id('room-actions-leave-channel')).tap(); + + await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id(`select-list-view-item-${room}`))).toExist().withTimeout(2000); + await waitFor(element(by.id(`select-list-view-item-${existingRoom}`))).toExist().withTimeout(2000); + await element(by.id(`select-list-view-item-${room}`)).tap(); + + await waitFor(element(by.label('You are the last owner of this channel. Once you leave the team, the channel will be kept inside the team but you will be managing it from outside.'))).toExist().withTimeout(2000); + await element(by.text('OK')).tap(); + await waitFor(element(by.id('select-list-view-submit'))).toExist().withTimeout(2000); + await element(by.id('select-list-view-submit')).tap(); + await waitFor(element(by.text(`You were removed from ${ team }`))).toExist().withTimeout(8000); + await element(by.text('OK')).tap(); + await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(5000); + }); + }); + }); + }); +}); \ No newline at end of file diff --git a/e2e/tests/team/03-moveconvert.spec.js b/e2e/tests/team/03-moveconvert.spec.js new file mode 100644 index 000000000..17143c609 --- /dev/null +++ b/e2e/tests/team/03-moveconvert.spec.js @@ -0,0 +1,89 @@ +const { + device, expect, element, by, waitFor +} = require('detox'); +const data = require('../../data'); +const { navigateToLogin, login, tapBack, searchRoom, sleep } = require('../../helpers/app'); + +const toBeConverted = `to-be-converted-${ data.random }`; +const toBeMoved = `to-be-moved-${ data.random }`; + +const createChannel = async(room) => { + await element(by.id('rooms-list-view-create-channel')).tap(); + await waitFor(element(by.id('new-message-view'))).toExist().withTimeout(5000); + await element(by.id('new-message-view-create-channel')).tap(); + await waitFor(element(by.id('select-users-view'))).toExist().withTimeout(5000); + await element(by.id('selected-users-view-submit')).tap(); + await waitFor(element(by.id('create-channel-view'))).toExist().withTimeout(10000); + await element(by.id('create-channel-name')).typeText(room); + await element(by.id('create-channel-submit')).tap(); + await waitFor(element(by.id('room-view'))).toExist().withTimeout(60000); + await waitFor(element(by.id(`room-view-title-${ room }`))).toExist().withTimeout(60000); + await tapBack(); + await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id(`rooms-list-view-item-${ room }`))).toExist().withTimeout(60000); +} + +async function navigateToRoom(room) { + await searchRoom(`${ room }`); + await element(by.id(`rooms-list-view-item-${ room }`)).tap(); + await waitFor(element(by.id('room-view'))).toBeVisible().withTimeout(5000); +} + +async function navigateToRoomActions(room) { + await navigateToRoom(room); + await element(by.id('room-header')).tap(); + await waitFor(element(by.id('room-actions-view'))).toExist().withTimeout(5000); +} + +describe('Move/Convert Team', () => { + before(async() => { + await device.launchApp({ permissions: { notifications: 'YES' }, delete: true }); + await navigateToLogin(); + await login(data.users.regular.username, data.users.regular.password); + }); + + describe('Convert', async() => { + before(async() => { + await createChannel(toBeConverted); + }); + + it('should convert channel to a team', async() => { + await navigateToRoomActions(toBeConverted); + await element(by.id('room-actions-scrollview')).scrollTo('bottom'); + await waitFor(element(by.id('room-actions-convert-to-team'))).toExist().withTimeout(2000); + await element(by.id('room-actions-convert-to-team')).tap(); + await waitFor(element(by.label('This can\'t be undone. Once you convert a channel to a team, you can not turn it back to a channel.'))).toExist().withTimeout(2000); + await element(by.text('Convert')).tap(); + await waitFor(element(by.id('room-view'))).toExist().withTimeout(20000); + await waitFor(element(by.id(`room-view-title-${ toBeConverted }`))).toExist().withTimeout(6000); + }); + + after(async() => { + await tapBack(); + await waitFor(element(by.id('rooms-list-view'))).toExist().withTimeout(2000); + }) + }); + + describe('Move', async() => { + before(async() => { + await createChannel(toBeMoved); + }); + + it('should move channel to a team', async() => { + await navigateToRoomActions(toBeMoved); + await element(by.id('room-actions-scrollview')).scrollTo('bottom'); + await waitFor(element(by.id('room-actions-move-to-team'))).toExist().withTimeout(2000); + await element(by.id('room-actions-move-to-team')).tap(); + await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000); + await element(by.id('select-list-view-submit')).tap(); + await sleep(2000); + await waitFor(element(by.id('select-list-view'))).toExist().withTimeout(2000); + await waitFor(element(by.id(`select-list-view-item-${toBeConverted}`))).toExist().withTimeout(2000); + await element(by.id(`select-list-view-item-${toBeConverted}`)).tap(); + await element(by.id('select-list-view-submit')).atIndex(0).tap(); + await waitFor(element(by.label('After reading the previous intructions about this behavior, do you still want to move this channel to the selected team?'))).toExist().withTimeout(2000); + await element(by.text('Yes, move it!')).tap(); + await waitFor(element(by.id('room-view-header-team-channels'))).toExist().withTimeout(10000); + }); + }) +});