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

[no-Jira] Flaky tests #862

Merged
merged 4 commits into from
Jan 22, 2024
Merged

[no-Jira] Flaky tests #862

merged 4 commits into from
Jan 22, 2024

Conversation

canac
Copy link
Contributor

@canac canac commented Jan 19, 2024

Description

Attempt to fix common flaky tests

partnerGivingAnalysis page › toggles filter panel

There are two toggle buttons that both open the filter panel. One is supposed to open the navbar and one is supposed to open the filter panel.

CreateMultipleContacts › Contact Creation › handles chosen address predictions

This and other CreateMultipleContacts tests seen take a long time because there are so many inputs to render and update. I adjusted the test to only render 3 rows instead of 10, which speeds things up significantly. Running the tests in CreateMultipleContacts.test.tsx take ~10s now instead of ~30s on my machine.

DonorAccountAutocomplete › debounces loading donors from the server on type

The debounce was for 1000ms, and the default waitFor timeout is 1000ms. I changed the debounce interval to 500ms to match most of the other places in the codebase.

If we find more flaky tests, we can try to address them in a future PR.

Checklist:

  • I have given my PR a title with the format "MPDX-(JIRA#) (summary sentence max 80 chars)"
  • I have applied the appropriate labels. (Add the label "On Staging" to get the branch automatically merged into staging.)
  • I have requested a review from another person on the project

@canac canac added the On Staging Will be merged to the staging branch by Github Actions label Jan 19, 2024
@canac canac requested review from caleballdrin and dr-bizz January 19, 2024 20:33
@@ -258,33 +261,6 @@ describe('PartnerGivingAnalysisReport', () => {
expect(getByTestId('PartnerGivingAnalysisReport')).toBeInTheDocument();
});

it('nav list closed', async () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tests that the MultiPageMenu isn't rendered but PartnerGivingAnalysisReport doesn't render the menu, PartnerGivingAnalysisReportPage does. I removed it because it isn't testing anything meaningful.

Copy link

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-862.d3dytjb8adxkk5.amplifyapp.com

@@ -145,7 +145,7 @@ const FixPhoneNumbers: React.FC<Props> = ({ accountListId }: Props) => {
primary: phoneNumber.primary,
updatedAt: phoneNumber.updatedAt,
source: phoneNumber.source,
number: phoneNumber.number,
number: phoneNumber.number || '',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've also fixed this in my Phone PR, going live today. but prob good to keep it in here so your PR doesn't break

@dr-bizz dr-bizz self-requested a review January 22, 2024 14:34
Copy link
Contributor

@dr-bizz dr-bizz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, you put this out fast! Great work!

I also noticed we are using setTimeout() on a few other tests where we could be using jest.advanceTimersByTime() with jest.useFakeTimers()

  • src/components/Contacts/ContactFlow/ContactFlowSetup/Column/ContactFlowSetupColumn.test.tsx
  • src/components/Layouts/Primary/TopBar/Items/SearchMenu/SearchMenu.test.tsx
  • src/components/common/SearchBox/SearchBox.test.tsx
  • src/components/Shared/Header/ListHeader.test.tsx

@canac canac merged commit 88645c5 into main Jan 22, 2024
15 checks passed
@canac canac deleted the flaky-tests branch January 22, 2024 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
On Staging Will be merged to the staging branch by Github Actions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants