1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-21 09:38:01 +02:00
joplin/packages/app-mobile/utils/testing/getWebViewDomById.ts

16 lines
547 B
TypeScript
Raw Normal View History

import { screen, waitFor } from '@testing-library/react-native';
const getWebViewDomById = async (id: string): Promise<Document> => {
const webviewContent = await screen.findByTestId(id);
expect(webviewContent).toBeVisible();
await waitFor(() => {
expect(!!webviewContent.props.document).toBe(true);
});
// Return the composite ExtendedWebView component
// See https://callstack.github.io/react-native-testing-library/docs/advanced/testing-env#tree-navigation
return webviewContent.props.document;
};
export default getWebViewDomById;