1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Chore: Mobile: Add note screen tests (#10766)

This commit is contained in:
Henry Heino
2024-07-26 04:35:50 -07:00
committed by GitHub
parent d2028588e8
commit 8c0769fdb3
16 changed files with 300 additions and 35 deletions

View File

@@ -14,6 +14,7 @@ import { HandleMessageCallback, OnMarkForDownloadCallback } from './hooks/useOnM
import Resource from '@joplin/lib/models/Resource';
import shim from '@joplin/lib/shim';
import Note from '@joplin/lib/models/Note';
import getWebViewDomById from '../../utils/testing/getWebViewDomById';
interface WrapperProps {
noteBody: string;
@@ -56,17 +57,8 @@ const WrappedNoteViewer: React.FC<WrapperProps> = (
</MenuProvider>;
};
const getNoteViewerDom = async (): Promise<Document> => {
const webviewContent = await screen.findByTestId('NoteBodyViewer');
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;
const getNoteViewerDom = async () => {
return await getWebViewDomById('NoteBodyViewer');
};
describe('NoteBodyViewer', () => {