swtbot: Add to SWBotUtils a selectTracesFolder to ease initialization
authorMatthew Khouzam <matthew.khouzam@ericsson.com>
Mon, 26 Jan 2015 18:38:20 +0000 (13:38 -0500)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Fri, 30 Jan 2015 22:41:11 +0000 (17:41 -0500)
Change-Id: If6c17e4224bf9333026577d28a635bfee8d6b6f5
Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/40398
Reviewed-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java

index b8b4a4989434eded8ce43c6a6fa9c0a0dabdf0b3..11dddca25f7ee682e96fe049056e148d35ef209b 100644 (file)
@@ -364,4 +364,30 @@ public final class SWTBotUtils {
         }
         return nodeName;
     }
+
+    /**
+     * Select the traces folder
+     *
+     * @param bot
+     *            a given workbench bot
+     * @param projectName
+     *            the name of the project (it needs to exist or else it would time out)
+     * @return a {@link SWTBotTreeItem} of the "Traces" directory
+     */
+    public static SWTBotTreeItem selectTracesFolder(SWTWorkbenchBot bot, String projectName) {
+        SWTBotView projectExplorerBot = bot.viewByTitle("Project Explorer");
+        projectExplorerBot.show();
+        SWTBotTreeItem treeItem = projectExplorerBot.bot().tree().getTreeItem(projectName);
+        treeItem.select();
+        treeItem.expand();
+        SWTBotTreeItem treeNode = null;
+        for (String node : treeItem.getNodes()) {
+            if (node.matches("Traces\\s\\[(\\d)*\\]")) {
+                treeNode = treeItem.getNode(node);
+                break;
+            }
+        }
+        assertNotNull(treeNode);
+        return treeNode;
+    }
 }
This page took 0.025062 seconds and 5 git commands to generate.