test: fix flaky BrowseTab Save-button query racing the Edit transition - #6109
Merged
atomantic merged 1 commit intoSep 3, 2026
Merged
Conversation
atomantic#6051) openEditor and clickSave used synchronous getByRole/getByText queries right after a fireEvent.click that triggers an async state transition. Under full- suite CPU contention that occasionally ran before React committed the new state, even though it reliably passed in isolation. Both helpers now await findByRole so the query itself waits for the transition to settle instead of racing it. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
atomantic
approved these changes
Sep 3, 2026
atomantic
left a comment
Owner
There was a problem hiding this comment.
Reviewed against the live schema/behavior — change is correct, focused, and covered by tests. Approving.
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.
Summary
openEditorandclickSaveinBrowseTab.test.jsxused synchronousgetByRole/getByTextqueries immediately after afireEvent.clickthat triggers an async state transition (Edit → editable form with a Save button).BrowseTab.jsx's Edit→Save transition is a plain synchronoussetState).await screen.findByRole(...)instead of a baregetBy*, so the query itself waits for the transition to settle.Test plan
client/src/components/wiki/tabs/BrowseTab.test.jsx— 8/8, re-run 5x for stability, plus the wholewiki/directory together🤖 Generated with Claude Code