tmf: Add a way to clear the traces using SWTBot only
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Fri, 26 Aug 2016 03:24:53 +0000 (23:24 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tue, 30 Aug 2016 12:49:19 +0000 (08:49 -0400)
There is way to clear traces but it deletes trace elements
directly using TMF APIs. It would be good to have a way to
do it completely in the UI using SWT. This patch updates
ProjectExplorerTraceActionsTest to use the new way so that
it tests the UI more fully.

Change-Id: If0a8908ecb3f8b0c209ce3c9c8cca883e941be5d
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/79793
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTraceActionsTest.java
tmf/org.eclipse.tracecompass.tmf.ui.swtbot.tests/shared/org/eclipse/tracecompass/tmf/ui/swtbot/tests/shared/SWTBotUtils.java

index 0c480c91e30c08ea32f59641dfec2eb9c0e20d40..8546a9afd31c453e7a6ea9bbac717537dadf4d8a 100644 (file)
@@ -184,7 +184,7 @@ public class ProjectExplorerTraceActionsTest {
         copiedItem.contextMenu().menu("Open").click();
         testEventsTable(RENAMED_TRACE_NAME);
         fBot.closeAllEditors();
-        SWTBotUtils.clearTracesFolder(fBot, TRACE_PROJECT_NAME);
+        SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
     }
 
     /**
@@ -215,7 +215,7 @@ public class ProjectExplorerTraceActionsTest {
         copiedItem.contextMenu().menu("Open").click();
         testEventsTable(RENAMED_TRACE_NAME);
         fBot.closeAllEditors();
-        SWTBotUtils.clearTracesFolder(fBot, TRACE_PROJECT_NAME);
+        SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
     }
 
     /**
@@ -348,7 +348,7 @@ public class ProjectExplorerTraceActionsTest {
         assertTrue(originalEditor == fBot.activeEditor().getReference());
 
         fBot.closeAllEditors();
-        SWTBotUtils.clearTracesFolder(fBot, TRACE_PROJECT_NAME);
+        SWTBotUtils.clearTracesFolderUI(fBot, TRACE_PROJECT_NAME);
     }
 
     private static void createCopy(SWTBotTreeItem traceItem) {
index 6185cc3c6edcce6491f81e5a868b262b6e83d2f0..634acd2932ada2e540e46a9c01252aadf4a03bcf 100644 (file)
@@ -643,6 +643,26 @@ public final class SWTBotUtils {
         });
     }
 
+    /**
+     * Clear the trace folder (using the UI)
+     *
+     * @param bot
+     *            a given workbench bot
+     * @param projectName
+     *            the name of the project (needs to exist)
+     */
+    public static void clearTracesFolderUI(SWTWorkbenchBot bot, String projectName) {
+        SWTBotTreeItem tracesFolder = selectTracesFolder(bot, projectName);
+        tracesFolder.contextMenu().menu("Clear").click();
+        String CONFIRM_CLEAR_DIALOG_TITLE = "Confirm Clear";
+        bot.waitUntil(Conditions.shellIsActive(CONFIRM_CLEAR_DIALOG_TITLE));
+
+        SWTBotShell shell = bot.shell(CONFIRM_CLEAR_DIALOG_TITLE);
+        shell.bot().button("Yes").click();
+        bot.waitUntil(Conditions.shellCloses(shell));
+        bot.waitWhile(ConditionHelpers.treeItemHasChildren(tracesFolder));
+    }
+
     /**
      * Clear the experiment folder
      *
This page took 0.028874 seconds and 5 git commands to generate.