diff --git a/detox/e2e/support/ui/component/autocomplete.ts b/detox/e2e/support/ui/component/autocomplete.ts index e525942009..27b76c50ab 100644 --- a/detox/e2e/support/ui/component/autocomplete.ts +++ b/detox/e2e/support/ui/component/autocomplete.ts @@ -1,6 +1,7 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. +import {timeouts, wait} from '@support/utils'; import {expect} from 'detox'; import ProfilePicture from './profile_picture'; @@ -111,6 +112,7 @@ class Autocomplete { }; toBeVisible = async (isVisible = true) => { + await wait(timeouts.ONE_SEC); if (isVisible) { await expect(this.autocomplete.atIndex(0)).toBeVisible(); return this.autocomplete; diff --git a/detox/e2e/support/ui/screen/channel.ts b/detox/e2e/support/ui/screen/channel.ts index 5aa494285f..65d5f04b8b 100644 --- a/detox/e2e/support/ui/screen/channel.ts +++ b/detox/e2e/support/ui/screen/channel.ts @@ -124,6 +124,7 @@ class ChannelScreen { }; back = async () => { + await wait(timeouts.ONE_SEC); await this.backButton.tap(); await expect(this.channelScreen).not.toBeVisible(); }; diff --git a/detox/e2e/support/ui/screen/channel_info.ts b/detox/e2e/support/ui/screen/channel_info.ts index ead3b21773..26f6ec53a7 100644 --- a/detox/e2e/support/ui/screen/channel_info.ts +++ b/detox/e2e/support/ui/screen/channel_info.ts @@ -109,7 +109,7 @@ class ChannelInfoScreen { }; archiveChannel = async (alertArchiveChannelTitle: Detox.NativeElement, {confirm = true} = {}) => { - await waitFor(this.archiveChannelOption).toExist().withTimeout(timeouts.TWO_SEC); + await waitFor(this.archiveChannelOption).toBeVisible().whileElement(by.id(this.testID.scrollView)).scroll(50, 'down'); await this.archiveChannelOption.tap({x: 1, y: 1}); const { noButton, @@ -196,7 +196,7 @@ class ChannelInfoScreen { }; unarchiveChannel = async (alertUnarchiveChannelTitle: Detox.NativeElement, {confirm = true} = {}) => { - await waitFor(this.unarchiveChannelOption).toExist().withTimeout(timeouts.TWO_SEC); + await waitFor(this.unarchiveChannelOption).toBeVisible().whileElement(by.id(this.testID.scrollView)).scroll(50, 'down'); await this.unarchiveChannelOption.tap({x: 1, y: 1}); const { noButton, diff --git a/detox/e2e/support/ui/screen/create_direct_message.ts b/detox/e2e/support/ui/screen/create_direct_message.ts index 6b206e003c..13e813aa23 100644 --- a/detox/e2e/support/ui/screen/create_direct_message.ts +++ b/detox/e2e/support/ui/screen/create_direct_message.ts @@ -58,7 +58,9 @@ class CreateDirectMessageScreen { }; toBeVisible = async () => { - await waitFor(this.createDirectMessageScreen).toExist().withTimeout(timeouts.TEN_SEC); + if (isIos()) { + await waitFor(this.createDirectMessageScreen).toExist().withTimeout(timeouts.TEN_SEC); + } return this.createDirectMessageScreen; }; @@ -69,10 +71,7 @@ class CreateDirectMessageScreen { await wait(timeouts.ONE_SEC); await ChannelListScreen.openDirectMessageItem.tap(); - if (isIos()) { - return this.toBeVisible(); - } - return null; + return this.toBeVisible(); }; close = async () => { diff --git a/detox/e2e/support/ui/screen/permalink.ts b/detox/e2e/support/ui/screen/permalink.ts index a6337161de..b71c42416d 100644 --- a/detox/e2e/support/ui/screen/permalink.ts +++ b/detox/e2e/support/ui/screen/permalink.ts @@ -2,6 +2,7 @@ // See LICENSE.txt for license information. import {PostList} from '@support/ui/component'; +import {timeouts, wait} from '@support/utils'; import {expect} from 'detox'; class PermalinkScreen { @@ -27,6 +28,7 @@ class PermalinkScreen { }; toBeVisible = async () => { + await wait(timeouts.ONE_SEC); await expect(this.permalinkScreen).toBeVisible(); return this.permalinkScreen; @@ -34,6 +36,7 @@ class PermalinkScreen { jumpToRecentMessages = async () => { // # Jump to recent messages + await wait(timeouts.ONE_SEC); await this.jumpToRecentMessagesButton.tap(); await expect(this.permalinkScreen).not.toBeVisible(); }; diff --git a/detox/e2e/support/ui/screen/server_list.ts b/detox/e2e/support/ui/screen/server_list.ts index 97b2ecc7a3..120c0bc88e 100644 --- a/detox/e2e/support/ui/screen/server_list.ts +++ b/detox/e2e/support/ui/screen/server_list.ts @@ -53,7 +53,9 @@ class ServerListScreen { }; toBeVisible = async () => { - await waitFor(this.serverListScreen).toExist().withTimeout(timeouts.TEN_SEC); + if (isIos()) { + await waitFor(this.serverListScreen).toExist().withTimeout(timeouts.TEN_SEC); + } return this.serverListScreen; }; @@ -62,10 +64,7 @@ class ServerListScreen { // # Open server list screen await ChannelListScreen.serverIcon.tap(); - if (isIos()) { - return this.toBeVisible(); - } - return null; + return this.toBeVisible(); }; close = async () => { diff --git a/detox/e2e/test/account/about.e2e.ts b/detox/e2e/test/account/about.e2e.ts index 2921d646be..ea4164955e 100644 --- a/detox/e2e/test/account/about.e2e.ts +++ b/detox/e2e/test/account/about.e2e.ts @@ -72,7 +72,7 @@ describe('Account - Settings - About', () => { await expect(AboutScreen.termsOfService).toHaveText('Terms of Service'); await expect(AboutScreen.privacyPolicy).toHaveText('Privacy Policy'); await expect(AboutScreen.noticeText).toHaveText('Mattermost is made possible by the open source software used in our server and mobile apps.'); - await waitFor(AboutScreen.buildDateTitle).toBeVisible().whileElement(by.id(AboutScreen.testID.scrollView)).scroll(50, 'down'); + await waitFor(AboutScreen.buildDateValue).toBeVisible().whileElement(by.id(AboutScreen.testID.scrollView)).scroll(50, 'down'); await expect(AboutScreen.buildHashTitle).toHaveText('Build Hash:'); await expect(AboutScreen.buildHashValue).toBeVisible(); await expect(AboutScreen.buildHashEnterpriseTitle).toHaveText('EE Build Hash:'); diff --git a/detox/e2e/test/channels/channel_info.e2e.ts b/detox/e2e/test/channels/channel_info.e2e.ts index 246fd60685..5c65fd617e 100644 --- a/detox/e2e/test/channels/channel_info.e2e.ts +++ b/detox/e2e/test/channels/channel_info.e2e.ts @@ -65,6 +65,7 @@ describe('Channels - Channel Info', () => { await expect(ChannelInfoScreen.copyChannelLinkOption).toBeVisible(); await expect(ChannelInfoScreen.editChannelOption).toBeVisible(); await expect(ChannelInfoScreen.leaveChannelOption).toBeVisible(); + await waitFor(ChannelInfoScreen.archiveChannelOption).toBeVisible().whileElement(by.id(ChannelInfoScreen.testID.scrollView)).scroll(50, 'down'); await expect(ChannelInfoScreen.archiveChannelOption).toBeVisible(); // # Go back to channel list screen diff --git a/detox/e2e/test/channels/find_channels.e2e.ts b/detox/e2e/test/channels/find_channels.e2e.ts index a1bcc7c786..41c4537962 100644 --- a/detox/e2e/test/channels/find_channels.e2e.ts +++ b/detox/e2e/test/channels/find_channels.e2e.ts @@ -25,6 +25,7 @@ import { LoginScreen, ServerScreen, } from '@support/ui/screen'; +import {timeouts, wait} from '@support/utils'; import {expect} from 'detox'; describe('Channels - Find Channels', () => { @@ -73,6 +74,7 @@ describe('Channels - Find Channels', () => { await FindChannelsScreen.searchInput.replaceText(testChannel.name); // * Verify search returns the target public channel item + await wait(timeouts.ONE_SEC); await expect(FindChannelsScreen.getFilteredChannelItemDisplayName(testChannel.name)).toHaveText(testChannel.display_name); // # Tap on the target public channel item @@ -94,6 +96,7 @@ describe('Channels - Find Channels', () => { await FindChannelsScreen.searchInput.replaceText(searchTerm); // * Verify empty search state for find channels + await wait(timeouts.ONE_SEC); await expect(element(by.text(`No matches found for “${searchTerm}”`))).toBeVisible(); await expect(element(by.text('Check the spelling or try another search.'))).toBeVisible(); @@ -113,12 +116,14 @@ describe('Channels - Find Channels', () => { await FindChannelsScreen.searchInput.replaceText(testOtherUser1.username); // * Verify search returns the target direct message channel item + await wait(timeouts.ONE_SEC); await expect(FindChannelsScreen.getFilteredChannelItemDisplayName(directMessageChannel.name)).toHaveText(testOtherUser1.username); // # Search for the group message channel await FindChannelsScreen.searchInput.replaceText(testOtherUser2.username); // * Verify search returns the target group message channel item + await wait(timeouts.ONE_SEC); await expect(FindChannelsScreen.getFilteredChannelItemDisplayName(groupMessageChannel.name)).toHaveText(`${testOtherUser1.username}, ${testOtherUser2.username}, sysadmin`); // # Go back to channel list screen @@ -134,6 +139,7 @@ describe('Channels - Find Channels', () => { await FindChannelsScreen.searchInput.replaceText(archivedChannel.name); // * Verify search returns the target archived channel item + await wait(timeouts.ONE_SEC); await expect(FindChannelsScreen.getFilteredChannelItemDisplayName(archivedChannel.name)).toHaveText(archivedChannel.display_name); // # Go back to channel list screen @@ -149,12 +155,14 @@ describe('Channels - Find Channels', () => { await FindChannelsScreen.searchInput.replaceText(joinedPrivateChannel.name); // * Verify search returns the target joined private channel item + await wait(timeouts.ONE_SEC); await expect(FindChannelsScreen.getFilteredChannelItemDisplayName(joinedPrivateChannel.name)).toHaveText(joinedPrivateChannel.display_name); // # Search for an unjoined private channel await FindChannelsScreen.searchInput.replaceText(unjoinedPrivateChannel.name); // * Verify empty search state for find channels + await wait(timeouts.ONE_SEC); await expect(element(by.text(`No matches found for “${unjoinedPrivateChannel.name}”`))).toBeVisible(); // # Go back to channel list screen diff --git a/detox/e2e/test/messaging/emojis_and_reactions.e2e.ts b/detox/e2e/test/messaging/emojis_and_reactions.e2e.ts index e96733069d..e735417ad7 100644 --- a/detox/e2e/test/messaging/emojis_and_reactions.e2e.ts +++ b/detox/e2e/test/messaging/emojis_and_reactions.e2e.ts @@ -151,8 +151,8 @@ describe('Messaging - Emojis and Reactions', () => { // * Verify emojis exist in recently used section await expect(element(by.text('RECENTLY USED'))).toExist(); - await expect(element(by.text('🦊'))).toExist(); - await expect(element(by.text('🐶'))).toExist(); + await expect(element(by.text('🦊')).atIndex(0)).toExist(); + await expect(element(by.text('🐶')).atIndex(0)).toExist(); // # Go back to channel list screen await EmojiPickerScreen.close(); diff --git a/detox/e2e/test/smoke_test/messaging.e2e.ts b/detox/e2e/test/smoke_test/messaging.e2e.ts index 084d3f08ac..aaea30cec9 100644 --- a/detox/e2e/test/smoke_test/messaging.e2e.ts +++ b/detox/e2e/test/smoke_test/messaging.e2e.ts @@ -174,6 +174,7 @@ describe('Smoke Test - Messaging', () => { await PostOptionsScreen.savePostOption.tap(); // * Verify saved text is displayed on the post pre-header + await wait(timeouts.ONE_SEC); const {postListPostItemPreHeaderText: channelPostListPostItemPreHeaderText} = ChannelScreen.getPostListPostItem(post.id, message); await expect(channelPostListPostItemPreHeaderText).toHaveText(savedText); @@ -199,6 +200,7 @@ describe('Smoke Test - Messaging', () => { await PostOptionsScreen.unpinPostOption.tap(); // * Verify pinned text is not displayed on the post pre-header + await wait(timeouts.ONE_SEC); await expect(channelPostListPostItemPreHeaderText).not.toBeVisible(); // # Go back to channel list screen