diff --git a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/index.e2e.tsx b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/index.e2e.tsx index 7f169ef15918..682d3e8605b9 100644 --- a/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/index.e2e.tsx +++ b/src/pages/home/report/ReportActionCompose/ComposerWithSuggestions/index.e2e.tsx @@ -1,5 +1,6 @@ import type {ForwardedRef} from 'react'; import React, {forwardRef, useEffect} from 'react'; +import {Keyboard} from 'react-native'; import E2EClient from '@libs/E2E/client'; import type {ComposerRef} from '@pages/home/report/ReportActionCompose/ReportActionCompose'; import type {ComposerWithSuggestionsProps} from './ComposerWithSuggestions'; @@ -26,11 +27,26 @@ function ComposerWithSuggestionsE2e(props: ComposerWithSuggestionsProps, ref: Fo // We need to wait for the component to be mounted before focusing setTimeout(() => { - if (!(ref && 'current' in ref)) { - return; - } + const setFocus = () => { + if (!(ref && 'current' in ref)) { + return; + } - ref.current?.focus(true); + ref.current?.focus(true); + + setTimeout(() => { + // and actually let's verify that the keyboard is visible + if (Keyboard.isVisible()) { + return; + } + + ref.current?.blur(); + setFocus(); + // 500ms is enough time for any keyboard to open + }, 500); + }; + + setFocus(); }, 1); }, [ref]); diff --git a/tests/e2e/config.ts b/tests/e2e/config.ts index 4120019de692..c7cb9d0ed3c7 100644 --- a/tests/e2e/config.ts +++ b/tests/e2e/config.ts @@ -74,15 +74,14 @@ export default { [TEST_NAMES.OpenChatFinderPage]: { name: TEST_NAMES.OpenChatFinderPage, }, - // TODO: Fix text and enable again - // [TEST_NAMES.ReportTyping]: { - // name: TEST_NAMES.ReportTyping, - // reportScreen: { - // autoFocus: true, - // }, - // // Crowded Policy (Do Not Delete) Report, has a input bar available: - // reportID: '8268282951170052', - // }, + [TEST_NAMES.ReportTyping]: { + name: TEST_NAMES.ReportTyping, + reportScreen: { + autoFocus: true, + }, + // Crowded Policy (Do Not Delete) Report, has a input bar available: + reportID: '8268282951170052', + }, [TEST_NAMES.ChatOpening]: { name: TEST_NAMES.ChatOpening, // #announce Chat with many messages