Skip to content

Commit b06c3cd

Browse files
committed
Wait until the problem marker appears
1 parent dde5d66 commit b06c3cd

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

net.sourceforge.pmd.eclipse.plugin.test/src/main/java/net/sourceforge/pmd/eclipse/ui/dialogs/ViolationDetailsDialogTest.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import org.eclipse.core.runtime.NullProgressMonitor;
1717
import org.eclipse.swt.widgets.Display;
1818
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
19+
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
1920
import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
2021
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
2122
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTableItem;
@@ -83,9 +84,27 @@ public void openDialogViaProblemView() throws Exception {
8384
openJavaPerspective();
8485

8586
SWTBotView problemsView = bot.viewByPartName("Problems");
86-
problemsView.bot().tree().getTreeItem("Warnings (4 items)").expand();
87-
SWTBotTreeItem item = problemsView.bot().tree().getTreeItem("Warnings (4 items)").getNode("UnnecessaryModifier: Unnecessary modifier 'public' on method 'run': the method is declared in an interface type").select();
88-
item.contextMenu("Show details...").click();
87+
SWTBotTreeItem item = problemsView.bot().tree().getTreeItem("Warnings (4 items)").expand();
88+
String markerText = "UnnecessaryModifier: Unnecessary modifier 'public' on method 'run': the method is declared in an interface type";
89+
90+
bot.waitUntil(new DefaultCondition() {
91+
@Override
92+
public boolean test() throws Exception {
93+
try {
94+
item.getNode(markerText);
95+
} catch (WidgetNotFoundException e) {
96+
return false;
97+
}
98+
return true;
99+
}
100+
101+
@Override
102+
public String getFailureMessage() {
103+
return "Marker not found";
104+
}
105+
});
106+
SWTBotTreeItem markerItem = item.getNode(markerText).select();
107+
markerItem.contextMenu("Show details...").click();
89108

90109
assertDialog();
91110
}

0 commit comments

Comments
 (0)