From 3566a4e8ceba79f033928a972fbc45d04d95ced0 Mon Sep 17 00:00:00 2001 From: Joseph Baylon Date: Mon, 6 Feb 2023 13:32:15 -0800 Subject: [PATCH] Fix smoke test e2e for android --- .../ui/screen/create_direct_message.ts | 19 ++++++++++++++----- detox/e2e/support/ui/screen/login.ts | 1 + detox/e2e/support/ui/screen/server.ts | 1 + detox/e2e/support/ui/screen/server_list.ts | 1 + detox/e2e/test/messaging/message_post.e2e.ts | 3 ++- detox/e2e/test/smoke_test/channels.e2e.ts | 10 +++++----- 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/detox/e2e/support/ui/screen/create_direct_message.ts b/detox/e2e/support/ui/screen/create_direct_message.ts index 505ef76b80..6b206e003c 100644 --- a/detox/e2e/support/ui/screen/create_direct_message.ts +++ b/detox/e2e/support/ui/screen/create_direct_message.ts @@ -3,7 +3,7 @@ import {ProfilePicture} from '@support/ui/component'; import {ChannelListScreen} from '@support/ui/screen'; -import {timeouts, wait} from '@support/utils'; +import {isIos, timeouts, wait} from '@support/utils'; import {expect} from 'detox'; class CreateDirectMessageScreen { @@ -69,7 +69,10 @@ class CreateDirectMessageScreen { await wait(timeouts.ONE_SEC); await ChannelListScreen.openDirectMessageItem.tap(); - return this.toBeVisible(); + if (isIos()) { + return this.toBeVisible(); + } + return null; }; close = async () => { @@ -78,9 +81,15 @@ class CreateDirectMessageScreen { }; closeTutorial = async () => { - await waitFor(this.tutorialHighlight).toExist().withTimeout(timeouts.TEN_SEC); - await this.tutorialSwipeLeft.tap(); - await expect(this.tutorialHighlight).not.toExist(); + if (isIos()) { + await waitFor(this.tutorialHighlight).toExist().withTimeout(timeouts.TEN_SEC); + await this.tutorialSwipeLeft.tap(); + await expect(this.tutorialHighlight).not.toExist(); + } else { + await wait(timeouts.ONE_SEC); + await device.pressBack(); + await wait(timeouts.ONE_SEC); + } }; } diff --git a/detox/e2e/support/ui/screen/login.ts b/detox/e2e/support/ui/screen/login.ts index c78119eb0f..6a63024d99 100644 --- a/detox/e2e/support/ui/screen/login.ts +++ b/detox/e2e/support/ui/screen/login.ts @@ -39,6 +39,7 @@ class LoginScreen { signinButtonDisabled = element(by.id(this.testID.signinButtonDisabled)); toBeVisible = async () => { + await wait(timeouts.ONE_SEC); await waitFor(this.loginScreen).toExist().withTimeout(timeouts.TEN_SEC); await waitFor(this.usernameInput).toBeVisible().withTimeout(timeouts.TEN_SEC); diff --git a/detox/e2e/support/ui/screen/server.ts b/detox/e2e/support/ui/screen/server.ts index 27b822fe69..0708ad8603 100644 --- a/detox/e2e/support/ui/screen/server.ts +++ b/detox/e2e/support/ui/screen/server.ts @@ -58,6 +58,7 @@ class ServerScreen { tapConnectButton = async () => { if (isAndroid()) { await device.pressBack(); + await wait(timeouts.ONE_SEC); } await this.connectButton.tap(); await wait(timeouts.ONE_SEC); diff --git a/detox/e2e/support/ui/screen/server_list.ts b/detox/e2e/support/ui/screen/server_list.ts index 4853a0c43d..97b2ecc7a3 100644 --- a/detox/e2e/support/ui/screen/server_list.ts +++ b/detox/e2e/support/ui/screen/server_list.ts @@ -87,6 +87,7 @@ class ServerListScreen { } else { await wait(timeouts.ONE_SEC); await device.pressBack(); + await wait(timeouts.ONE_SEC); } }; } diff --git a/detox/e2e/test/messaging/message_post.e2e.ts b/detox/e2e/test/messaging/message_post.e2e.ts index bdb32a9d54..6caf669b25 100644 --- a/detox/e2e/test/messaging/message_post.e2e.ts +++ b/detox/e2e/test/messaging/message_post.e2e.ts @@ -22,7 +22,7 @@ import { LoginScreen, ServerScreen, } from '@support/ui/screen'; -import {getRandomId, isAndroid} from '@support/utils'; +import {getRandomId, isAndroid, timeouts, wait} from '@support/utils'; import {expect} from 'detox'; describe('Messaging - Message Post', () => { @@ -89,6 +89,7 @@ describe('Messaging - Message Post', () => { // * Verify long message is posted and displays show more button (chevron down button) if (isAndroid()) { await device.pressBack(); + await wait(timeouts.ONE_SEC); } const {postListPostItem, postListPostItemShowLessButton, postListPostItemShowMoreButton} = ChannelScreen.getPostListPostItem(post.id, longMessage); await expect(postListPostItem).toBeVisible(); diff --git a/detox/e2e/test/smoke_test/channels.e2e.ts b/detox/e2e/test/smoke_test/channels.e2e.ts index 3d94f99ec8..040853ee78 100644 --- a/detox/e2e/test/smoke_test/channels.e2e.ts +++ b/detox/e2e/test/smoke_test/channels.e2e.ts @@ -30,7 +30,7 @@ import { LoginScreen, ServerScreen, } from '@support/ui/screen'; -import {getRandomId} from '@support/utils'; +import {getRandomId, timeouts, wait} from '@support/utils'; import {expect} from 'detox'; describe('Smoke Test - Channels', () => { @@ -66,6 +66,7 @@ describe('Smoke Test - Channels', () => { const {channel} = await Channel.apiCreateChannel(siteOneUrl, {teamId: testTeam.id}); await BrowseChannelsScreen.open(); await BrowseChannelsScreen.searchInput.replaceText(channel.name); + await wait(timeouts.ONE_SEC); await BrowseChannelsScreen.getChannelItem(channel.name).multiTap(2); // * Verify on newly joined channel screen @@ -106,6 +107,7 @@ describe('Smoke Test - Channels', () => { await CreateDirectMessageScreen.open(); await CreateDirectMessageScreen.closeTutorial(); await CreateDirectMessageScreen.searchInput.replaceText(newUserDisplayName); + await wait(timeouts.ONE_SEC); await CreateDirectMessageScreen.getUserItem(newUser.id).tap(); await CreateDirectMessageScreen.startButton.tap(); @@ -137,6 +139,7 @@ describe('Smoke Test - Channels', () => { // # Open find channels screen, search for the channel to navigate to, and tap on the target channel item await FindChannelsScreen.open(); await FindChannelsScreen.searchInput.replaceText(testChannel.name); + await wait(timeouts.ONE_SEC); await FindChannelsScreen.getFilteredChannelItem(testChannel.name).tap(); // * Verify on target channel screen @@ -146,10 +149,7 @@ describe('Smoke Test - Channels', () => { // # Open channel info screen, open edit channel screen, edit channel info, and save changes await ChannelInfoScreen.open(); await CreateOrEditChannelScreen.openEditChannel(); - await CreateOrEditChannelScreen.headerInput.tapReturnKey(); - await CreateOrEditChannelScreen.headerInput.typeText('header1'); - await CreateOrEditChannelScreen.headerInput.tapReturnKey(); - await CreateOrEditChannelScreen.headerInput.typeText('header2'); + await CreateOrEditChannelScreen.headerInput.typeText('\nheader1\nheader2'); await CreateOrEditChannelScreen.saveButton.tap(); // * Verify on channel info screen and changes have been saved