Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NOQA] Upgrade RNTL to the newest version #53067

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@
"@storybook/react-webpack5": "^8.1.6",
"@storybook/theming": "^8.1.10",
"@svgr/webpack": "^6.0.0",
"@testing-library/jest-native": "5.4.1",
"@testing-library/react-native": "11.5.1",
"@testing-library/jest-native": "5.4.2",
"@testing-library/react-native": "12.8.1",
"@trivago/prettier-plugin-sort-imports": "^4.2.0",
"@types/base-64": "^1.0.2",
"@types/canvas-size": "^1.2.2",
Expand Down
30 changes: 20 additions & 10 deletions tests/perf-test/ReportActionsList.perf-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ import {ReportAttachmentsProvider} from '@src/pages/home/report/ReportAttachment
import {ActionListContext, ReactionListContext} from '@src/pages/home/ReportScreenContext';
import type {PersonalDetailsList} from '@src/types/onyx';
import createRandomReportAction from '../utils/collections/reportActions';
import * as LHNTestUtilsModule from '../utils/LHNTestUtils';
import createRandomReport from '../utils/collections/reports';
import * as ReportTestUtils from '../utils/ReportTestUtils';
import * as TestHelper from '../utils/TestHelper';
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';
import wrapOnyxWithWaitForBatchedUpdates from '../utils/wrapOnyxWithWaitForBatchedUpdates';

Expand Down Expand Up @@ -71,11 +72,25 @@ const mockOnScroll = jest.fn();
const mockLoadChats = jest.fn();
const mockRef = {current: null, flatListRef: null, scrollPosition: null, setScrollPosition: () => {}};

const TEST_USER_ACCOUNT_ID = 1;
const TEST_USER_LOGIN = '[email protected]';

const signUpWithTestUser = () => {
TestHelper.signInWithTestUser(TEST_USER_ACCOUNT_ID, TEST_USER_LOGIN);
};

const report = createRandomReport(1);
const parentReportAction = createRandomReportAction(1);

beforeEach(() => {
// Initialize the network key for OfflineWithFeedback
Onyx.merge(ONYXKEYS.NETWORK, {isOffline: false});
wrapOnyxWithWaitForBatchedUpdates(Onyx);
Onyx.clear().then(waitForBatchedUpdates);
signUpWithTestUser();
});

afterEach(() => {
Onyx.clear();
});

function ReportActionsListWrapper() {
Expand All @@ -84,17 +99,17 @@ function ReportActionsListWrapper() {
<ReactionListContext.Provider value={mockRef}>
<ActionListContext.Provider value={mockRef}>
<ReportActionsList
parentReportAction={createRandomReportAction(1)}
parentReportAction={parentReportAction}
parentReportActionForTransactionThread={undefined}
sortedReportActions={ReportTestUtils.getMockedSortedReportActions(500)}
report={LHNTestUtilsModule.getFakeReport()}
report={report}
onLayout={mockOnLayout}
onScroll={mockOnScroll}
onContentSizeChange={() => {}}
listID={1}
loadOlderChats={mockLoadChats}
loadNewerChats={mockLoadChats}
transactionThreadReport={LHNTestUtilsModule.getFakeReport()}
transactionThreadReport={report}
reportActions={ReportTestUtils.getMockedSortedReportActions(500)}
/>
</ActionListContext.Provider>
Expand All @@ -108,10 +123,5 @@ test('[ReportActionsList] should render ReportActionsList with 500 reportActions
await screen.findByTestId('report-actions-list');
};
await waitForBatchedUpdates();

Onyx.multiSet({
[ONYXKEYS.PERSONAL_DETAILS_LIST]: LHNTestUtilsModule.fakePersonalDetails,
});

await measureRenders(<ReportActionsListWrapper />, {scenario});
});
10 changes: 5 additions & 5 deletions tests/ui/UnreadIndicatorsTest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ function navigateToSidebar(): Promise<void> {

function areYouOnChatListScreen(): boolean {
const hintText = Localize.translateLocal('sidebarScreen.listOfChats');
const sidebarLinks = screen.queryAllByLabelText(hintText);
const sidebarLinks = screen.queryAllByLabelText(hintText, {includeHiddenElements: true});

return !sidebarLinks?.at(0)?.props?.accessibilityElementsHidden;
}
Expand Down Expand Up @@ -365,12 +365,12 @@ describe('Unread Indicators', () => {
await act(() => (NativeNavigation as NativeNavigationMock).triggerTransitionEnd());
// Verify that report we navigated to appears in a "read" state while the original unread report still shows as unread
const hintText = Localize.translateLocal('accessibilityHints.chatUserDisplayNames');
const displayNameTexts = screen.queryAllByLabelText(hintText);
const displayNameTexts = screen.queryAllByLabelText(hintText, {includeHiddenElements: true});
expect(displayNameTexts).toHaveLength(2);
expect((displayNameTexts.at(0)?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.normal);
expect(screen.getAllByText('C User').at(0)).toBeOnTheScreen();
expect((displayNameTexts.at(1)?.props?.style as TextStyle)?.fontWeight).toBe(FontUtils.fontWeight.bold);
expect(screen.getByText('B User')).toBeOnTheScreen();
expect(screen.getByText('B User', {includeHiddenElements: true})).toBeOnTheScreen();
}));

xit('Manually marking a chat message as unread shows the new line indicator and updates the LHN', () =>
Expand Down Expand Up @@ -524,7 +524,7 @@ describe('Unread Indicators', () => {
.then(() => {
// Verify the chat preview text matches the last comment from the current user
const hintText = Localize.translateLocal('accessibilityHints.lastChatMessagePreview');
const alternateText = screen.queryAllByLabelText(hintText);
const alternateText = screen.queryAllByLabelText(hintText, {includeHiddenElements: true});
expect(alternateText).toHaveLength(1);

// This message is visible on the sidebar and the report screen, so there are two occurrences.
Expand All @@ -537,7 +537,7 @@ describe('Unread Indicators', () => {
})
.then(() => {
const hintText = Localize.translateLocal('accessibilityHints.lastChatMessagePreview');
const alternateText = screen.queryAllByLabelText(hintText);
const alternateText = screen.queryAllByLabelText(hintText, {includeHiddenElements: true});
expect(alternateText).toHaveLength(1);
expect(screen.getAllByText('Comment 9').at(0)).toBeOnTheScreen();
})
Expand Down
Loading