1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-18 09:35:20 +02:00
joplin/packages/app-mobile/utils/testing/getWebViewDomById.ts
2024-07-26 12:35:50 +01:00

16 lines
547 B
TypeScript

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;