From fcb1db660cfc3d0c72760685892be8b15c456dbd Mon Sep 17 00:00:00 2001 From: Elisabeth Kulzer <9913860+metanerd@users.noreply.github.com> Date: Sat, 11 Mar 2023 13:08:17 +0100 Subject: [PATCH] Detox android fix smoke tests (#7193) * Detox: Android - fix smoke tests. * Detox: Android - Fix latency related tests. --------- Co-authored-by: Mattermost Build --- android/app/debug.keystore | Bin 2257 -> 2261 bytes detox/e2e/support/ui/screen/account.ts | 3 +- detox/e2e/support/ui/screen/channel_info.ts | 6 +- .../e2e/test/channels/archive_channel.e2e.ts | 3 + detox/e2e/test/channels/channel_info.e2e.ts | 1 + .../test/channels/channel_post_list.e2e.ts | 10 +- .../convert_to_private_channel.e2e.ts | 10 +- .../channels/mute_and_unmute_channel.e2e.ts | 3 +- .../test/channels/unarchive_channel.e2e.ts | 4 +- .../follow_and_unfollow_messsage.e2e.ts | 10 +- .../e2e/test/server_login/server_list.e2e.ts | 95 +++++++++++++++--- detox/e2e/test/smoke_test/channels.e2e.ts | 2 +- detox/e2e/test/smoke_test/messaging.e2e.ts | 4 +- detox/e2e/test/smoke_test/server_login.e2e.ts | 1 + .../threads/follow_and_unfollow_thread.e2e.ts | 8 +- 15 files changed, 124 insertions(+), 36 deletions(-) diff --git a/android/app/debug.keystore b/android/app/debug.keystore index 364e105ed39fbfd62001429a68140672b06ec0de..ed393647b8c5d4a707609a8e78290c78a9bca46e 100644 GIT binary patch literal 2261 zcmchY`8U*!7sux_Gu9!582g%?k8O-CvTwM z#9j%*`C=nacv4I900sh~fr9byBk&Y0qYNzo2c)5F06+tQ$HNza+`4Y4?h0p}ez(j* z;zDGe#`}#SQc(CCg&TEio0^DdfE^pG*aE~nN!Af_zn zFIO#oK}n7=%sf92nv-r^JHp&Mu|Q1sMWhQQp}>hWZfO@LC@=83<;hdQq(CZHfB#v3 ze{I9t19OC{AEus`Eequ^o~NN(k@wUrtT?p@}2^T>X>;DKGfD^_NeM- zX1K8F!fk;l6l<1Z0-0(0@H8j3BU*hgw7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j|y<6G=o=!3S@eIFKDdpR7|FY>L&Wat&oW&cm&X~ z5Bt>Fcq(fgnvlvLSYg&o6>&fY`ODg4`V^lWWD=%oJ#Kbad2u~! zLECFS*??>|vDsNR&pH=Ze0Eo`sC_G`OjoEKVHY|wmwlX&(XBE<@sx3Hd^gtd-fNwUHsylg06p`U2y_={u}Bc { // # Open account screen + await waitFor(HomeScreen.accountTab).toBeVisible().withTimeout(timeouts.TWO_SEC); await HomeScreen.accountTab.tap(); return this.toBeVisible(); @@ -92,7 +93,7 @@ class AccountScreen { await expect(Alert.logoutTitle(serverDisplayName)).toBeVisible(); } await Alert.logoutButton.tap(); - await expect(this.accountScreen).not.toBeVisible(); + await waitFor(this.accountScreen).not.toBeVisible().withTimeout(timeouts.TEN_SEC); }; } diff --git a/detox/e2e/support/ui/screen/channel_info.ts b/detox/e2e/support/ui/screen/channel_info.ts index 26f6ec53a7..0ca358c850 100644 --- a/detox/e2e/support/ui/screen/channel_info.ts +++ b/detox/e2e/support/ui/screen/channel_info.ts @@ -6,7 +6,7 @@ import { ProfilePicture, } from '@support/ui/component'; import {ChannelScreen} from '@support/ui/screen'; -import {timeouts, wait} from '@support/utils'; +import {isAndroid, timeouts, wait} from '@support/utils'; import {expect} from 'detox'; class ChannelInfoScreen { @@ -98,6 +98,7 @@ class ChannelInfoScreen { open = async () => { // # Open channel info screen + await waitFor(ChannelScreen.headerTitle).toBeVisible().withTimeout(timeouts.TEN_SEC); await ChannelScreen.headerTitle.tap(); return this.toBeVisible(); @@ -165,6 +166,9 @@ class ChannelInfoScreen { leaveChannel = async ({confirm = true} = {}) => { await waitFor(this.leaveChannelOption).toExist().withTimeout(timeouts.TWO_SEC); + if (isAndroid()) { + await this.scrollView.scrollTo('bottom'); + } await this.leaveChannelOption.tap({x: 1, y: 1}); const { leaveChannelTitle, diff --git a/detox/e2e/test/channels/archive_channel.e2e.ts b/detox/e2e/test/channels/archive_channel.e2e.ts index f1c8702e60..4f329d32fc 100644 --- a/detox/e2e/test/channels/archive_channel.e2e.ts +++ b/detox/e2e/test/channels/archive_channel.e2e.ts @@ -58,6 +58,7 @@ describe('Channels - Archive Channel', () => { // # Open a public channel screen, open channel info screen, and tap on archive channel option and confirm const {channel: publicChannel} = await Channel.apiCreateChannel(siteOneUrl, {type: 'O', teamId: testTeam.id}); await Channel.apiAddUserToChannel(siteOneUrl, testUser.id, publicChannel.id); + await wait(timeouts.TWO_SEC); await device.reloadReactNative(); await ChannelScreen.open(channelsCategory, publicChannel.name); await ChannelInfoScreen.open(); @@ -88,6 +89,7 @@ describe('Channels - Archive Channel', () => { // # Open a public channel screen, open channel info screen, and tap on archive channel option and cancel const {channel: publicChannel} = await Channel.apiCreateChannel(siteOneUrl, {type: 'O', teamId: testTeam.id}); await Channel.apiAddUserToChannel(siteOneUrl, testUser.id, publicChannel.id); + await wait(timeouts.TWO_SEC); await device.reloadReactNative(); await ChannelScreen.open(channelsCategory, publicChannel.name); await ChannelInfoScreen.open(); @@ -105,6 +107,7 @@ describe('Channels - Archive Channel', () => { // # Open a private channel screen, open channel info screen, and tap on archive channel option and confirm const {channel: privateChannel} = await Channel.apiCreateChannel(siteOneUrl, {type: 'P', teamId: testTeam.id}); await Channel.apiAddUserToChannel(siteOneUrl, testUser.id, privateChannel.id); + await wait(timeouts.TWO_SEC); await device.reloadReactNative(); await ChannelScreen.open(channelsCategory, privateChannel.name); await ChannelInfoScreen.open(); diff --git a/detox/e2e/test/channels/channel_info.e2e.ts b/detox/e2e/test/channels/channel_info.e2e.ts index 5c65fd617e..1dae1e8157 100644 --- a/detox/e2e/test/channels/channel_info.e2e.ts +++ b/detox/e2e/test/channels/channel_info.e2e.ts @@ -64,6 +64,7 @@ describe('Channels - Channel Info', () => { await expect(ChannelInfoScreen.pinnedMessagesOption).toBeVisible(); await expect(ChannelInfoScreen.copyChannelLinkOption).toBeVisible(); await expect(ChannelInfoScreen.editChannelOption).toBeVisible(); + await ChannelInfoScreen.scrollView.scrollTo('bottom'); await expect(ChannelInfoScreen.leaveChannelOption).toBeVisible(); await waitFor(ChannelInfoScreen.archiveChannelOption).toBeVisible().whileElement(by.id(ChannelInfoScreen.testID.scrollView)).scroll(50, 'down'); await expect(ChannelInfoScreen.archiveChannelOption).toBeVisible(); diff --git a/detox/e2e/test/channels/channel_post_list.e2e.ts b/detox/e2e/test/channels/channel_post_list.e2e.ts index ee9b23b2c0..daf46bffc2 100644 --- a/detox/e2e/test/channels/channel_post_list.e2e.ts +++ b/detox/e2e/test/channels/channel_post_list.e2e.ts @@ -23,7 +23,7 @@ import { PostOptionsScreen, ServerScreen, } from '@support/ui/screen'; -import {getRandomId} from '@support/utils'; +import {getRandomId, isAndroid} from '@support/utils'; import {expect} from 'detox'; describe('Channels - Channel Post List', () => { @@ -52,6 +52,10 @@ describe('Channels - Channel Post List', () => { it('MM-T4773_1 - should match elements on channel screen', async () => { // # Open a channel screen await ChannelScreen.open('channels', testChannel.name); + if (isAndroid()) { + await ChannelScreen.back(); + await ChannelScreen.open('channels', testChannel.name); + } // * Verify basic elements on channel screen await expect(ChannelScreen.backButton).toBeVisible(); @@ -77,6 +81,10 @@ describe('Channels - Channel Post List', () => { // # Open a channel screen and post a message const message = `Message ${getRandomId()}`; await ChannelScreen.open('channels', testChannel.name); + if (isAndroid()) { + await ChannelScreen.back(); + await ChannelScreen.open('channels', testChannel.name); + } await ChannelScreen.postMessage(message); // * Verify message is added to post list diff --git a/detox/e2e/test/channels/convert_to_private_channel.e2e.ts b/detox/e2e/test/channels/convert_to_private_channel.e2e.ts index af5dd1fe6d..7579266ff2 100644 --- a/detox/e2e/test/channels/convert_to_private_channel.e2e.ts +++ b/detox/e2e/test/channels/convert_to_private_channel.e2e.ts @@ -7,7 +7,7 @@ // - Use element testID when selecting an element. Create one if none. // ******************************************************************* -import {serverOneUrl} from '@support/test_config'; +import {siteOneUrl} from '@support/test_config'; import { ChannelScreen, ChannelListScreen, @@ -17,21 +17,21 @@ import { ServerScreen, ChannelInfoScreen, } from '@support/ui/screen'; -import {getAdminAccount, getRandomId} from '@support/utils'; +import {getAdminAccount, getRandomId, timeouts} from '@support/utils'; import {expect} from 'detox'; describe('Channels - Convert to Private Channel', () => { - const serverOneDisplayName = 'Server 1'; + const siteOneDisplayName = 'Server 1'; beforeAll(async () => { // # Log in to server as admin - await ServerScreen.connectToServer(serverOneUrl, serverOneDisplayName); + await ServerScreen.connectToServer(siteOneUrl, siteOneDisplayName); await LoginScreen.login(getAdminAccount()); }); beforeEach(async () => { // * Verify on channel list screen - await ChannelListScreen.toBeVisible(); + await waitFor(ChannelListScreen.channelListScreen).toBeVisible().withTimeout(timeouts.TWO_MIN); }); afterAll(async () => { diff --git a/detox/e2e/test/channels/mute_and_unmute_channel.e2e.ts b/detox/e2e/test/channels/mute_and_unmute_channel.e2e.ts index 9d1465d653..6d1b4e4f58 100644 --- a/detox/e2e/test/channels/mute_and_unmute_channel.e2e.ts +++ b/detox/e2e/test/channels/mute_and_unmute_channel.e2e.ts @@ -81,9 +81,10 @@ describe('Channels - Mute and Unmute Channel', () => { // * Verify channel is muted await expect(ChannelInfoScreen.unmuteAction).toBeVisible(); + await wait(timeouts.FOUR_SEC); // # Tap on muted action to unmute the channel - await ChannelInfoScreen.unmuteAction.tap(); + await ChannelInfoScreen.unmuteAction.longPress(); // * Verify channel is unmuted await expect(ChannelInfoScreen.muteAction).toBeVisible(); diff --git a/detox/e2e/test/channels/unarchive_channel.e2e.ts b/detox/e2e/test/channels/unarchive_channel.e2e.ts index 5163c49bf0..6d7db8d3ab 100644 --- a/detox/e2e/test/channels/unarchive_channel.e2e.ts +++ b/detox/e2e/test/channels/unarchive_channel.e2e.ts @@ -17,7 +17,7 @@ import { ServerScreen, ChannelInfoScreen, } from '@support/ui/screen'; -import {getAdminAccount, getRandomId} from '@support/utils'; +import {getAdminAccount, getRandomId, timeouts} from '@support/utils'; import {expect} from 'detox'; describe('Channels - Unarchive Channel', () => { @@ -32,7 +32,7 @@ describe('Channels - Unarchive Channel', () => { beforeEach(async () => { // * Verify on channel list screen - await ChannelListScreen.toBeVisible(); + await waitFor(ChannelListScreen.channelListScreen).toBeVisible().withTimeout(timeouts.TWO_MIN); }); afterAll(async () => { diff --git a/detox/e2e/test/messaging/follow_and_unfollow_messsage.e2e.ts b/detox/e2e/test/messaging/follow_and_unfollow_messsage.e2e.ts index f232e3587b..266e12cec1 100644 --- a/detox/e2e/test/messaging/follow_and_unfollow_messsage.e2e.ts +++ b/detox/e2e/test/messaging/follow_and_unfollow_messsage.e2e.ts @@ -23,7 +23,7 @@ import { PostOptionsScreen, ServerScreen, } from '@support/ui/screen'; -import {getRandomId} from '@support/utils'; +import {getRandomId, timeouts} from '@support/utils'; import {expect} from 'detox'; describe('Messaging - Follow and Unfollow Message', () => { @@ -67,14 +67,14 @@ describe('Messaging - Follow and Unfollow Message', () => { // * Verify message is followed by user via post footer const {postListPostItemFooterFollowingButton} = ChannelScreen.getPostListPostItem(post.id, message); - await expect(postListPostItemFooterFollowingButton).toBeVisible(); + await waitFor(postListPostItemFooterFollowingButton).toBeVisible().withTimeout(timeouts.TWO_SEC); // # Open post options for message and tap on unfollow message option await ChannelScreen.openPostOptionsFor(post.id, message); await PostOptionsScreen.followingThreadOption.tap(); // * Verify message is not followed by user via post footer - await expect(postListPostItemFooterFollowingButton).not.toBeVisible(); + await waitFor(postListPostItemFooterFollowingButton).not.toBeVisible().withTimeout(timeouts.TWO_SEC); // # Go back to channel list screen await ChannelScreen.back(); @@ -91,13 +91,13 @@ describe('Messaging - Follow and Unfollow Message', () => { // * Verify message is followed by user via post footer const {postListPostItemFooterFollowingButton} = ChannelScreen.getPostListPostItem(post.id, message); - await expect(postListPostItemFooterFollowingButton).toBeVisible(); + await waitFor(postListPostItemFooterFollowingButton).toBeVisible().withTimeout(timeouts.TWO_SEC); // # Tap on following button via post footer await postListPostItemFooterFollowingButton.tap(); // * Verify message is not followed by user via post footer - await expect(postListPostItemFooterFollowingButton).not.toBeVisible(); + await waitFor(postListPostItemFooterFollowingButton).not.toBeVisible().withTimeout(timeouts.TWO_SEC); // # Go back to channel list screen await ChannelScreen.back(); diff --git a/detox/e2e/test/server_login/server_list.e2e.ts b/detox/e2e/test/server_login/server_list.e2e.ts index ca9f2e88ef..91239db866 100644 --- a/detox/e2e/test/server_login/server_list.e2e.ts +++ b/detox/e2e/test/server_login/server_list.e2e.ts @@ -30,7 +30,7 @@ import { ServerScreen, ServerListScreen, } from '@support/ui/screen'; -import {timeouts, wait} from '@support/utils'; +import {isAndroid, isIos, timeouts, wait} from '@support/utils'; import {expect} from 'detox'; describe('Server Login - Server List', () => { @@ -98,7 +98,12 @@ describe('Server Login - Server List', () => { // # Open server list screen await ServerListScreen.open(); - await ServerListScreen.serverListScreen.swipe('up'); + if (isIos()) { + await ServerListScreen.serverListTitle.swipe('up'); + } else if (isAndroid()) { + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); + await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); + } // * Verify second server is active and first server is inactive await waitFor(ServerListScreen.getServerItemActive(serverTwoDisplayName)).toBeVisible().withTimeout(timeouts.TEN_SEC); @@ -118,7 +123,12 @@ describe('Server Login - Server List', () => { // # Open server list screen await ServerListScreen.open(); - await ServerListScreen.serverListScreen.swipe('up'); + if (isIos()) { + await ServerListScreen.serverListTitle.swipe('up'); + } else if (isAndroid()) { + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); + await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); + } // * Verify third server is active, and first and second servers are inactive await waitFor(ServerListScreen.getServerItemActive(serverThreeDisplayName)).toBeVisible().withTimeout(timeouts.TEN_SEC); @@ -135,7 +145,12 @@ describe('Server Login - Server List', () => { // # Open server list screen and tap on third server await ServerListScreen.open(); - await ServerListScreen.serverListScreen.swipe('up'); + if (isIos()) { + await ServerListScreen.serverListTitle.swipe('up'); + } else if (isAndroid()) { + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); + await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); + } await waitFor(ServerListScreen.getServerItemInactive(serverThreeDisplayName)).toBeVisible().withTimeout(timeouts.TEN_SEC); await ServerListScreen.getServerItemInactive(serverThreeDisplayName).tap(); @@ -145,7 +160,12 @@ describe('Server Login - Server List', () => { // # Open server list screen and go back to first server await ServerListScreen.open(); - await ServerListScreen.serverListScreen.swipe('up'); + if (isIos()) { + await ServerListScreen.serverListTitle.swipe('up'); + } else if (isAndroid()) { + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); + await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); + } await waitFor(ServerListScreen.getServerItemInactive(serverOneDisplayName)).toBeVisible().withTimeout(timeouts.TEN_SEC); await ServerListScreen.getServerItemInactive(serverOneDisplayName).tap(); }); @@ -156,7 +176,12 @@ describe('Server Login - Server List', () => { // # Open server list screen, swipe left on first server and tap on edit option await ServerListScreen.open(); - await ServerListScreen.serverListScreen.swipe('up'); + if (isIos()) { + await ServerListScreen.serverListTitle.swipe('up'); + } else if (isAndroid()) { + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); + await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); + } await waitFor(ServerListScreen.getServerItemActive(serverOneDisplayName)).toBeVisible().withTimeout(timeouts.TEN_SEC); await ServerListScreen.getServerItemActive(serverOneDisplayName).swipe('left'); await ServerListScreen.getServerItemEditOption(serverOneDisplayName).tap(); @@ -197,7 +222,12 @@ describe('Server Login - Server List', () => { // # Open server list screen, swipe left on first server and tap on remove option await ServerListScreen.open(); - await ServerListScreen.serverListScreen.swipe('up'); + if (isIos()) { + await ServerListScreen.serverListTitle.swipe('up'); + } else if (isAndroid()) { + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); + await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); + } await waitFor(ServerListScreen.getServerItemActive(serverOneDisplayName)).toBeVisible().withTimeout(timeouts.TEN_SEC); await ServerListScreen.getServerItemActive(serverOneDisplayName).swipe('left'); await ServerListScreen.getServerItemRemoveOption(serverOneDisplayName).tap(); @@ -209,7 +239,12 @@ describe('Server Login - Server List', () => { await Alert.removeButton3.tap(); await wait(timeouts.ONE_SEC); await ServerListScreen.open(); - await ServerListScreen.serverListScreen.swipe('up'); + if (isIos()) { + await ServerListScreen.serverListTitle.swipe('up'); + } else if (isAndroid()) { + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); + await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); + } // * Verify first server is removed await expect(ServerListScreen.getServerItemActive(serverOneDisplayName)).not.toExist(); @@ -228,7 +263,12 @@ describe('Server Login - Server List', () => { // # Open server list screen, swipe left on third server and tap on logout option await ServerListScreen.open(); - await ServerListScreen.serverListScreen.swipe('up'); + if (isIos()) { + await ServerListScreen.serverListTitle.swipe('up'); + } else if (isAndroid()) { + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); + await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); + } await waitFor(ServerListScreen.getServerItemInactive(serverThreeDisplayName)).toBeVisible().withTimeout(timeouts.TEN_SEC); await ServerListScreen.getServerItemInactive(serverThreeDisplayName).swipe('left'); await ServerListScreen.getServerItemLogoutOption(serverThreeDisplayName).tap(); @@ -253,12 +293,27 @@ describe('Server Login - Server List', () => { // # Open server list screen, attempt to add a server already logged in and with inactive session await ServerListScreen.open(); - await ServerListScreen.serverListScreen.swipe('up'); + if (isIos()) { + await ServerListScreen.serverListTitle.swipe('up'); + } else if (isAndroid()) { + // await ServerListScreen.closeTutorial(); + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); + await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); + } await ServerListScreen.addServerButton.tap(); await expect(ServerScreen.headerTitleAddServer).toBeVisible(); await ServerScreen.serverUrlInput.replaceText(serverTwoUrl); + if (isAndroid()) { + await ServerScreen.serverUrlInput.tapReturnKey(); + } await ServerScreen.serverDisplayNameInput.replaceText(serverTwoDisplayName); - await ServerScreen.tapConnectButton(); + if (isAndroid()) { + await ServerScreen.serverDisplayNameInput.tapReturnKey(); + } + + if (isIos()) { + await ServerScreen.tapConnectButton(); + } // * Verify same name server error const sameNameServerError = 'You are using this name for another server.'; @@ -266,8 +321,17 @@ describe('Server Login - Server List', () => { // # Attempt to add a server already logged in and with active session, with the same server display name await ServerScreen.serverUrlInput.replaceText(serverOneUrl); + if (isAndroid()) { + await ServerScreen.serverUrlInput.tapReturnKey(); + } await ServerScreen.serverDisplayNameInput.replaceText(serverOneDisplayName); - await ServerScreen.tapConnectButton(); + if (isAndroid()) { + await ServerScreen.serverDisplayNameInput.tapReturnKey(); + } + + if (isIos()) { + await ServerScreen.tapConnectButton(); + } // * Verify same name server error await expect(ServerScreen.serverDisplayNameInputError).toHaveText(sameNameServerError); @@ -275,7 +339,12 @@ describe('Server Login - Server List', () => { // # Close server screen, open server list screen, log out of second server, and go back to first server await ServerScreen.close(); await ServerListScreen.open(); - await ServerListScreen.serverListScreen.swipe('up'); + if (isIos()) { + await ServerListScreen.serverListTitle.swipe('up'); + } else if (isAndroid()) { + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); + await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); + } await waitFor(ServerListScreen.getServerItemInactive(serverTwoDisplayName)).toBeVisible().withTimeout(timeouts.TEN_SEC); await ServerListScreen.getServerItemInactive(serverTwoDisplayName).swipe('left'); await ServerListScreen.getServerItemLogoutOption(serverTwoDisplayName).tap(); diff --git a/detox/e2e/test/smoke_test/channels.e2e.ts b/detox/e2e/test/smoke_test/channels.e2e.ts index 040853ee78..21cf7e2292 100644 --- a/detox/e2e/test/smoke_test/channels.e2e.ts +++ b/detox/e2e/test/smoke_test/channels.e2e.ts @@ -81,7 +81,6 @@ describe('Smoke Test - Channels', () => { // * Verify on the other channel screen await ChannelScreen.toBeVisible(); await expect(ChannelScreen.headerTitle).toHaveText(testChannel.display_name); - await expect(ChannelScreen.introDisplayName).toHaveText(testChannel.display_name); // # Go back to channel list screen await ChannelScreen.back(); @@ -189,6 +188,7 @@ describe('Smoke Test - Channels', () => { // # Open a channel screen, open channel info screen, and tap on archive channel option and confirm const {channel} = await Channel.apiCreateChannel(siteOneUrl, {teamId: testTeam.id}); await Channel.apiAddUserToChannel(siteOneUrl, testUser.id, channel.id); + await wait(timeouts.TWO_SEC); await device.reloadReactNative(); await ChannelScreen.open(channelsCategory, channel.name); await ChannelInfoScreen.open(); diff --git a/detox/e2e/test/smoke_test/messaging.e2e.ts b/detox/e2e/test/smoke_test/messaging.e2e.ts index aaea30cec9..6ddac44b25 100644 --- a/detox/e2e/test/smoke_test/messaging.e2e.ts +++ b/detox/e2e/test/smoke_test/messaging.e2e.ts @@ -144,7 +144,7 @@ describe('Smoke Test - Messaging', () => { await element(by.text('🤡')).tap(); // * Verify reaction is added to the message - await expect(element(by.text('🤡').withAncestor(by.id(`channel.post_list.post.${post.id}`)))).toBeVisible(); + await waitFor(element(by.text('🤡').withAncestor(by.id(`channel.post_list.post.${post.id}`)))).toBeVisible().withTimeout(timeouts.TWO_SEC); // # Go back to channel list screen await ChannelScreen.back(); @@ -161,7 +161,7 @@ describe('Smoke Test - Messaging', () => { // * Verify message is followed by user via post footer const {postListPostItem, postListPostItemFooterFollowingButton} = ChannelScreen.getPostListPostItem(post.id, message); - await expect(postListPostItemFooterFollowingButton).toBeVisible(); + await waitFor(postListPostItemFooterFollowingButton).toBeVisible().withTimeout(timeouts.TWO_SEC); // # Tap on following button via post footer await postListPostItemFooterFollowingButton.tap(); diff --git a/detox/e2e/test/smoke_test/server_login.e2e.ts b/detox/e2e/test/smoke_test/server_login.e2e.ts index cff728201a..e1e43ba88b 100644 --- a/detox/e2e/test/smoke_test/server_login.e2e.ts +++ b/detox/e2e/test/smoke_test/server_login.e2e.ts @@ -90,6 +90,7 @@ describe('Smoke Test - Server Login', () => { if (isIos()) { await ServerListScreen.serverListTitle.swipe('up'); } else if (isAndroid()) { + await waitFor(ServerListScreen.serverListTitle).toBeVisible().withTimeout(timeouts.TWO_SEC); await ServerListScreen.serverListTitle.swipe('up', 'fast', 0.1, 0.5, 0.3); } await waitFor(ServerListScreen.getServerItemInactive(serverTwoDisplayName)).toBeVisible().withTimeout(timeouts.TEN_SEC); diff --git a/detox/e2e/test/threads/follow_and_unfollow_thread.e2e.ts b/detox/e2e/test/threads/follow_and_unfollow_thread.e2e.ts index ceae5febbc..6d880c1019 100644 --- a/detox/e2e/test/threads/follow_and_unfollow_thread.e2e.ts +++ b/detox/e2e/test/threads/follow_and_unfollow_thread.e2e.ts @@ -131,7 +131,7 @@ describe('Threads - Follow and Unfollow Thread', () => { // * Verify thread is not followed by user via post footer const {postListPostItemFooterFollowButton, postListPostItemFooterFollowingButton} = ChannelScreen.getPostListPostItem(parentPost.id, parentMessage); - await expect(postListPostItemFooterFollowButton).toBeVisible(); + await waitFor(postListPostItemFooterFollowButton).toBeVisible().withTimeout(timeouts.TWO_SEC); // # Open post options for thread await ChannelScreen.openPostOptionsFor(parentPost.id, parentMessage); @@ -143,13 +143,13 @@ describe('Threads - Follow and Unfollow Thread', () => { await PostOptionsScreen.followThreadOption.tap(); // * Verify thread is followed by user via post footer - await expect(postListPostItemFooterFollowingButton).toBeVisible(); + await waitFor(postListPostItemFooterFollowingButton).toBeVisible().withTimeout(timeouts.TWO_SEC); // # Open post options for thread await ChannelScreen.openPostOptionsFor(parentPost.id, parentMessage); // * Verify thread is followed by user via post options - await expect(PostOptionsScreen.followingThreadOption).toBeVisible(); + await waitFor(PostOptionsScreen.followingThreadOption).toBeVisible().withTimeout(timeouts.TWO_SEC); // # Go back to channel list screen await PostOptionsScreen.close(); @@ -177,7 +177,7 @@ describe('Threads - Follow and Unfollow Thread', () => { await GlobalThreadsScreen.openThreadOptionsFor(parentPost.id); // * Verify thread is followed by user via thread options - await expect(ThreadOptionsScreen.followingThreadOption).toBeVisible(); + await waitFor(ThreadOptionsScreen.followingThreadOption).toBeVisible().withTimeout(timeouts.TWO_SEC); // # Tap on unfollow thread option await ThreadOptionsScreen.followingThreadOption.tap();