diff --git a/app/components/edit_channel_info/index.js b/app/components/edit_channel_info/index.js index 8a545f1b3..4952d8237 100644 --- a/app/components/edit_channel_info/index.js +++ b/app/components/edit_channel_info/index.js @@ -279,6 +279,7 @@ export default class EditChannelInfo extends PureComponent { onPress={() => { this.onTypeSelect(General.OPEN_CHANNEL); }} + testID='edit_channel_info.type.public.action' > { this.onTypeSelect(General.PRIVATE_CHANNEL); }} + testID='edit_channel_info.type.private.action' > { + switch (type) { + case CategoryTypes.UNREADS: + return CategoryTypes.UNREADS.toLowerCase(); + case CategoryTypes.FAVORITES: + return CategoryTypes.FAVORITES.toLowerCase(); + case CategoryTypes.CHANNELS: + return CategoryTypes.CHANNELS.toLowerCase(); + case CategoryTypes.DIRECT_MESSAGES: + return CategoryTypes.DIRECT_MESSAGES.toLowerCase(); + default: + return name.replaceAll(' ', '_').toLowerCase(); + } + }; + const header = ( {(type !== CategoryTypes.UNREADS && data.length > 0) && @@ -434,7 +449,7 @@ export default class List extends PureComponent { - {action && this.renderSectionAction(styles, action, anchor, id)} + {action && this.renderSectionAction(styles, action, anchor, categoryId())} ); diff --git a/detox/e2e/support/ui/component/bottom_sheet.js b/detox/e2e/support/ui/component/bottom_sheet.js index cb2cdc880..1e741ed9f 100644 --- a/detox/e2e/support/ui/component/bottom_sheet.js +++ b/detox/e2e/support/ui/component/bottom_sheet.js @@ -14,7 +14,10 @@ class BottomSheet { copyHeaderOption = isAndroid() ? element(by.text('Copy Header')) : element(by.label('Copy Header')).atIndex(0); copyPurposeOption = isAndroid() ? element(by.text('Copy Purpose')) : element(by.label('Copy Purpose')).atIndex(0); copyUrlOption = isAndroid() ? element(by.text('Copy URL')) : element(by.label('Copy URL')).atIndex(0); + createOption = isAndroid() ? element(by.text('Create')) : element(by.label('Create')).atIndex(0); doNotDisturbOption = isAndroid() ? element(by.text('Do Not Disturb')) : element(by.label('Do No Disturb')).atIndex(0); + moreChannelsOption = isAndroid() ? element(by.text('More Channels')) : element(by.label('More Channels')).atIndex(0); + newConversationOption = isAndroid() ? element(by.text('New Conversation')) : element(by.label('New Conversation')).atIndex(0); offlineOption = isAndroid() ? element(by.text('Offline')) : element(by.label('Offline')).atIndex(0); onlineOption = isAndroid() ? element(by.text('Online')) : element(by.label('Online')).atIndex(0); publicChannelsOption = isAndroid() ? element(by.text('Public Channels')) : element(by.label('Public Channels')).atIndex(0); diff --git a/detox/e2e/support/ui/component/edit_channel_info.js b/detox/e2e/support/ui/component/edit_channel_info.js index f3c7c0b6e..fa3b28b29 100644 --- a/detox/e2e/support/ui/component/edit_channel_info.js +++ b/detox/e2e/support/ui/component/edit_channel_info.js @@ -3,11 +3,15 @@ class EditChannelInfo { testID = { + publicChannelTypeAction: 'edit_channel_info.type.public.action', + privateChannelTypeAction: 'edit_channel_info.type.private.action', nameInput: 'edit_channel_info.name.input', purposeInput: 'edit_channel_info.purpose.input', headerInput: 'edit_channel_info.header.input', } + publicChannelTypeAction = element(by.id(this.testID.publicChannelTypeAction)); + privateChannelTypeAction = element(by.id(this.testID.privateChannelTypeAction)); nameInput = element(by.id(this.testID.nameInput)); purposeInput = element(by.id(this.testID.purposeInput)); headerInput = element(by.id(this.testID.headerInput)); diff --git a/detox/e2e/support/ui/component/main_sidebar.js b/detox/e2e/support/ui/component/main_sidebar.js index ef98d4109..51f433c3f 100644 --- a/detox/e2e/support/ui/component/main_sidebar.js +++ b/detox/e2e/support/ui/component/main_sidebar.js @@ -7,15 +7,15 @@ import TeamsList from './teams_list'; class MainSidebar { testID = { mainSidebar: 'main.sidebar', - openMoreChannelsButton: 'action_button_sidebar.channels', - openCreatePrivateChannelButton: 'action_button_sidebar.pg', - openMoreDirectMessagesButton: 'action_button_sidebar.direct', + channelsActionButton: 'action_button_channels', + directMessagesActionButton: 'action_button_direct_messages', + favoritesActionButton: 'action_button_favorites', } mainSidebar = element(by.id(this.testID.mainSidebar)); - openMoreChannelsButton = element(by.id(this.testID.openMoreChannelsButton)); - openCreatePrivateChannelButton = element(by.id(this.testID.openCreatePrivateChannelButton)); - openMoreDirectMessagesButton = element(by.id(this.testID.openMoreDirectMessagesButton)); + channelsActionButton = element(by.id(this.testID.channelsActionButton)); + directMessagesActionButton = element(by.id(this.testID.directMessagesActionButton)); + favoritesActionButton = element(by.id(this.testID.favoritesActionButton)); // convenience props searchBar = ChannelsList.searchBar; diff --git a/detox/e2e/support/ui/screen/create_channel.js b/detox/e2e/support/ui/screen/create_channel.js index 2b7c8024e..7f811b119 100644 --- a/detox/e2e/support/ui/screen/create_channel.js +++ b/detox/e2e/support/ui/screen/create_channel.js @@ -1,7 +1,11 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import {EditChannelInfo} from '@support/ui/component'; +import { + BottomSheet, + EditChannelInfo, + MainSidebar, +} from '@support/ui/component'; class CreateChannelScreen { testID = { @@ -15,6 +19,8 @@ class CreateChannelScreen { backButton = element(by.id(this.testID.backButton)); // convenience props + publicChannelTypeAction = EditChannelInfo.publicChannelTypeAction; + privateChannelTypeAction = EditChannelInfo.privateChannelTypeAction; nameInput = EditChannelInfo.nameInput; purposeInput = EditChannelInfo.purposeInput; headerInput = EditChannelInfo.headerInput; @@ -25,6 +31,14 @@ class CreateChannelScreen { return this.createChannelScreen; } + open = async () => { + // # Open create channel screen + await MainSidebar.channelsActionButton.tap(); + await BottomSheet.createOption.tap(); + + return this.toBeVisible(); + } + back = async () => { await this.backButton.tap(); await expect(this.createChannelScreen).not.toBeVisible(); diff --git a/detox/e2e/support/ui/screen/more_channels.js b/detox/e2e/support/ui/screen/more_channels.js index a05269252..3cb97a29d 100644 --- a/detox/e2e/support/ui/screen/more_channels.js +++ b/detox/e2e/support/ui/screen/more_channels.js @@ -66,7 +66,8 @@ class MoreChannelsScreen { open = async () => { // # Open more channels screen - await MainSidebar.openMoreChannelsButton.tap(); + await MainSidebar.channelsActionButton.tap(); + await BottomSheet.moreChannelsOption.tap(); return this.toBeVisible(); } diff --git a/detox/e2e/support/ui/screen/more_direct_messages.js b/detox/e2e/support/ui/screen/more_direct_messages.js index fce835a6c..1a45b4053 100644 --- a/detox/e2e/support/ui/screen/more_direct_messages.js +++ b/detox/e2e/support/ui/screen/more_direct_messages.js @@ -74,7 +74,7 @@ class MoreDirectMessagesScreen { open = async () => { // # Open more direct messages screen - await MainSidebar.openMoreDirectMessagesButton.tap(); + await MainSidebar.directMessagesActionButton.tap(); return this.toBeVisible(); } diff --git a/detox/e2e/support/utils/email.js b/detox/e2e/support/utils/email.js index f5cd347af..75800a985 100644 --- a/detox/e2e/support/utils/email.js +++ b/detox/e2e/support/utils/email.js @@ -80,7 +80,6 @@ export const getMentionEmailTemplate = (sender, message, postId, siteName, teamN '', `@${sender}`, '', - '', channelDisplayName, '', message, diff --git a/detox/e2e/test/account_settings/language_settings.e2e.js b/detox/e2e/test/account_settings/language_settings.e2e.js index 3bf268896..a4f49b2ed 100644 --- a/detox/e2e/test/account_settings/language_settings.e2e.js +++ b/detox/e2e/test/account_settings/language_settings.e2e.js @@ -29,7 +29,7 @@ describe('Language Settings', () => { await ChannelScreen.logout(); }); - it('MM-T304 no crash when setting language to zh-TW (Chinese Traditional)', async () => { // related issue https://mattermost.atlassian.net/browse/MM-35329 + xit('MM-T304 no crash when setting language to zh-TW (Chinese Traditional)', async () => { // related issue https://mattermost.atlassian.net/browse/MM-35329 // # Set user's locale await User.apiPatchUser(testUser.id, {locale: 'zh-TW'}); diff --git a/detox/e2e/test/channels/archived_channels.e2e.js b/detox/e2e/test/channels/archived_channels.e2e.js index b1c93342d..7998b2e32 100644 --- a/detox/e2e/test/channels/archived_channels.e2e.js +++ b/detox/e2e/test/channels/archived_channels.e2e.js @@ -62,7 +62,7 @@ describe('Archived Channels', () => { // * Verify favorites section and favorited archived channel are not displayed await openMainSidebar(); - await expect(element(by.text('FAVORITE CHANNELS'))).not.toBeVisible(); + await expect(element(by.text('FAVORITES'))).not.toBeVisible(); await expect(element(by.text(favoritedChannel.display_name))).not.toBeVisible(); // # Close main sidebar diff --git a/detox/e2e/test/channels/channels_list.e2e.js b/detox/e2e/test/channels/channels_list.e2e.js index 035bdf1a0..44548f6e9 100644 --- a/detox/e2e/test/channels/channels_list.e2e.js +++ b/detox/e2e/test/channels/channels_list.e2e.js @@ -58,38 +58,54 @@ describe('Channels List', () => { let testUser; beforeAll(async () => { - const {user, channel, team} = await Setup.apiInit({channelOptions: {prefix: `channel-${searchTerm}`}}); + const {user, channel, team} = await Setup.apiInit({channelOptions: {prefix: `5-unread-${searchTerm}`}}); testUser = user; unreadChannel = channel; testTeam = team; - - testMessage = `Mention @${user.username}`; + testMessage = `Mention @${testUser.username}`; await Post.apiCreatePost({ channelId: unreadChannel.id, message: testMessage, + createAt: Date.now(), }); ({channel: favoriteChannel} = await Channel.apiCreateChannel({type: 'O', prefix: `4-favorite-${searchTerm}`, teamId: testTeam.id})); - await Channel.apiAddUserToChannel(user.id, favoriteChannel.id); - await Preference.apiSaveFavoriteChannelPreference(user.id, favoriteChannel.id); + await Channel.apiAddUserToChannel(testUser.id, favoriteChannel.id); + await Preference.apiSaveFavoriteChannelPreference(testUser.id, favoriteChannel.id); + await Post.apiCreatePost({ + channelId: favoriteChannel.id, + message: testMessage, + createAt: Date.now(), + }); ({channel: publicChannel} = await Channel.apiCreateChannel({type: 'O', prefix: `3-public-${searchTerm}`, teamId: testTeam.id})); - await Channel.apiAddUserToChannel(user.id, publicChannel.id); + await Channel.apiAddUserToChannel(testUser.id, publicChannel.id); + await Post.apiCreatePost({ + channelId: publicChannel.id, + message: testMessage, + createAt: Date.now(), + }); ({channel: privateChannel} = await Channel.apiCreateChannel({type: 'P', prefix: `2-private-${searchTerm}`, teamId: testTeam.id})); - await Channel.apiAddUserToChannel(user.id, privateChannel.id); + await Channel.apiAddUserToChannel(testUser.id, privateChannel.id); + await Post.apiCreatePost({ + channelId: privateChannel.id, + message: testMessage, + createAt: Date.now(), + }); - ({channel: nonJoinedChannel} = await Channel.apiCreateChannel({type: 'O', prefix: `1-non-joined-${searchTerm}`, teamId: testTeam.id})); - - ({user: dmOtherUser} = await User.apiCreateUser({prefix: `user-${searchTerm}-1`})); + ({user: dmOtherUser} = await User.apiCreateUser({prefix: `1-dm-user-${searchTerm}`})); await Team.apiAddUserToTeam(dmOtherUser.id, testTeam.id); - ({channel: directMessageChannel} = await Channel.apiCreateDirectChannel([user.id, dmOtherUser.id])); + ({channel: directMessageChannel} = await Channel.apiCreateDirectChannel([testUser.id, dmOtherUser.id])); await Post.apiCreatePost({ channelId: directMessageChannel.id, message: testMessage, + createAt: Date.now(), }); - ({user: nonDmOtherUser} = await User.apiCreateUser({prefix: `user-${searchTerm}-2`})); + ({channel: nonJoinedChannel} = await Channel.apiCreateChannel({type: 'O', prefix: `non-joined-${searchTerm}`, teamId: testTeam.id})); + + ({user: nonDmOtherUser} = await User.apiCreateUser({prefix: `non-dm-user-${searchTerm}`})); await Team.apiAddUserToTeam(nonDmOtherUser.id, testTeam.id); // # Open channel screen @@ -104,12 +120,12 @@ describe('Channels List', () => { // # Open main sidebar await openMainSidebar(); - // * Verify order when all channels are unread - await hasChannelDisplayNameAtIndex(0, privateChannel.display_name); - await hasChannelDisplayNameAtIndex(1, publicChannel.display_name); - await hasChannelDisplayNameAtIndex(2, favoriteChannel.display_name); - await hasChannelDisplayNameAtIndex(3, unreadChannel.display_name); - await hasChannelDisplayNameAtIndex(4, dmOtherUser.username); + // * Verify order is post date descending when all channels are unread + await hasChannelDisplayNameAtIndex(0, dmOtherUser.username); + await hasChannelDisplayNameAtIndex(1, privateChannel.display_name); + await hasChannelDisplayNameAtIndex(2, publicChannel.display_name); + await hasChannelDisplayNameAtIndex(3, favoriteChannel.display_name); + await hasChannelDisplayNameAtIndex(4, unreadChannel.display_name); await hasChannelDisplayNameAtIndex(5, 'Off-Topic'); await hasChannelDisplayNameAtIndex(6, 'Town Square'); await expect(element(by.id(nonJoinedChannel.display_name))).not.toBeVisible(); @@ -132,10 +148,10 @@ describe('Channels List', () => { await openMainSidebar(); await hasChannelDisplayNameAtIndex(0, unreadChannel.display_name); await hasChannelDisplayNameAtIndex(1, favoriteChannel.display_name); - await hasChannelDisplayNameAtIndex(2, publicChannel.display_name); - await hasChannelDisplayNameAtIndex(3, 'Off-Topic'); - await hasChannelDisplayNameAtIndex(4, 'Town Square'); - await hasChannelDisplayNameAtIndex(5, privateChannel.display_name); + await hasChannelDisplayNameAtIndex(2, privateChannel.display_name); + await hasChannelDisplayNameAtIndex(3, publicChannel.display_name); + await hasChannelDisplayNameAtIndex(4, 'Off-Topic'); + await hasChannelDisplayNameAtIndex(5, 'Town Square'); await hasChannelDisplayNameAtIndex(6, dmOtherUser.username); await expect(element(by.id(nonJoinedChannel.display_name))).not.toBeVisible(); await expect(element(by.id(nonDmOtherUser.username))).not.toBeVisible(); diff --git a/detox/e2e/test/channels/create_public_channel.e2e.js b/detox/e2e/test/channels/create_public_channel.e2e.js index c626bba58..f8a255aab 100644 --- a/detox/e2e/test/channels/create_public_channel.e2e.js +++ b/detox/e2e/test/channels/create_public_channel.e2e.js @@ -27,6 +27,7 @@ describe('Channels', () => { nameInput, purposeInput, headerInput, + publicChannelTypeAction, } = CreateChannelScreen; beforeAll(async () => { @@ -71,6 +72,7 @@ describe('Channels', () => { await expect(element(by.text('New Public Channel'))).toBeVisible(); // # Fill data + await publicChannelTypeAction.tap(); await nameInput.typeText('a'); await attemptToTapCreateButton(); @@ -82,10 +84,7 @@ describe('Channels', () => { await purposeInput.tapReturnKey(); await purposeInput.typeText('multiple lines'); - // # Scroll down if Android - if (isAndroid()) { - await createChannelScreen.scroll(200, 'down'); - } + await createChannelScreen.scroll(200, 'down'); await expect(headerInput).toBeVisible(); const expectedChannelHeader = 'I 🌮 love 🌮 tacos 🌮'; diff --git a/detox/e2e/test/channels/favorite_channels.e2e.js b/detox/e2e/test/channels/favorite_channels.e2e.js index 0f184dbc0..e368f078e 100644 --- a/detox/e2e/test/channels/favorite_channels.e2e.js +++ b/detox/e2e/test/channels/favorite_channels.e2e.js @@ -59,7 +59,7 @@ describe('Favorite Channels', () => { // * Verify channel appears in favorite channels list await ChannelInfoScreen.close(); await openMainSidebar(); - await expect(element(by.text('FAVORITE CHANNELS'))).toBeVisible(); + await expect(element(by.text('FAVORITES'))).toBeVisible(); await hasChannelDisplayNameAtIndex(0, testChannel.display_name); // # Close main sidebar diff --git a/detox/e2e/test/messaging/mark_as_read.e2e.js b/detox/e2e/test/messaging/mark_as_read.e2e.js index 3d9cca234..13b9368f2 100644 --- a/detox/e2e/test/messaging/mark_as_read.e2e.js +++ b/detox/e2e/test/messaging/mark_as_read.e2e.js @@ -59,7 +59,7 @@ describe('Mark As Read', () => { // * Verify message is read await openMainSidebar(); await expect(element(by.text('UNREADS'))).not.toBeVisible(); - await expect(element(by.text('PUBLIC CHANNELS'))).toBeVisible(); + await expect(element(by.text('CHANNELS'))).toBeVisible(); await hasChannelDisplayNameAtIndex(0, testChannel.display_name); // # Go back to channel diff --git a/detox/e2e/test/messaging/permalink.e2e.js b/detox/e2e/test/messaging/permalink.e2e.js index 327c1b34e..245fd8b44 100644 --- a/detox/e2e/test/messaging/permalink.e2e.js +++ b/detox/e2e/test/messaging/permalink.e2e.js @@ -41,7 +41,7 @@ describe('Permalink', () => { await ChannelScreen.logout(); }); - const expectPermalinkTargetMessage = async (permalinkTargetPost, permalinkTargetChannel) => { + const expectPermalinkTargetMessage = async (permalinkTargetPost, permalinkTargetChannelDiplayName) => { // # Post a message in the test channel referencing the given permalink. const permalinkLabel = `permalink-${Date.now().toString()}`; const permalinkMessage = `[${permalinkLabel}](/_redirect/pl/${permalinkTargetPost.id})`; @@ -66,7 +66,7 @@ describe('Permalink', () => { await PermalinkScreen.jumpToRecentMessages(); // * Verify user is on channel where message is posted - await expect(ChannelScreen.channelNavBarTitle).toHaveText(permalinkTargetChannel.display_name); + await expect(ChannelScreen.channelNavBarTitle).toHaveText(permalinkTargetChannelDiplayName); const {postListPostItem: channelPostItem} = await ChannelScreen.getPostListPostItem(permalinkTargetPost.id, permalinkTargetPost.message); await expect(channelPostItem).toBeVisible(); }; @@ -79,7 +79,7 @@ describe('Permalink', () => { message: permalinkTargetMessage, }); - await expectPermalinkTargetMessage(permalinkTargetPost.post, townSquareChannel); + await expectPermalinkTargetMessage(permalinkTargetPost.post, townSquareChannel.display_name); }); it('MM-T3805_2 should support _redirect to DM post', async () => { @@ -92,6 +92,6 @@ describe('Permalink', () => { message: permalinkTargetMessage, }); - await expectPermalinkTargetMessage(permalinkTargetPost.post, directMessageChannel); + await expectPermalinkTargetMessage(permalinkTargetPost.post, dmOtherUser.username); }); }); diff --git a/detox/e2e/test/messaging/tapping_channel_url_link_joins_channel.e2e.js b/detox/e2e/test/messaging/tapping_channel_url_link_joins_channel.e2e.js index 0fa9f4ae6..b4cda3920 100644 --- a/detox/e2e/test/messaging/tapping_channel_url_link_joins_channel.e2e.js +++ b/detox/e2e/test/messaging/tapping_channel_url_link_joins_channel.e2e.js @@ -164,17 +164,23 @@ describe('Messaging', () => { }); async function createPrivateChannel(channelName) { + const { + createButton, + nameInput, + privateChannelTypeAction, + } = CreateChannelScreen; + // # Open create private channel screen await ChannelScreen.openMainSidebar(); - await MainSidebar.openCreatePrivateChannelButton.tap(); + await CreateChannelScreen.open(); // * Verify create channel screen is visible - await CreateChannelScreen.toBeVisible(); - await expect(element(by.text('New Private Channel'))).toBeVisible(); + await expect(element(by.text('Create')).atIndex(0)).toBeVisible(); // # Fill the data and create a private channel - await CreateChannelScreen.nameInput.typeText(channelName); - await CreateChannelScreen.createButton.tap(); + await privateChannelTypeAction.tap(); + await nameInput.typeText(channelName); + await createButton.tap(); // * Expect a redirection to the created channel await expect(ChannelScreen.channelIntro).toHaveText('Beginning of ' + channelName); diff --git a/detox/e2e/test/smoke_test/channels.e2e.js b/detox/e2e/test/smoke_test/channels.e2e.js index 6ffdd1d8d..fc9cc9bba 100644 --- a/detox/e2e/test/smoke_test/channels.e2e.js +++ b/detox/e2e/test/smoke_test/channels.e2e.js @@ -52,35 +52,52 @@ describe('Channels', () => { let nonDmOtherUser; beforeAll(async () => { - const {user, channel, team} = await Setup.apiInit({channelOptions: {prefix: `channel-${searchTerm}`}}); + const {user, channel, team} = await Setup.apiInit({channelOptions: {prefix: `5-unread-${searchTerm}`}}); unreadChannel = channel; testMessage = `Mention @${user.username}`; await Post.apiCreatePost({ channelId: unreadChannel.id, message: testMessage, + createAt: Date.now(), }); ({channel: favoriteChannel} = await Channel.apiCreateChannel({type: 'O', prefix: `4-favorite-${searchTerm}`, teamId: team.id})); await Channel.apiAddUserToChannel(user.id, favoriteChannel.id); await Preference.apiSaveFavoriteChannelPreference(user.id, favoriteChannel.id); + await Post.apiCreatePost({ + channelId: favoriteChannel.id, + message: testMessage, + createAt: Date.now(), + }); ({channel: publicChannel} = await Channel.apiCreateChannel({type: 'O', prefix: `3-public-${searchTerm}`, teamId: team.id})); await Channel.apiAddUserToChannel(user.id, publicChannel.id); + await Post.apiCreatePost({ + channelId: publicChannel.id, + message: testMessage, + createAt: Date.now(), + }); ({channel: privateChannel} = await Channel.apiCreateChannel({type: 'P', prefix: `2-private-${searchTerm}`, teamId: team.id})); await Channel.apiAddUserToChannel(user.id, privateChannel.id); + await Post.apiCreatePost({ + channelId: privateChannel.id, + message: testMessage, + createAt: Date.now(), + }); - ({channel: nonJoinedChannel} = await Channel.apiCreateChannel({type: 'O', prefix: `1-non-joined-${searchTerm}`, teamId: team.id})); - - ({user: dmOtherUser} = await User.apiCreateUser({prefix: `user-${searchTerm}-1`})); + ({user: dmOtherUser} = await User.apiCreateUser({prefix: `1-dm-user-${searchTerm}`})); await Team.apiAddUserToTeam(dmOtherUser.id, team.id); ({channel: directMessageChannel} = await Channel.apiCreateDirectChannel([user.id, dmOtherUser.id])); await Post.apiCreatePost({ channelId: directMessageChannel.id, message: testMessage, + createAt: Date.now(), }); - ({user: nonDmOtherUser} = await User.apiCreateUser({prefix: `user-${searchTerm}-2`})); + ({channel: nonJoinedChannel} = await Channel.apiCreateChannel({type: 'O', prefix: `non-joined-${searchTerm}`, teamId: team.id})); + + ({user: nonDmOtherUser} = await User.apiCreateUser({prefix: `non-dm-user-${searchTerm}`})); await Team.apiAddUserToTeam(nonDmOtherUser.id, team.id); // # Open channel screen @@ -95,12 +112,12 @@ describe('Channels', () => { // # Open main sidebar await openMainSidebar(); - // * Verify order when all channels are unread - await hasChannelDisplayNameAtIndex(0, privateChannel.display_name); - await hasChannelDisplayNameAtIndex(1, publicChannel.display_name); - await hasChannelDisplayNameAtIndex(2, favoriteChannel.display_name); - await hasChannelDisplayNameAtIndex(3, unreadChannel.display_name); - await hasChannelDisplayNameAtIndex(4, dmOtherUser.username); + // * Verify order is post date descending when all channels are unread + await hasChannelDisplayNameAtIndex(0, dmOtherUser.username); + await hasChannelDisplayNameAtIndex(1, privateChannel.display_name); + await hasChannelDisplayNameAtIndex(2, publicChannel.display_name); + await hasChannelDisplayNameAtIndex(3, favoriteChannel.display_name); + await hasChannelDisplayNameAtIndex(4, unreadChannel.display_name); await hasChannelDisplayNameAtIndex(5, 'Off-Topic'); await hasChannelDisplayNameAtIndex(6, 'Town Square'); await expect(element(by.id(nonJoinedChannel.display_name))).not.toBeVisible(); @@ -123,10 +140,10 @@ describe('Channels', () => { await openMainSidebar(); await hasChannelDisplayNameAtIndex(0, unreadChannel.display_name); await hasChannelDisplayNameAtIndex(1, favoriteChannel.display_name); - await hasChannelDisplayNameAtIndex(2, publicChannel.display_name); - await hasChannelDisplayNameAtIndex(3, 'Off-Topic'); - await hasChannelDisplayNameAtIndex(4, 'Town Square'); - await hasChannelDisplayNameAtIndex(5, privateChannel.display_name); + await hasChannelDisplayNameAtIndex(2, privateChannel.display_name); + await hasChannelDisplayNameAtIndex(3, publicChannel.display_name); + await hasChannelDisplayNameAtIndex(4, 'Off-Topic'); + await hasChannelDisplayNameAtIndex(5, 'Town Square'); await hasChannelDisplayNameAtIndex(6, dmOtherUser.username); await expect(element(by.id(nonJoinedChannel.display_name))).not.toBeVisible(); await expect(element(by.id(nonDmOtherUser.username))).not.toBeVisible(); diff --git a/detox/e2e/test/smoke_test/favorite_channels.e2e.js b/detox/e2e/test/smoke_test/favorite_channels.e2e.js index ad84ef69b..3939b404c 100644 --- a/detox/e2e/test/smoke_test/favorite_channels.e2e.js +++ b/detox/e2e/test/smoke_test/favorite_channels.e2e.js @@ -58,7 +58,7 @@ describe('Favorite Channels', () => { // * Verify channel appears in favorite channels list await ChannelInfoScreen.close(); await openMainSidebar(); - await expect(element(by.text('FAVORITE CHANNELS'))).toBeVisible(); + await expect(element(by.text('FAVORITES'))).toBeVisible(); await hasChannelDisplayNameAtIndex(0, testChannel.display_name); // # Close main sidebar @@ -84,7 +84,7 @@ describe('Favorite Channels', () => { // * Verify channel does not appear in favorite channels list await ChannelInfoScreen.close(); await openMainSidebar(); - await expect(element(by.text('FAVORITE CHANNELS'))).not.toBeVisible(); + await expect(element(by.text('FAVORITES'))).not.toBeVisible(); await hasChannelDisplayNameAtIndex(0, testChannel.display_name); // # Close main sidebar diff --git a/detox/e2e/test/smoke_test/private_channels.e2e.js b/detox/e2e/test/smoke_test/private_channels.e2e.js index 7b2363d36..a11d99ab6 100644 --- a/detox/e2e/test/smoke_test/private_channels.e2e.js +++ b/detox/e2e/test/smoke_test/private_channels.e2e.js @@ -67,15 +67,15 @@ describe('Private Channels', () => { const { createButton, nameInput, + privateChannelTypeAction, } = CreateChannelScreen; - const {openCreatePrivateChannelButton} = MainSidebar; // # Create a private channel const privateChannelName = `Channel-${getRandomId()}`; await openMainSidebar(); - await openCreatePrivateChannelButton.tap(); - await CreateChannelScreen.toBeVisible(); - await expect(element(by.text('New Private Channel'))).toBeVisible(); + await CreateChannelScreen.open(); + await expect(element(by.text('Create')).atIndex(0)).toBeVisible(); + await privateChannelTypeAction.tap(); await nameInput.typeText(privateChannelName); await createButton.tap(); diff --git a/detox/e2e/test/smoke_test/search.e2e.js b/detox/e2e/test/smoke_test/search.e2e.js index 504de8c4b..f8063ee50 100644 --- a/detox/e2e/test/smoke_test/search.e2e.js +++ b/detox/e2e/test/smoke_test/search.e2e.js @@ -179,7 +179,7 @@ describe('Search', () => { channelId: testChannel.id, message: firstMessage, }); - [...Array(50).keys()].forEach(async () => { + [...Array(10).keys()].forEach(async () => { const message = `${Date.now().toString()} ${keyword}`; await Post.apiCreatePost({ channelId: testChannel.id, @@ -195,7 +195,7 @@ describe('Search', () => { // * Verify user can scroll down multiple times until first matching post is seen const {searchResultPostItem} = await getSearchResultPostItem(firstPost.post.id, firstMessage); - await waitFor(searchResultPostItem).toBeVisible().whileElement(by.id(SearchScreen.testID.searchResultsList)).scroll(1000, 'down'); + await waitFor(searchResultPostItem).toBeVisible().whileElement(by.id(SearchScreen.testID.searchResultsList)).scroll(500, 'down'); // # Go back to channel await SearchScreen.cancel(); diff --git a/detox/e2e/test/smoke_test/unread_channels.e2e.js b/detox/e2e/test/smoke_test/unread_channels.e2e.js index cfc75141a..2888a5e3d 100644 --- a/detox/e2e/test/smoke_test/unread_channels.e2e.js +++ b/detox/e2e/test/smoke_test/unread_channels.e2e.js @@ -55,11 +55,11 @@ describe('Unread channels', () => { // # Open main sidebar (with at least one unread channel) await openMainSidebar(); - // * Verify unread channel(s) display at top of channel list (with mentions first, if any), in alphabetical order, with title "Unreads" + // * Verify unread channel(s) display at top of channel list (with mentions first, if any), in post date descending order, with title "Unreads" await expect(element(by.text('UNREADS'))).toBeVisible(); - await hasChannelDisplayNameAtIndex(0, aChannel.display_name); - await hasChannelDisplayNameAtIndex(1, newChannel.display_name); - await hasChannelDisplayNameAtIndex(2, zChannel.display_name); + await hasChannelDisplayNameAtIndex(0, zChannel.display_name); + await hasChannelDisplayNameAtIndex(1, aChannel.display_name); + await hasChannelDisplayNameAtIndex(2, newChannel.display_name); await closeMainSidebar(); // # Tap an unread channel to view it @@ -70,7 +70,7 @@ describe('Unread channels', () => { // * Channel you just read is no longer listed in Unreads await openMainSidebar(); await expect(element(by.text('UNREADS'))).not.toBeVisible(); - await expect(element(by.text('PUBLIC CHANNELS'))).toBeVisible(); + await expect(element(by.text('CHANNELS'))).toBeVisible(); await hasChannelDisplayNameAtIndex(0, aChannel.display_name); await hasChannelDisplayNameAtIndex(1, newChannel.display_name); await hasChannelDisplayNameAtIndex(2, 'Off-Topic');