From 35fe4081f74f89cff4d2c77571614eecf06e2656 Mon Sep 17 00:00:00 2001 From: Joseph Baylon Date: Sat, 12 Mar 2022 11:44:04 -0800 Subject: [PATCH] MM-41855 Detox/E2E: Initial e2e tests in Gekidou (#6029) * Detox/E2E: Initial e2e tests in Gekidou * Change Local Server to Server 1 * Renamed variables for consistency * Added team display name verification on channel list screen * Simplified login by email setup * Simplified smoke test server login steps --- .../header/__snapshots__/header.test.tsx.snap | 2 + app/components/channel_list/header/header.tsx | 10 +- .../floating_text_input_label/index.tsx | 10 +- app/screens/home/account/index.tsx | 1 + .../home/channel_list/channel_list.tsx | 1 + app/screens/home/index.tsx | 6 +- app/screens/login/form.tsx | 10 +- app/screens/login/index.tsx | 15 ++- app/screens/server/form.tsx | 10 +- app/screens/server/header.tsx | 8 +- app/screens/server/index.tsx | 5 +- detox/e2e/init.js | 11 +- detox/e2e/support/server_api/system.js | 4 +- detox/e2e/support/test_config.js | 8 +- detox/e2e/support/ui/component/alert.js | 20 ++++ detox/e2e/support/ui/component/index.js | 4 +- detox/e2e/support/ui/screen/account.js | 41 +++++++ detox/e2e/support/ui/screen/channel_list.js | 33 ++++++ detox/e2e/support/ui/screen/home.js | 44 ++++++++ detox/e2e/support/ui/screen/index.js | 12 +- detox/e2e/support/ui/screen/login.js | 58 ++++++++++ detox/e2e/support/ui/screen/server.js | 51 +++++++++ detox/e2e/support/utils/email.js | 41 +++---- .../server_login/connect_to_server.e2e.js | 104 ++++++++++++++++++ .../test/server_login/login_by_email.e2e.js | 94 ++++++++++++++++ detox/e2e/test/smoke_test/server_login.e2e.js | 49 +++++++++ 26 files changed, 589 insertions(+), 63 deletions(-) create mode 100644 detox/e2e/support/ui/component/alert.js create mode 100644 detox/e2e/support/ui/screen/account.js create mode 100644 detox/e2e/support/ui/screen/channel_list.js create mode 100644 detox/e2e/support/ui/screen/home.js create mode 100644 detox/e2e/support/ui/screen/login.js create mode 100644 detox/e2e/support/ui/screen/server.js create mode 100644 detox/e2e/test/server_login/connect_to_server.e2e.js create mode 100644 detox/e2e/test/server_login/login_by_email.e2e.js create mode 100644 detox/e2e/test/smoke_test/server_login.e2e.js diff --git a/app/components/channel_list/header/__snapshots__/header.test.tsx.snap b/app/components/channel_list/header/__snapshots__/header.test.tsx.snap index 0cb902360..f07273d48 100644 --- a/app/components/channel_list/header/__snapshots__/header.test.tsx.snap +++ b/app/components/channel_list/header/__snapshots__/header.test.tsx.snap @@ -61,6 +61,7 @@ exports[`components/channel_list/header Channel List Header Component should mat "lineHeight": 36, } } + testID="channel_list_header.team_display_name" > Test! @@ -127,6 +128,7 @@ exports[`components/channel_list/header Channel List Header Component should mat "lineHeight": 16, } } + testID="channel_list_header.server_display_name" > diff --git a/app/components/channel_list/header/header.tsx b/app/components/channel_list/header/header.tsx index 98f899e8f..e11bfc45d 100644 --- a/app/components/channel_list/header/header.tsx +++ b/app/components/channel_list/header/header.tsx @@ -116,7 +116,10 @@ const ChannelListHeader = ({canCreateChannels, canJoinChannels, displayName, ico type='opacity' > - + {displayName} @@ -139,7 +142,10 @@ const ChannelListHeader = ({canCreateChannels, canJoinChannels, displayName, ico } - + {serverDisplayName} diff --git a/app/components/floating_text_input_label/index.tsx b/app/components/floating_text_input_label/index.tsx index 71235085a..170ac2d75 100644 --- a/app/components/floating_text_input_label/index.tsx +++ b/app/components/floating_text_input_label/index.tsx @@ -106,6 +106,7 @@ type FloatingTextInputProps = TextInputProps & { onPress?: (e: GestureResponderEvent) => void; showErrorIcon?: boolean; theme: Theme; + testID?: string; value: string; } @@ -124,6 +125,7 @@ const FloatingTextInput = forwardRef { const [focusedLabel, setIsFocusLabel] = useState(); @@ -255,6 +257,7 @@ const FloatingTextInput = forwardRef {Boolean(error) && ( @@ -264,7 +267,12 @@ const FloatingTextInput = forwardRef } - {error} + + {error} + )} diff --git a/app/screens/home/account/index.tsx b/app/screens/home/account/index.tsx index f265f5378..4576878a7 100644 --- a/app/screens/home/account/index.tsx +++ b/app/screens/home/account/index.tsx @@ -105,6 +105,7 @@ const AccountScreen = ({currentUser, enableCustomUserStatuses, customStatusExpir diff --git a/app/screens/home/channel_list/channel_list.tsx b/app/screens/home/channel_list/channel_list.tsx index d8666ca33..62cc76a71 100644 --- a/app/screens/home/channel_list/channel_list.tsx +++ b/app/screens/home/channel_list/channel_list.tsx @@ -83,6 +83,7 @@ const ChannelListScreen = (props: ChannelProps) => { {canAddOtherServers && } {() => } diff --git a/app/screens/login/form.tsx b/app/screens/login/form.tsx index 8f5ca19b4..4d0eb4455 100644 --- a/app/screens/login/form.tsx +++ b/app/screens/login/form.tsx @@ -310,12 +310,14 @@ const LoginForm = ({config, extra, keyboardAwareRef, numberSSOs, serverDisplayNa ); } + const signinButtonTestId = buttonDisabled ? 'login_form.signin.button.disabled' : 'login_form.signin.button'; + return ( )} diff --git a/app/screens/login/index.tsx b/app/screens/login/index.tsx index 29ee1d2cd..3277492a1 100644 --- a/app/screens/login/index.tsx +++ b/app/screens/login/index.tsx @@ -83,7 +83,7 @@ const LoginOptions = ({config, extra, hasLoginForm, launchType, launchError, lic ); @@ -92,7 +92,7 @@ const LoginOptions = ({config, extra, hasLoginForm, launchType, launchError, lic ); @@ -102,7 +102,7 @@ const LoginOptions = ({config, extra, hasLoginForm, launchType, launchError, lic ); @@ -150,7 +150,7 @@ const LoginOptions = ({config, extra, hasLoginForm, launchType, launchError, lic ); @@ -159,14 +159,17 @@ const LoginOptions = ({config, extra, hasLoginForm, launchType, launchError, lic ); } return ( - + @@ -181,7 +183,7 @@ const ServerForm = ({ ref={urlRef} returnKeyType='next' spellCheck={false} - testID='select_server.server_url.input' + testID='server_form.server_url.input' theme={theme} value={url} /> @@ -203,7 +205,7 @@ const ServerForm = ({ ref={displayNameRef} returnKeyType='done' spellCheck={false} - testID='select_server.server_display_name.input' + testID='server_form.server_display_name.input' theme={theme} value={displayName} /> @@ -213,14 +215,14 @@ const ServerForm = ({ defaultMessage={'Choose a display name for your server'} id={'mobile.components.select_server_view.displayHelp'} style={styles.chooseText} - testID={'mobile.components.select_server_view.displayHelp'} + testID={'server_form.display_help'} /> }