From: Marc-Andre Laperle Date: Fri, 26 Aug 2016 03:24:53 +0000 (-0400) Subject: tmf: Add a way to clear the traces using SWTBot only X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=450daec88a5372f23c82d39810ab13f9537ad8ac;p=deliverable%2Ftracecompass.git tmf: Add a way to clear the traces using SWTBot only 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 Reviewed-on: https://git.eclipse.org/r/79793 Reviewed-by: Hudson CI Reviewed-by: Bernd Hufmann Tested-by: Bernd Hufmann --- diff --git a/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTraceActionsTest.java b/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTraceActionsTest.java index 0c480c91e3..8546a9afd3 100644 --- a/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTraceActionsTest.java +++ b/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTraceActionsTest.java @@ -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) { 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 6185cc3c6e..634acd2932 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 @@ -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 *