Fix flaky ContactMethodsPage error indicator test - #94090
Conversation
…tification Co-authored-by: Alex Beaman <Beamanator@users.noreply.github.com>
|
@MelvinBot add the checklist and make sure the PR description follows the template closely, and check of all boxes in the checklist since this is just a test fix |
|
@mkhutornyi Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
|
sorry @mkhutornyi no C+ review needed here 🙏 |
|
🚀 Deployed to staging by https://github.com/amyevans in version: 9.4.17-0 🚀
Bundle Size Analysis (Sentry): |
|
@Beamanator @amyevans To confirm NO QA and ok to checkoff this one? |
|
@m-natarajan yep, you can check it off! Apologies we missed putting it in the title! |
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.4.17-3 🚀
|
1 similar comment
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.4.17-3 🚀
|
Explanation of Change
ContactMethodsPage › sets error indicator when login has error fieldsintests/ui/ContactMethodsPageTest.tsxis flaky onmain. The test asserts that after clearing a login'serrorFields, the row'sbrickRoadIndicatorsettles tonone-brickRoadIndicator, but it intermittently reads the staleerror-brickRoadIndicatorand thewaitFortimes out.The
brickRoadIndicatoris derived synchronously from theuseOnyxvalue, so this is a test-timing race rather than a product bug. Afterawait Onyx.merge(...)clearserrorFields, the Onyx write completes but the subscriber notification that triggers theuseOnyxre-render is queued as a separate macrotask. UnderwaitFor'sact()wrapping that notification can get deferred, so retries observe the staleerrorstate until the timeout fires.This is the same race that was already fixed for the sibling test (
sets info indicator when login is unvalidated and not default) by addingawait waitForBatchedUpdates()between the cleanupOnyx.mergeand thewaitFor— but that flush was only added to the second test, never the first. This PR mirrors that proven pattern in the first test so the pending notification macrotask is drained before the assertion runs.This is a test-only change with no product-code impact.
Fixed Issues
$ https://github.com/Expensify/Expensify/issues/650604
PROPOSAL:
Tests
npx jest tests/ui/ContactMethodsPageTest.tsx(optionally with--runInBandand a repeat loop) and verify the suite passes consistently, includingsets error indicator when login has error fields.Offline tests
N/A — test-only change.
QA Steps
N/A — test-only change. No user-facing behavior is affected; this only stabilizes an existing unit test.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
N/A — test-only change, no UI impact.
Android: Native
N/A — test-only change, no UI impact.
Android: mWeb Chrome
N/A — test-only change, no UI impact.
iOS: Native
N/A — test-only change, no UI impact.
iOS: mWeb Safari
N/A — test-only change, no UI impact.
MacOS: Chrome / Safari
N/A — test-only change, no UI impact.