diff --git a/src/CONST.ts b/src/CONST.ts index 22547a5954ae..47ab30589612 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2901,6 +2901,13 @@ const CONST = { }, BACK_BUTTON_NATIVE_ID: 'backButton', + + /** + * Performance test setup - run the same test multiple times to get a more accurate result + */ + PERFORMANCE_TESTS: { + RUNS: 20, + }, } as const; export default CONST; diff --git a/tests/perf-test/ReportActionCompose.perf-test.js b/tests/perf-test/ReportActionCompose.perf-test.js index 4280682c427b..6419d8f895ef 100644 --- a/tests/perf-test/ReportActionCompose.perf-test.js +++ b/tests/perf-test/ReportActionCompose.perf-test.js @@ -7,6 +7,7 @@ import {LocaleContextProvider} from '../../src/components/LocaleContextProvider' import OnyxProvider from '../../src/components/OnyxProvider'; import {KeyboardStateProvider} from '../../src/components/withKeyboardState'; import {WindowDimensionsProvider} from '../../src/components/withWindowDimensions'; +import CONST from '../../src/CONST'; import * as Localize from '../../src/libs/Localize'; import ONYXKEYS from '../../src/ONYXKEYS'; import ReportActionCompose from '../../src/pages/home/report/ReportActionCompose/ReportActionCompose'; @@ -67,7 +68,7 @@ beforeEach(() => { Onyx.merge(ONYXKEYS.NETWORK, {isOffline: false}); }); -const runs = 20; +const runs = CONST.PERFORMANCE_TESTS.RUNS; function ReportActionComposeWrapper() { return ( diff --git a/tests/perf-test/ReportActionsList.perf-test.js b/tests/perf-test/ReportActionsList.perf-test.js index fecc554010d7..ee0fdcb135fc 100644 --- a/tests/perf-test/ReportActionsList.perf-test.js +++ b/tests/perf-test/ReportActionsList.perf-test.js @@ -5,6 +5,7 @@ import ComposeProviders from '../../src/components/ComposeProviders'; import {LocaleContextProvider} from '../../src/components/LocaleContextProvider'; import OnyxProvider from '../../src/components/OnyxProvider'; import {WindowDimensionsProvider} from '../../src/components/withWindowDimensions'; +import CONST from '../../src/CONST'; import * as Localize from '../../src/libs/Localize'; import ONYXKEYS from '../../src/ONYXKEYS'; import ReportActionsList from '../../src/pages/home/report/ReportActionsList'; @@ -96,7 +97,8 @@ function ReportActionsListWrapper() { ); } -const runs = 20; +const runs = CONST.PERFORMANCE_TESTS.RUNS; + test('should render ReportActionsList with 500 reportActions stored', () => { const scenario = async () => { await screen.findByTestId('report-actions-list'); diff --git a/tests/perf-test/ReportScreen.perf-test.js b/tests/perf-test/ReportScreen.perf-test.js index ce4a8f76fdce..f8a44b54cc39 100644 --- a/tests/perf-test/ReportScreen.perf-test.js +++ b/tests/perf-test/ReportScreen.perf-test.js @@ -123,7 +123,7 @@ function ReportScreenWrapper(args) { ); } -const runs = 20; +const runs = CONST.PERFORMANCE_TESTS.RUNS; test.skip('should render ReportScreen with composer interactions', () => { const scenario = async () => { diff --git a/tests/perf-test/SelectionList.perf-test.js b/tests/perf-test/SelectionList.perf-test.js index 80ebf548c0b2..fd607269ec6e 100644 --- a/tests/perf-test/SelectionList.perf-test.js +++ b/tests/perf-test/SelectionList.perf-test.js @@ -3,6 +3,7 @@ import React, {useState} from 'react'; import {measurePerformance} from 'reassure'; import _ from 'underscore'; import SelectionList from '../../src/components/SelectionList'; +import CONST from '../../src/CONST'; import variables from '../../src/styles/variables'; jest.mock('../../src/components/Icon/Expensicons'); @@ -92,7 +93,7 @@ function SelectionListWrapper(args) { ); } -const runs = 20; +const runs = CONST.PERFORMANCE_TESTS.RUNS; test('should render 1 section and a thousand items', () => { measurePerformance(); diff --git a/tests/perf-test/SidebarLinks.perf-test.js b/tests/perf-test/SidebarLinks.perf-test.js index 5d116056c7a5..eef10501d2ef 100644 --- a/tests/perf-test/SidebarLinks.perf-test.js +++ b/tests/perf-test/SidebarLinks.perf-test.js @@ -49,7 +49,7 @@ const getMockedReportsMap = (length = 100) => { const mockedResponseMap = getMockedReportsMap(500); -const runs = 20; +const runs = CONST.PERFORMANCE_TESTS.RUNS; test('should render Sidebar with 500 reports stored', () => { const scenario = async () => {