Skip to content

Commit

Permalink
Merge pull request #43178 from margelo/e2e/fixed-typing-test
Browse files Browse the repository at this point in the history
[NoQA] e2e: fixed typing test
  • Loading branch information
mountiny authored Jun 17, 2024
2 parents f415fa9 + e4e3f6a commit 5957d9a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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]);

Expand Down
17 changes: 8 additions & 9 deletions tests/e2e/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5957d9a

Please sign in to comment.