From 084d342e1d31b2e80c7d35702c762fc7341ff91a Mon Sep 17 00:00:00 2001 From: Joseph Baylon Date: Fri, 14 Oct 2022 10:25:38 -0700 Subject: [PATCH] Detox/E2E: Verification fixes and added a step to post message on direct messages (#6664) * Detox/E2E: Minor fixes and added known issue tag * Add step to post message on direct message --- detox/e2e/test/autocomplete/channel_mention.e2e.ts | 5 ++--- detox/e2e/test/autocomplete/edit_channel_header.e2e.ts | 2 ++ detox/e2e/test/channels/create_direct_message.e2e.ts | 6 ++++-- .../test/channels/favorite_and_unfavorite_channel.e2e.ts | 7 ++++++- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/detox/e2e/test/autocomplete/channel_mention.e2e.ts b/detox/e2e/test/autocomplete/channel_mention.e2e.ts index c2c3cc3b3d..115a3c96db 100644 --- a/detox/e2e/test/autocomplete/channel_mention.e2e.ts +++ b/detox/e2e/test/autocomplete/channel_mention.e2e.ts @@ -252,8 +252,7 @@ describe('Autocomplete - Channel Mention', () => { await ChannelScreen.postInput.typeText(testChannel.name); // * Verify channel mention autocomplete contains current channel - const {channelMentionItemChannelDisplayName, channelMentionItemChannelName} = Autocomplete.getChannelMentionItem(testChannel.name); - await expect(channelMentionItemChannelDisplayName).toHaveText(`${testChannel.display_name}`); - await expect(channelMentionItemChannelName).toHaveText(` ~${testChannel.name}`); + const {channelMentionItemChannelDisplayName} = Autocomplete.getChannelMentionItem(testChannel.name); + await expect(channelMentionItemChannelDisplayName).toHaveText(`${testChannel.display_name} ~${testChannel.name}`); }); }); diff --git a/detox/e2e/test/autocomplete/edit_channel_header.e2e.ts b/detox/e2e/test/autocomplete/edit_channel_header.e2e.ts index b8bb6cf000..59f1b37e15 100644 --- a/detox/e2e/test/autocomplete/edit_channel_header.e2e.ts +++ b/detox/e2e/test/autocomplete/edit_channel_header.e2e.ts @@ -21,6 +21,7 @@ import { LoginScreen, ServerScreen, } from '@support/ui/screen'; +import {timeouts} from '@support/utils'; import {expect} from 'detox'; describe('Autocomplete - Edit Channel Header', () => { @@ -62,6 +63,7 @@ describe('Autocomplete - Edit Channel Header', () => { await CreateOrEditChannelScreen.headerInput.typeText('@'); // * Verify at-mention list is displayed + await waitFor(Autocomplete.sectionAtMentionList).toExist().withTimeout(timeouts.ONE_SEC); await expect(Autocomplete.sectionAtMentionList).toBeVisible(); }); diff --git a/detox/e2e/test/channels/create_direct_message.e2e.ts b/detox/e2e/test/channels/create_direct_message.e2e.ts index ebfd04b0f5..e11db9275b 100644 --- a/detox/e2e/test/channels/create_direct_message.e2e.ts +++ b/detox/e2e/test/channels/create_direct_message.e2e.ts @@ -98,7 +98,8 @@ describe('Channels - Create Direct Message', () => { await expect(ChannelScreen.headerTitle).toHaveText(newUserDisplayName); await expect(ChannelScreen.introDisplayName).toHaveText(newUserDisplayName); - // # Go back to channel list screen + // # Post a message and go back to channel list screen + await ChannelScreen.postMessage('test'); await ChannelScreen.back(); await device.reloadReactNative(); await ChannelListScreen.toBeVisible(); @@ -144,7 +145,8 @@ describe('Channels - Create Direct Message', () => { await expect(ChannelScreen.headerTitle).toHaveText(groupDisplayName); await expect(ChannelScreen.introDisplayName).toHaveText(groupDisplayName); - // # Go back to channel list screen + // # Post a message and go back to channel list screen + await ChannelScreen.postMessage('test'); await ChannelScreen.back(); await device.reloadReactNative(); await ChannelListScreen.toBeVisible(); diff --git a/detox/e2e/test/channels/favorite_and_unfavorite_channel.e2e.ts b/detox/e2e/test/channels/favorite_and_unfavorite_channel.e2e.ts index 1cba9997b4..a741da37bc 100644 --- a/detox/e2e/test/channels/favorite_and_unfavorite_channel.e2e.ts +++ b/detox/e2e/test/channels/favorite_and_unfavorite_channel.e2e.ts @@ -9,6 +9,7 @@ import { Channel, + Post, Setup, Team, User, @@ -112,10 +113,14 @@ describe('Channels - Favorite and Unfavorite Channel', () => { }); it('MM-T4929_3 - should be able to favorite/unfavorite a direct message channel from channel intro', async () => { - // # Open a direct message channel screen, tap on intro favorite action to favorite the channel, and go back to channel list screen + // # Open a direct message channel screen, post a message, tap on intro favorite action to favorite the channel, and go back to channel list screen const {user: newUser} = await User.apiCreateUser(siteOneUrl); await Team.apiAddUserToTeam(siteOneUrl, newUser.id, testTeam.id); const {channel: directMessageChannel} = await Channel.apiCreateDirectChannel(siteOneUrl, [testUser.id, newUser.id]); + await Post.apiCreatePost(siteOneUrl, { + channelId: directMessageChannel.id, + message: 'test', + }); await device.reloadReactNative(); await ChannelScreen.open(directMessagesCategory, directMessageChannel.name); await ChannelScreen.introFavoriteAction.tap();