From ee477c16faaddd74601d52bc339fd9cdb6fcde4d Mon Sep 17 00:00:00 2001 From: Joseph Baylon Date: Mon, 6 Feb 2023 12:21:31 -0800 Subject: [PATCH] Fix server login e2e for android --- detox/e2e/support/ui/screen/server_list.ts | 16 ++++++++++++---- .../test/server_login/connect_to_server.e2e.ts | 16 ++++++++++------ 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/detox/e2e/support/ui/screen/server_list.ts b/detox/e2e/support/ui/screen/server_list.ts index 13abd97432..4853a0c43d 100644 --- a/detox/e2e/support/ui/screen/server_list.ts +++ b/detox/e2e/support/ui/screen/server_list.ts @@ -62,7 +62,10 @@ class ServerListScreen { // # Open server list screen await ChannelListScreen.serverIcon.tap(); - return this.toBeVisible(); + if (isIos()) { + return this.toBeVisible(); + } + return null; }; close = async () => { @@ -77,9 +80,14 @@ class ServerListScreen { }; 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(); + } }; } diff --git a/detox/e2e/test/server_login/connect_to_server.e2e.ts b/detox/e2e/test/server_login/connect_to_server.e2e.ts index f0bdcdfa50..56f87e9a04 100644 --- a/detox/e2e/test/server_login/connect_to_server.e2e.ts +++ b/detox/e2e/test/server_login/connect_to_server.e2e.ts @@ -12,11 +12,12 @@ import { LoginScreen, ServerScreen, } from '@support/ui/screen'; -import {timeouts} from '@support/utils'; +import {timeouts, wait} from '@support/utils'; import {expect} from 'detox'; describe('Server Login - Connect to Server', () => { const { + connectButton, connectButtonDisabled, displayHelp, headerDescription, @@ -25,7 +26,6 @@ describe('Server Login - Connect to Server', () => { serverDisplayNameInput, serverUrlInput, serverUrlInputError, - tapConnectButton, } = ServerScreen; beforeEach(async () => { @@ -69,7 +69,8 @@ describe('Server Login - Connect to Server', () => { const invalidServerUrl = 'invalid'; await serverUrlInput.replaceText(invalidServerUrl); await serverDisplayNameInput.replaceText('Server 1'); - await tapConnectButton(); + await connectButton.tap(); + await wait(timeouts.ONE_SEC); // * Verify invalid url error await waitFor(serverUrlInputError).toExist().withTimeout(timeouts.TEN_SEC); @@ -81,7 +82,8 @@ describe('Server Login - Connect to Server', () => { const connectionError = 'Cannot connect to the server.'; await serverUrlInput.replaceText('expired.badssl.com'); await serverDisplayNameInput.replaceText('Server 1'); - await tapConnectButton(); + await connectButton.tap(); + await wait(timeouts.ONE_SEC); // * Verify connection error await waitFor(serverUrlInputError).toExist().withTimeout(timeouts.TEN_SEC); @@ -91,7 +93,8 @@ describe('Server Login - Connect to Server', () => { await device.reloadReactNative(); await serverUrlInput.replaceText('wrong.host.badssl.com'); await serverDisplayNameInput.replaceText('Server 1'); - await tapConnectButton(); + await connectButton.tap(); + await wait(timeouts.ONE_SEC); // * Verify connection error await waitFor(serverUrlInputError).toExist().withTimeout(timeouts.TEN_SEC); @@ -102,7 +105,8 @@ describe('Server Login - Connect to Server', () => { // # Connect to server with valid server url and non-empty server display name await serverUrlInput.replaceText(serverOneUrl); await serverDisplayNameInput.replaceText('Server 1'); - await tapConnectButton(); + await connectButton.tap(); + await wait(timeouts.ONE_SEC); // * Verify on login screen await LoginScreen.toBeVisible();