Fix flaky test on AutocompletePrompt.test.tsx#6936
Open
gonzaloriestra wants to merge 1 commit intomainfrom
Open
Fix flaky test on AutocompletePrompt.test.tsx#6936gonzaloriestra wants to merge 1 commit intomainfrom
gonzaloriestra wants to merge 1 commit intomainfrom
Conversation
Contributor
Coverage report
Test suite run success3797 tests passing in 1449 suites. Report generated by 🧪jest coverage report action from afea463 |
Contributor
|
We detected some changes at Caution DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release. |
|
🤖 Code Review · #projects-dev-ai for questions ✅ Complete - No issues 📋 History✅ No issues |
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.
WHY are these changes introduced?
After upgrading to React 19, some flaky tests raised that #6922 tried to fix.
But CI keeps failing https://github.com/Shopify/cli/actions/runs/22668051243/job/65704701620
WHAT is this pull request doing?
Apparently it's a race condition. The flaky test sends ENTER right after detecting "No results found" in the frame, but React 19 hasn't yet re-registered the useInput handler with updated closures, so the stale handler still sees the old items and submits "first".
The fix adds a yield in
sendInputAndWaitForContent(matching the existing pattern insendInputAndWaitForChange) to let React 19 flush effects before subsequent input is sent.How to test your changes?
CI. I've re-run the tests here several times and that test didn't fail.
Measuring impact
How do we know this change was effective? Please choose one:
Checklist