chore: DAH-0000 resolve flaky SupplementalApplicationPage tests - #791
Draft
fwextensions wants to merge 2 commits into
Draft
chore: DAH-0000 resolve flaky SupplementalApplicationPage tests#791fwextensions wants to merge 2 commits into
fwextensions wants to merge 2 commits into
Conversation
Add proper async handling to tests that were failing intermittently due to race conditions. Tests were querying for DOM elements before async data loading completed. Changes: - Add waitFor to getWrapper() to ensure form is loaded before tests run - Use findByRole instead of getByRole for elements that appear after async ops - Add await to selectEvent.openMenu() calls which are async - Wrap remaining state-changing interactions in await act()
fwextensions
requested review from
a team,
alulabeshue-sfgov and
jimlin-sfgov
and removed request for
a team
January 29, 2026 20:00
It says it's required by eslint-plugin-standard, to replace eslint-plugin-node. Clean up lint issues.
jimlin-sfgov
approved these changes
Jan 29, 2026
jimlin-sfgov
left a comment
Collaborator
There was a problem hiding this comment.
LGTM
On the other hand, we can choose not to fix this, and use the flakiness as a reason to get you a beefed up laptop @fwextensions
|
|
||
| // Increase default test timeout for this file - tests involve multiple async operations | ||
| // and can be slow in resource-constrained environments (e.g., VS Code terminal) | ||
| jest.setTimeout(15000) |
Collaborator
There was a problem hiding this comment.
Thought: this is a smell for our long-standing issue of slow loading times, which we may work on one day...
Collaborator
Author
There was a problem hiding this comment.
That's what Opus thinks.
Slow patterns in current tests:
- Expensive cloning - Every API mock does _cloneDeep(mockedApplication) on a 406-line object
- Redundant async - Mocks are async but return immediately (adds microtask overhead)
- Full page render per test - Nested beforeEach calls getWrapper() repeatedly:
- "when no unit is selected": 2 tests = 2 renders
- "when unit without priority is selected": 4 tests = 4 renders
- "when unit with priority is selected": 2 tests = 2 rendersThat's 8 full renders just in Lease Section nested describes
fwextensions
marked this pull request as draft
June 22, 2026 19:54
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Add proper async handling to tests that were failing intermittently due to race conditions. Tests were querying for DOM elements before async data loading completed. This was causing
SupplementalApplicationPage.test.jsto sometimes fail in slower environments on Windows, like the VS Code terminal, but then it would work in the Windows terminal. Ensuring that async calls are always awaited and bumping the timeouts seems to have fixed it.Changes:
Before requesting eng review
Version Control
type: TICKET-NUMBER Descriptionformat, useDAH-000if it does not need a ticketurgent: Descriptionformat if it is urgent and does not need a ticketCode quality
Review instructions
Request eng review
needs reviewlabelHousing Enggroup to automatically assign reviewers, and/or assign specific engineersBefore merging
Request product acceptance (PA) testing
needs product acceptancelabel)