tmf: Use SWTBotUtils.selectTracesFolder to simplify in a few places
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Fri, 26 Aug 2016 03:15:41 +0000 (23:15 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 1 Sep 2016 18:28:19 +0000 (14:28 -0400)
Change-Id: I67f06aba3256ea405c9c6eea9675ab1657a2aba4
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/79791
Reviewed-by: Hudson CI
Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com>
Tested-by: Patrick Tasse <patrick.tasse@gmail.com>
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/parsers/custom/TestCustomTxtWizard.java
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/src/org/eclipse/tracecompass/tmf/ui/swtbot/tests/parsers/custom/TestCustomXmlWizard.java

index 29741d6d0b26a7a56090ab9e5c11f28705256ea4..e933e852e677e45d8de0a5dce8003a880508a467 100644 (file)
@@ -21,7 +21,6 @@ import java.io.FileWriter;
 import java.io.IOException;
 
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
 import org.eclipse.swtbot.swt.finder.waits.Conditions;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -99,20 +98,8 @@ public class TestCustomTxtWizard extends AbstractCustomParserWizard {
         File xmlFile = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(".metadata/.plugins/org.eclipse.tracecompass.tmf.core/custom_txt_parsers.xml").toFile();
         // Open the custom parsers dialog
         SWTBotUtils.createProject(PROJECT_NAME);
-        SWTBotView projectExplorerBot = fBot.viewByTitle("Project Explorer");
-        projectExplorerBot.show();
-        SWTBotTreeItem treeItem = projectExplorerBot.bot().tree().getTreeItem(PROJECT_NAME);
-        treeItem.select();
-        treeItem.expand();
-        SWTBotTreeItem treeNode = null;
-        for (String node : treeItem.getNodes()) {
-            if (node.startsWith("Trace")) {
-                treeNode = treeItem.getNode(node);
-                break;
-            }
 
-        }
-        assertNotNull(treeNode);
+        SWTBotTreeItem treeNode = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME);
         treeNode.contextMenu("Manage Custom Parsers...").click();
         fBot.waitUntil(Conditions.shellIsActive(MANAGE_CUSTOM_PARSERS_SHELL_TITLE));
         fBot.shell(MANAGE_CUSTOM_PARSERS_SHELL_TITLE).setFocus();
@@ -215,20 +202,7 @@ public class TestCustomTxtWizard extends AbstractCustomParserWizard {
         }
         // Open the custom parsers dialog
         SWTBotUtils.createProject(PROJECT_NAME);
-        SWTBotView proejctExplorerBot = fBot.viewByTitle("Project Explorer");
-        proejctExplorerBot.show();
-        SWTBotTreeItem treeItem = proejctExplorerBot.bot().tree().getTreeItem(PROJECT_NAME);
-        treeItem.select();
-        treeItem.expand();
-        SWTBotTreeItem treeNode = null;
-        for (String node : treeItem.getNodes()) {
-            if (node.startsWith("Trace")) {
-                treeNode = treeItem.getNode(node);
-                break;
-            }
-
-        }
-        assertNotNull(treeNode);
+        SWTBotTreeItem treeNode = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME);
         treeNode.contextMenu("Manage Custom Parsers...").click();
         fBot.waitUntil(Conditions.shellIsActive(MANAGE_CUSTOM_PARSERS_SHELL_TITLE));
         // Open the edition dialog for txt parser
index a8f443cebfda9b6a9c1a2b952d0a3dbdf852ca2e..bf7759b7fca2a61e244204ee4ebea805f0361cd1 100644 (file)
 package org.eclipse.tracecompass.tmf.ui.swtbot.tests.parsers.custom;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
 
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
 import org.eclipse.swtbot.swt.finder.waits.Conditions;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
@@ -74,20 +72,7 @@ public class TestCustomXmlWizard extends AbstractCustomParserWizard {
     public void testNew() throws FileNotFoundException, IOException {
         File xmlFile = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(".metadata/.plugins/org.eclipse.tracecompass.tmf.core/custom_xml_parsers.xml").toFile();
         SWTBotUtils.createProject(PROJECT_NAME);
-        SWTBotView proejctExplorerBot = fBot.viewByTitle("Project Explorer");
-        proejctExplorerBot.show();
-        SWTBotTreeItem treeItem = proejctExplorerBot.bot().tree().getTreeItem(PROJECT_NAME);
-        treeItem.select();
-        treeItem.expand();
-        SWTBotTreeItem treeNode = null;
-        for (String node : treeItem.getNodes()) {
-            if (node.startsWith("Trace")) {
-                treeNode = treeItem.getNode(node);
-                break;
-            }
-
-        }
-        assertNotNull(treeNode);
+        SWTBotTreeItem treeNode = SWTBotUtils.selectTracesFolder(fBot, PROJECT_NAME);
         treeNode.contextMenu("Manage Custom Parsers...").click();
         fBot.waitUntil(Conditions.shellIsActive(MANAGE_CUSTOM_PARSERS_SHELL_TITLE));
         fBot.shell(MANAGE_CUSTOM_PARSERS_SHELL_TITLE).setFocus();
This page took 0.026516 seconds and 5 git commands to generate.