Skip to content

Commit 9a569ed

Browse files
vogellaclaude
andcommitted
Fix flaky HoverTest.testEnabledWhenHover() race condition
The testEnabledWhenHover test was failing randomly when trying to retrieve the hover shell for the second part of the test. Root cause: - The test has two parts: first with EnabledPropertyTester.setEnabled(true), then with setEnabled(false) - After the first hover is shown and checked, cleanFileAndEditor() is called - However, the hover shell from the first part may not be fully disposed when the second editor is opened and the second hover is triggered - This causes getHoverShell() to timeout waiting for the new hover shell Fix: - Capture a reference to the first hover shell before calling cleanFileAndEditor() - After cleanFileAndEditor(), explicitly wait for the first shell to be disposed using DisplayHelper.waitForCondition() with a 3000ms timeout - This ensures the hover state is fully reset before the second part begins This approach follows the pattern used in other recent flaky test fixes in this repository (e.g., ProgressContantsTest, ProgressViewTests) which use condition-based waiting to ensure proper cleanup between test phases. Fixes #926 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 6c82a83 commit 9a569ed

File tree

1 file changed

+5
-0
lines changed
  • tests/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests

1 file changed

+5
-0
lines changed

tests/org.eclipse.ui.genericeditor.tests/src/org/eclipse/ui/genericeditor/tests/HoverTest.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,12 @@ public void testEnabledWhenHover(TestInfo info) throws Exception {
8080
assertNotNull(findControl(shell, StyledText.class, AlrightyHoverProvider.LABEL));
8181
assertNull(findControl(shell, StyledText.class, WorldHoverProvider.LABEL));
8282

83+
// Capture the first shell to wait for its disposal
84+
Shell firstShell = shell;
8385
cleanFileAndEditor();
86+
// Wait for the hover shell to be disposed after editor cleanup
87+
DisplayHelper.waitForCondition(firstShell.getDisplay(), 3000, () -> firstShell.isDisposed());
88+
8489
EnabledPropertyTester.setEnabled(false);
8590
createAndOpenFile("enabledWhen.txt", "bar 'bar'");
8691
shell= getHoverShell(info, triggerCompletionAndRetrieveInformationControlManager(), true);

0 commit comments

Comments
 (0)