Skip to content

Commit

Permalink
Merge pull request Expensify#35059 from callstack-internal/fix/fix-fl…
Browse files Browse the repository at this point in the history
…aky-searchPage-reassure-tests

[NoQA] Fix flaky search page reassure tests
  • Loading branch information
mountiny authored Jan 24, 2024
2 parents 77814e5 + 8479f4f commit db0d01b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 13 deletions.
1 change: 1 addition & 0 deletions tests/perf-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ We use Reassure for monitoring performance regression. It helps us check if our

- Investigate the code changes that might be causing this and address them to maintain a stable render count. More info [here](https://github.com/Expensify/App/blob/fe9e9e3e31bae27c2398678aa632e808af2690b5/tests/perf-test/README.md?plain=1#L32).
- It is important to run Reassure tests locally and see if our changes caused a regression.
- One of the potential factors that may influence variation in the number of renders is adding unnecesary providers to the component we want to test using ```<ComposeProviders>``` . Ensure that all providers are necessary for running the test.

## What can be tested (scenarios)

Expand Down
18 changes: 5 additions & 13 deletions tests/perf-test/SearchPage.perf-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import {measurePerformance} from 'reassure';
import _ from 'underscore';
import SearchPage from '@pages/SearchPage';
import ComposeProviders from '../../src/components/ComposeProviders';
import {LocaleContextProvider} from '../../src/components/LocaleContextProvider';
import OnyxProvider from '../../src/components/OnyxProvider';
import {CurrentReportIDContextProvider} from '../../src/components/withCurrentReportID';
import {KeyboardStateProvider} from '../../src/components/withKeyboardState';
import {WindowDimensionsProvider} from '../../src/components/withWindowDimensions';
import CONST from '../../src/CONST';
import ONYXKEYS from '../../src/ONYXKEYS';
import createCollection from '../utils/collections/createCollection';
Expand Down Expand Up @@ -81,7 +77,7 @@ afterEach(() => {

function SearchPageWrapper(args) {
return (
<ComposeProviders components={[OnyxProvider, CurrentReportIDContextProvider, KeyboardStateProvider, WindowDimensionsProvider, LocaleContextProvider]}>
<ComposeProviders components={[OnyxProvider]}>
<SearchPage
// eslint-disable-next-line react/jsx-props-no-spreading
{...args}
Expand Down Expand Up @@ -146,7 +142,7 @@ test('[Search Page] should render options list', async () => {
.then(() => measurePerformance(<SearchPageWrapper navigation={navigation} />, {scenario, runs}));
});

test.skip('[Search Page] should search in options list', async () => {
test('[Search Page] should search in options list', async () => {
const {triggerTransitionEnd, addListener} = TestHelper.createAddListenerMock();

const scenario = async () => {
Expand All @@ -156,10 +152,6 @@ test.skip('[Search Page] should search in options list', async () => {
fireEvent.changeText(input, mockedPersonalDetails['88'].login);
await act(triggerTransitionEnd);
await screen.findByText(mockedPersonalDetails['88'].login);

fireEvent.changeText(input, mockedPersonalDetails['45'].login);
await act(triggerTransitionEnd);
await screen.findByText(mockedPersonalDetails['45'].login);
};

const navigation = {addListener};
Expand All @@ -177,16 +169,16 @@ test.skip('[Search Page] should search in options list', async () => {
.then(() => measurePerformance(<SearchPageWrapper navigation={navigation} />, {scenario, runs}));
});

test.skip('[Search Page] should click on list item', async () => {
test('[Search Page] should click on list item', async () => {
const {triggerTransitionEnd, addListener} = TestHelper.createAddListenerMock();

const scenario = async () => {
await screen.findByTestId('SearchPage');
const input = screen.getByTestId('options-selector-input');

fireEvent.changeText(input, mockedPersonalDetails['6'].login);
fireEvent.changeText(input, mockedPersonalDetails['4'].login);
await act(triggerTransitionEnd);
const optionButton = await screen.findByText(mockedPersonalDetails['6'].login);
const optionButton = await screen.findByText(mockedPersonalDetails['4'].login);

fireEvent.press(optionButton);
};
Expand Down

0 comments on commit db0d01b

Please sign in to comment.