Repository navigation
test: wait for focus to reach Cancel in the add-torrent no-client test - #613
Merged
Merged
Conversation
The dialog shows the no-torrent-client message on one render and moves focus to Cancel in an effect after it, so findByText could resolve before focus moved. Wait for the focus instead of checking it at once. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
What changed
tests/app/admin/components/AddTorrentDialog.test.tsx: the no-torrent-client test now waits (waitFor) for focus to land on Cancel instead of checking it the moment the message appears. The component is unchanged.Why
The dialog shows the "No torrent client is set up" message on one render and moves focus to Cancel in an effect after that render.
findByTextcan resolve between the two, so the old check sometimes still saw focus on the magnet field (it failed once in CI). The same kind of race was fixed in the header badge tests in #607.The other checks in this file were read for the same pattern. They either run right after
renderorfireEvent(both flush effects), or check things that change in the same render as the text they wait for (disabled fields, the disabled Cancel while sending), so they cannot race.Checks
npx vitest related --runon the test file,npx tsc --noEmitand eslint on the file are clean.Risk and rollback
Test-only. Revert the commit to roll back.
Closes #610
🤖 Generated with Claude Code