1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Chore: Mobile: Increase test waitFor timeouts (#12475)

This commit is contained in:
Henry Heino
2025-06-11 14:42:06 -07:00
committed by GitHub
parent 3b7a677302
commit b81f5cb91e
21 changed files with 32 additions and 18 deletions

View File

@ -916,6 +916,7 @@ packages/app-mobile/utils/testing/createMockReduxStore.js
packages/app-mobile/utils/testing/getWebViewDomById.js
packages/app-mobile/utils/testing/getWebViewWindowById.js
packages/app-mobile/utils/testing/setupGlobalStore.js
packages/app-mobile/utils/testing/testingLibrary.js
packages/app-mobile/utils/types.js
packages/app-mobile/web/serviceWorker.js
packages/app-mobile/web/webpack.config.js

1
.gitignore vendored
View File

@ -891,6 +891,7 @@ packages/app-mobile/utils/testing/createMockReduxStore.js
packages/app-mobile/utils/testing/getWebViewDomById.js
packages/app-mobile/utils/testing/getWebViewWindowById.js
packages/app-mobile/utils/testing/setupGlobalStore.js
packages/app-mobile/utils/testing/testingLibrary.js
packages/app-mobile/utils/types.js
packages/app-mobile/web/serviceWorker.js
packages/app-mobile/web/webpack.config.js

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import CameraView from './CameraView';
import { CameraResult } from './types';
import { fireEvent, render, screen } from '@testing-library/react-native';
import { fireEvent, render, screen } from '../../utils/testing/testingLibrary';
import createMockReduxStore from '../../utils/testing/createMockReduxStore';
import TestProviderStack from '../testing/TestProviderStack';

View File

@ -2,7 +2,7 @@ import * as React from 'react';
import { Text } from 'react-native';
import { describe, it, expect, jest } from '@jest/globals';
import { fireEvent, render, screen, waitFor } from '@testing-library/react-native';
import { fireEvent, render, screen, waitFor } from '../utils/testing/testingLibrary';
import Dropdown, { DropdownListItem } from './Dropdown';

View File

@ -1,5 +1,5 @@
import * as React from 'react';
import { fireEvent, render, screen, waitFor } from '@testing-library/react-native';
import { fireEvent, render, screen, waitFor } from '../../utils/testing/testingLibrary';
import { Store } from 'redux';
import { AppState } from '../../utils/types';

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { describe, it, beforeEach } from '@jest/globals';
import { render, screen, waitFor } from '@testing-library/react-native';
import { render, screen, waitFor } from '../../utils/testing/testingLibrary';
import NoteBodyViewer from './NoteBodyViewer';

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { describe, it, expect, beforeEach } from '@jest/globals';
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react-native';
import { act, fireEvent, render, screen, waitFor } from '../../utils/testing/testingLibrary';
import NoteEditor from './NoteEditor';
import Setting from '@joplin/lib/models/Setting';

View File

@ -4,7 +4,7 @@ import CommandService from '@joplin/lib/services/CommandService';
import useEditorCommandHandler from './useEditorCommandHandler';
import commandDeclarations from '../commandDeclarations';
import createTestEditorControl from '@joplin/editor/CodeMirror/testUtil/createEditorControl';
import { renderHook } from '@testing-library/react-native';
import { renderHook } from '../../../utils/testing/testingLibrary';
import { defaultState } from '@joplin/lib/reducer';

View File

@ -2,7 +2,7 @@ import * as React from 'react';
import { WarningBannerComponent } from './WarningBanner';
import Setting from '@joplin/lib/models/Setting';
import NavService from '@joplin/lib/services/NavService';
import { render, screen, userEvent } from '@testing-library/react-native';
import { render, screen, userEvent } from '../../utils/testing/testingLibrary';
import { ShareInvitation, ShareUserStatus } from '@joplin/lib/services/share/reducer';
import makeShareInvitation from '@joplin/lib/testing/share/makeMockShareInvitation';

View File

@ -1,6 +1,6 @@
import * as React from 'react';
import FocusControl from './FocusControl/FocusControl';
import { render } from '@testing-library/react-native';
import { render } from '../../utils/testing/testingLibrary';
import AccessibleView from './AccessibleView';
import { AccessibilityInfo } from 'react-native';
import ModalWrapper from './FocusControl/ModalWrapper';

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { _ } from '@joplin/lib/locale';
import { act, fireEvent, render, waitFor } from '@testing-library/react-native';
import { act, fireEvent, render, waitFor } from '../../../../utils/testing/testingLibrary';
import { expect, describe, beforeEach, test, jest } from '@jest/globals';
import { createNTestNotes, setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
import Folder from '@joplin/lib/models/Folder';

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { createTempDir, mockMobilePlatform, setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
import { act, fireEvent, render, screen, userEvent, waitFor } from '@testing-library/react-native';
import { act, fireEvent, render, screen, userEvent, waitFor } from '../../../../utils/testing/testingLibrary';
import PluginService, { PluginSettings, defaultPluginSetting } from '@joplin/lib/services/plugins/PluginService';
import pluginServiceSetup from './testUtils/pluginServiceSetup';

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { mockMobilePlatform, setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
import { render, screen, userEvent, waitFor } from '@testing-library/react-native';
import { render, screen, userEvent, waitFor } from '../../../../utils/testing/testingLibrary';
import pluginServiceSetup from './testUtils/pluginServiceSetup';
import createMockReduxStore from '../../../../utils/testing/createMockReduxStore';

View File

@ -1,7 +1,7 @@
import * as React from 'react';
import { describe, it, beforeEach } from '@jest/globals';
import { act, fireEvent, render, screen, userEvent, waitFor } from '@testing-library/react-native';
import { act, fireEvent, render, screen, userEvent, waitFor } from '../../../utils/testing/testingLibrary';
import NoteScreen from './Note';
import { setupDatabaseAndSynchronizer, switchClient, simulateReadOnlyShareEnv, supportDir, synchronizerStart, resourceFetcher, runWithFakeTimers } from '@joplin/lib/testing/test-utils';

View File

@ -6,7 +6,7 @@ import NoteRevisionViewer from './NoteRevisionViewer';
import { setupDatabaseAndSynchronizer, switchClient, revisionService } from '@joplin/lib/testing/test-utils';
import createMockReduxStore from '../../utils/testing/createMockReduxStore';
import setupGlobalStore from '../../utils/testing/setupGlobalStore';
import { fireEvent, render, screen, waitFor } from '@testing-library/react-native';
import { fireEvent, render, screen, waitFor } from '../../utils/testing/testingLibrary';
import Note from '@joplin/lib/models/Note';
import { useMemo } from 'react';
import Revision from '@joplin/lib/models/Revision';

View File

@ -5,7 +5,7 @@ import { AppState } from '../../../utils/types';
import { Store } from 'redux';
import createMockReduxStore from '../../../utils/testing/createMockReduxStore';
import setupGlobalStore from '../../../utils/testing/setupGlobalStore';
import { act, render, screen, waitFor } from '@testing-library/react-native';
import { act, render, screen, waitFor } from '../../../utils/testing/testingLibrary';
import { AccessibilityActionInfo } from 'react-native';
import { setupDatabaseAndSynchronizer } from '@joplin/lib/testing/test-utils';
import Folder from '@joplin/lib/models/Folder';

View File

@ -2,7 +2,7 @@ import * as React from 'react';
import { ShareManagerComponent } from './index';
import Setting from '@joplin/lib/models/Setting';
import mockShareService from '@joplin/lib/testing/share/mockShareService';
import { act, render, screen, userEvent, waitFor } from '@testing-library/react-native';
import { act, render, screen, userEvent, waitFor } from '../../../utils/testing/testingLibrary';
import { ShareInvitation, ShareUserStatus } from '@joplin/lib/services/share/reducer';
import { setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
import ShareService from '@joplin/lib/services/share/ShareService';

View File

@ -8,7 +8,7 @@ import TestProviderStack from '../testing/TestProviderStack';
import ShareNoteDialog from './ShareNoteDialog';
import Note from '@joplin/lib/models/Note';
import mockShareService from '@joplin/lib/testing/share/mockShareService';
import { fireEvent, render, screen, waitFor } from '@testing-library/react-native';
import { fireEvent, render, screen, waitFor } from '../../utils/testing/testingLibrary';
import Folder from '@joplin/lib/models/Folder';
import ShareService from '@joplin/lib/services/share/ShareService';

View File

@ -7,7 +7,7 @@ import { loadEncryptionMasterKey, setupDatabaseAndSynchronizer, switchClient, sy
import createMockReduxStore from '../../utils/testing/createMockReduxStore';
import setupGlobalStore from '../../utils/testing/setupGlobalStore';
import { getActiveMasterKeyId, setEncryptionEnabled, setMasterKeyEnabled } from '@joplin/lib/services/synchronizer/syncInfoUtils';
import { act, render, screen } from '@testing-library/react-native';
import { act, render, screen } from '../../utils/testing/testingLibrary';
interface WrapperProps { }

View File

@ -1,4 +1,4 @@
import { screen, waitFor } from '@testing-library/react-native';
import { screen, waitFor } from './testingLibrary';
const getWebViewWindowById = async (id: string): Promise<Window> => {
const webviewContent = await screen.findByTestId(id);

View File

@ -0,0 +1,12 @@
import * as testingLibrary from '@testing-library/react-native';
// This file wraps @testing-library/react-native to allow configuring it
// only if it's going to be used. Attempting to do this with a jest.mock
// fails with "Cannot add a hook after tests have started running. Hooks must be defined synchronously."
// Calling .configure for all tests causes jsdom-based tests to fail.
testingLibrary.configure({
// The default timeout of 1_000 ms is often too low in CI.
asyncUtilTimeout: 5_000,
});
export * from '@testing-library/react-native';