From: Marc-Andre Laperle Date: Wed, 18 Nov 2015 06:06:30 +0000 (-0500) Subject: tmf: Try expanding a second time when tree expand fails X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=65416c4479432c1ace0eb3352131a2a33472b26e;p=deliverable%2Ftracecompass.git tmf: Try expanding a second time when tree expand fails This will stabilize StandardImportAndReadSmokeTest. Sometimes in a JFace TreeViewer, it expands to nothing. It looks like a timing issue with an update job started by the viewer. This is a work around until we can investigate some more. Change-Id: I01ead54ec7ff7baaf64e1184c3a5cae8906b86a9 Signed-off-by: Marc-Andre Laperle Reviewed-on: https://git.eclipse.org/r/60677 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann --- diff --git a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java index 1e4b3051d1..71995f8cc0 100644 --- a/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java +++ b/tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java @@ -52,6 +52,7 @@ import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree; import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem; +import org.eclipse.swtbot.swt.finder.widgets.TimeoutException; import org.eclipse.tracecompass.tmf.ui.editors.TmfEventsEditor; import org.eclipse.tracecompass.tmf.ui.project.model.TmfOpenTraceHelper; import org.eclipse.tracecompass.tmf.ui.project.model.TmfProjectRegistry; @@ -562,7 +563,15 @@ public final class SWTBotUtils { currentNode.expand(); String nodeName = nodeNames[i]; - bot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(nodeName, currentNode)); + try { + bot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(nodeName, currentNode)); + } catch (TimeoutException e) { + //FIXME: Sometimes in a JFace TreeViewer, it expands to nothing. Need to find out why. + currentNode.collapse(); + currentNode.expand(); + bot.waitUntil(ConditionHelpers.IsTreeChildNodeAvailable(nodeName, currentNode)); + } + SWTBotTreeItem newNode = currentNode.getNode(nodeName); currentNode = newNode; }