Fix race condition in ResourceInitialSelectionTest #3453
+67
−0
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
Fixes intermittent test failures in
ResourceInitialSelectionTeston macOS systems.Problem
Tests
testMultiSelectionAndOneInitialSelectionWithInitialPatternandtestSingleSelectionAndNoInitialSelectionWithInitialPatternwere failing intermittently on macOS with errors indicating that expected selections were not being applied.The root cause was a race condition between:
dialog.refresh()callTests were checking the selection state before background jobs completed, resulting in empty or incorrect selections.
Solution
Added event loop processing to allow background jobs to complete before making assertions:
Added
waitForDialogRefresh()helper method that:DecoratorAdaptableTestsUpdated 10 test methods to call
waitForDialogRefresh()afterdialog.refresh()for tests that expect valid selections3 tests intentionally skip the wait to test edge cases where invalid/filtered selections should not cause any selection
Test Results
✅ All 13 tests now pass consistently (verified with multiple runs)
Related Issues
Fixes #294
🤖 Generated with Claude Code