Skip to content

Commit

Permalink
Merge pull request #32637 from OlimpiaZurek/feat/30569/ReportUtils-re…
Browse files Browse the repository at this point in the history
…assure-perf-tests

Add perf tests for ReportUtils
  • Loading branch information
mountiny authored Dec 11, 2023
2 parents 3d56ca3 + c97161e commit 1dd07e6
Show file tree
Hide file tree
Showing 10 changed files with 325 additions and 26 deletions.
2 changes: 1 addition & 1 deletion tests/perf-test/GooglePlacesUtils.perf-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ const bigObjectToFind = {
* More on the measureFunction API:
* @see https://callstack.github.io/reassure/docs/api#measurefunction-function
*/
test('getAddressComponents on a big dataset', async () => {
test('[GooglePlacesUtils] getAddressComponents on a big dataset', async () => {
await measureFunction(
() => {
GooglePlacesUtils.getAddressComponents(addressComponents, bigObjectToFind);
Expand Down
10 changes: 5 additions & 5 deletions tests/perf-test/ReportActionCompose.perf-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function ReportActionComposeWrapper() {
}
const mockEvent = {preventDefault: jest.fn()};

test('should render Composer with text input interactions', async () => {
test('[ReportActionCompose] should render Composer with text input interactions', async () => {
const scenario = async () => {
// Query for the composer
const composer = await screen.findByTestId('composer');
Expand All @@ -99,7 +99,7 @@ test('should render Composer with text input interactions', async () => {
return waitForBatchedUpdates().then(() => measurePerformance(<ReportActionComposeWrapper />, {scenario, runs}));
});

test('should press add attachemnt button', async () => {
test('[ReportActionCompose] should press add attachemnt button', async () => {
const scenario = async () => {
// Query for the attachment button
const hintAttachmentButtonText = Localize.translateLocal('reportActionCompose.addAction');
Expand All @@ -111,7 +111,7 @@ test('should press add attachemnt button', async () => {
return waitForBatchedUpdates().then(() => measurePerformance(<ReportActionComposeWrapper />, {scenario, runs}));
});

test('should press add emoji button', async () => {
test('[ReportActionCompose] should press add emoji button', async () => {
const scenario = async () => {
// Query for the emoji button
const hintEmojiButtonText = Localize.translateLocal('reportActionCompose.emoji');
Expand All @@ -123,7 +123,7 @@ test('should press add emoji button', async () => {
return waitForBatchedUpdates().then(() => measurePerformance(<ReportActionComposeWrapper />, {scenario, runs}));
});

test('should press send message button', async () => {
test('[ReportActionCompose] should press send message button', async () => {
const scenario = async () => {
// Query for the send button
const hintSendButtonText = Localize.translateLocal('common.send');
Expand All @@ -135,7 +135,7 @@ test('should press send message button', async () => {
return waitForBatchedUpdates().then(() => measurePerformance(<ReportActionComposeWrapper />, {scenario, runs}));
});

test('render composer with attachement modal interactions', async () => {
test('[ReportActionCompose] render composer with attachement modal interactions', async () => {
const scenario = async () => {
const hintAddAttachmentButtonText = Localize.translateLocal('reportActionCompose.addAttachment');
const hintAssignTaskButtonText = Localize.translateLocal('newTaskPage.assignTask');
Expand Down
4 changes: 2 additions & 2 deletions tests/perf-test/ReportActionsList.perf-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function ReportActionsListWrapper() {

const runs = CONST.PERFORMANCE_TESTS.RUNS;

test('should render ReportActionsList with 500 reportActions stored', () => {
test('[ReportActionsList] should render ReportActionsList with 500 reportActions stored', () => {
const scenario = async () => {
await screen.findByTestId('report-actions-list');
const hintText = Localize.translateLocal('accessibilityHints.chatMessage');
Expand All @@ -116,7 +116,7 @@ test('should render ReportActionsList with 500 reportActions stored', () => {
.then(() => measurePerformance(<ReportActionsListWrapper />, {scenario, runs}));
});

test('should scroll and click some of the reports', () => {
test('[ReportActionsList] should scroll and click some of the reports', () => {
const eventData = {
nativeEvent: {
contentOffset: {
Expand Down
16 changes: 8 additions & 8 deletions tests/perf-test/ReportActionsUtils.perf-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const runs = CONST.PERFORMANCE_TESTS.RUNS;
* More on the measureFunction API:
* @see https://callstack.github.io/reassure/docs/api#measurefunction-function
*/
test('getLastVisibleAction on 10k reportActions', async () => {
test('[ReportActionsUtils] getLastVisibleAction on 10k reportActions', async () => {
await Onyx.multiSet({
...mockedReportActionsMap,
});
Expand All @@ -67,7 +67,7 @@ test('getLastVisibleAction on 10k reportActions', async () => {
await measureFunction(() => ReportActionsUtils.getLastVisibleAction(reportId), {runs});
});

test('getLastVisibleAction on 10k reportActions with actionsToMerge', async () => {
test('[ReportActionsUtils] getLastVisibleAction on 10k reportActions with actionsToMerge', async () => {
const parentReportActionId = '1';
const fakeParentAction = reportActions[parentReportActionId];
const actionsToMerge = {
Expand Down Expand Up @@ -96,7 +96,7 @@ test('getLastVisibleAction on 10k reportActions with actionsToMerge', async () =
await measureFunction(() => ReportActionsUtils.getLastVisibleAction(reportId, actionsToMerge), {runs});
});

test('getMostRecentIOURequestActionID on 10k ReportActions', async () => {
test('[ReportActionsUtils] getMostRecentIOURequestActionID on 10k ReportActions', async () => {
const reportActionsArray = ReportActionsUtils.getSortedReportActionsForDisplay(reportActions);
await Onyx.multiSet({
...mockedReportActionsMap,
Expand All @@ -105,15 +105,15 @@ test('getMostRecentIOURequestActionID on 10k ReportActions', async () => {
await measureFunction(() => ReportActionsUtils.getMostRecentIOURequestActionID(reportActionsArray), {runs});
});

test('getLastVisibleMessage on 10k ReportActions', async () => {
test('[ReportActionsUtils] getLastVisibleMessage on 10k ReportActions', async () => {
await Onyx.multiSet({
...mockedReportActionsMap,
});
await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getLastVisibleMessage(reportId), {runs});
});

test('getLastVisibleMessage on 10k ReportActions with actionsToMerge', async () => {
test('[ReportActionsUtils] getLastVisibleMessage on 10k ReportActions with actionsToMerge', async () => {
const parentReportActionId = '1';
const fakeParentAction = reportActions[parentReportActionId];
const actionsToMerge = {
Expand Down Expand Up @@ -142,23 +142,23 @@ test('getLastVisibleMessage on 10k ReportActions with actionsToMerge', async ()
await measureFunction(() => ReportActionsUtils.getLastVisibleMessage(reportId, actionsToMerge), {runs});
});

test('getSortedReportActionsForDisplay on 10k ReportActions', async () => {
test('[ReportActionsUtils] getSortedReportActionsForDisplay on 10k ReportActions', async () => {
await Onyx.multiSet({
...mockedReportActionsMap,
});
await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getSortedReportActionsForDisplay(reportActions), {runs});
});

test('getLastClosedReportAction on 10k ReportActions', async () => {
test('[ReportActionsUtils] getLastClosedReportAction on 10k ReportActions', async () => {
await Onyx.multiSet({
...mockedReportActionsMap,
});
await waitForBatchedUpdates();
await measureFunction(() => ReportActionsUtils.getLastClosedReportAction(reportActions), {runs});
});

test('getMostRecentReportActionLastModified', async () => {
test('[ReportActionsUtils] getMostRecentReportActionLastModified', async () => {
await Onyx.multiSet({
...mockedReportActionsMap,
});
Expand Down
4 changes: 2 additions & 2 deletions tests/perf-test/ReportScreen.perf-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function ReportScreenWrapper(args) {

const runs = CONST.PERFORMANCE_TESTS.RUNS;

test('should render ReportScreen with composer interactions', () => {
test('[ReportScreen] should render ReportScreen with composer interactions', () => {
const scenario = async () => {
// Query for the report list
await screen.findByTestId('report-actions-list');
Expand Down Expand Up @@ -175,7 +175,7 @@ test('should render ReportScreen with composer interactions', () => {
.then(() => measurePerformance(<ReportScreenWrapper route={mockRoute} />, {scenario, runs}));
});

test('should press of the report item', () => {
test('[ReportScreen] should press of the report item', () => {
const scenario = async () => {
// Query for the report list
await screen.findByTestId('report-actions-list');
Expand Down
Loading

0 comments on commit 1dd07e6

Please sign in to comment.