diff options
author | Patrick Tasse | 2019-07-12 20:59:43 +0000 |
---|---|---|
committer | Patrick Tasse | 2019-07-15 20:33:26 +0000 |
commit | 3145e5a8409d70a1db2420fc1cbe16de640daa67 (patch) | |
tree | 08855b4628f1f84c83265a5405dc3476cad45a2e | |
parent | c5126f2b827f2f216f45c470fe5464fad0a7d718 (diff) | |
download | org.eclipse.tracecompass-3145e5a8409d70a1db2420fc1cbe16de640daa67.tar.gz org.eclipse.tracecompass-3145e5a8409d70a1db2420fc1cbe16de640daa67.tar.xz org.eclipse.tracecompass-3145e5a8409d70a1db2420fc1cbe16de640daa67.zip |
swtbot: Fix ProjectExplorerTracesFolderTest.getTraceProperty()
The Properties view contains a PageBook. When the workbench selection
changes, a new page can be shown and the previous page is hidden.
When trying to get the Resource properties from the tree found in the
Properties view (when the selection comes from a trace element in the
Project Explorer view), we have to make sure to get the right tree. If
we get a reference to the tree before the selection has changed, we
could use a reference to the previous tree that gets hidden (for
example, the tree showing trace event properties when the selection
comes from the event table). This tree will never contain the Resource
properties, even if the Properties view shows them (from a different
tree in a different PageBook page).
Wait until the view contains a tree that contains the Resource
properties before getting a reference to the tree and continuing to get
the property value from this tree.
Change-Id: I9bb6ee88841d88f5954a136b0adbfa5402cd2f13
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/146024
Tested-by: CI Bot
Reviewed-by: Simon Delisle <simon.delisle@ericsson.com>
2 files changed, 9 insertions, 4 deletions
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 152a573486..655434caab 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 @@ -1,5 +1,5 @@ /****************************************************************************** - * Copyright (c) 2016, 2018 Ericsson + * Copyright (c) 2016, 2019 Ericsson * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which @@ -83,7 +83,7 @@ public class ProjectExplorerTraceActionsTest { private static final String RENAMED_TRACE_NAME = TRACE_NAME + 2; private static final String RENAMED_AS_NEW_TRACE_NAME = TRACE_NAME + 3; private static final String COPY_AS_NEW_TRACE_OPTION = "Copy as a new trace"; - private static final String RESOURCE_PROPERTIES_ITEM_NAME = "Resource properties"; + private static final String RESOURCE_PROPERTIES = "Resource properties"; private static final String LINKED_ITEM_NAME = "linked"; private static final String COPY_TRACE_DIALOG_TITLE = "Copy Trace"; private static final String PROJECT_EXPLORER_VIEW_NAME = "Project Explorer"; @@ -703,8 +703,9 @@ public class ProjectExplorerTraceActionsTest { viewBot.show(); fBot.waitUntil(ConditionHelpers.viewIsActive(viewBot)); traceItem.select(); + SWTBotUtils.waitUntil(bot -> bot.tree().cell(0, 0).equals(RESOURCE_PROPERTIES), viewBot.bot(), "Resource properties did not appear"); SWTBotTree tree = viewBot.bot().tree(); - SWTBotTreeItem resourcePropertiesItem = tree.getTreeItem(RESOURCE_PROPERTIES_ITEM_NAME); + SWTBotTreeItem resourcePropertiesItem = tree.getTreeItem(RESOURCE_PROPERTIES); fBot.waitUntil(ConditionHelpers.isTreeChildNodeAvailable(LINKED_ITEM_NAME, resourcePropertiesItem)); SWTBotTreeItem linkedNode = resourcePropertiesItem.getNode(LINKED_ITEM_NAME); String linkedValue = linkedNode.cell(1); diff --git a/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java b/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java index 7c1ddda3b8..becd3a4933 100644 --- a/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java +++ b/releng/org.eclipse.tracecompass.integration.swtbot.tests/src/org/eclipse/tracecompass/integration/swtbot/tests/projectexplorer/ProjectExplorerTracesFolderTest.java @@ -75,6 +75,8 @@ import com.google.common.collect.Lists; @SuppressWarnings({"restriction", "javadoc"}) public class ProjectExplorerTracesFolderTest { + private static final String RESOURCE_PROPERTIES = "Resource properties"; + private static final class ImportConfirmationSupplier implements Supplier<ImportConfirmation> { List<ImportConfirmation> fConfirmations = Lists.newArrayList(ImportConfirmation.CONTINUE); @@ -1631,7 +1633,9 @@ public class ProjectExplorerTracesFolderTest { SWTBotView view = fBot.viewById(IPageLayout.ID_PROP_SHEET); view.show(); traceItem.select(); - SWTBotTreeItem traceTypeItem = SWTBotUtils.getTreeItem(view.bot(), view.bot().tree(), "Resource properties", property); + SWTBot viewBot = view.bot(); + SWTBotUtils.waitUntil(bot -> bot.tree().cell(0, 0).equals(RESOURCE_PROPERTIES), viewBot, "Resource properties did not appear"); + SWTBotTreeItem traceTypeItem = SWTBotUtils.getTreeItem(viewBot, viewBot.tree(), RESOURCE_PROPERTIES, property); return traceTypeItem.cell(1); } |