Skip to content

fix(tests): deflake draft-restore relaunch test - #101

Merged
sarthakagrawal927 merged 1 commit into
mainfrom
fix/flaky-draft-restore-test
Sep 20, 2026
Merged

sarthakagrawal927 merged 1 commit into
mainfrom
fix/flaky-draft-restore-test

Conversation

@sarthakagrawal927

Copy link
Copy Markdown
Member

Summary

  • testOnboardingRestoresFoodDraftAcrossRelaunch flaked on main (alternating pass/fail): @AppStorage writes flush to UserDefaults asynchronously, so terminate() right after typeText could kill the app mid-flush — observed Optional("Keep my dr") vs Optional("Keep my draft").
  • Waits for the field before typing, sleeps 1s post-type for the defaults flush, then polls the restored value via expectation(for:evaluatedWith:) instead of an instant assert.

Test plan

  • native-quality — the flaky test should pass deterministically

Generated with Devin

@AppStorage writes flush to UserDefaults asynchronously — terminate()
immediately after typeText could kill the app mid-flush ("Keep my dr"
instead of "Keep my draft"). Wait for the write to settle, wait for the
field to exist before typing, and poll the restored value instead of an
instant assert.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@sarthakagrawal927
sarthakagrawal927 merged commit ca386ce into main Sep 20, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant