In this test, it was possible for SWTBotUtils.openEditor to timeout
because it would not find the right Tree and it would wait for a
TreeItem forever. Instead, we can use the SWTBot from the view to narrow
down where the Tree is searched and it returns the right one. I saw this
test being flaky on Windows.
Change-Id: I44e98b6e88d795fd8b0d38b75ad0506e849af4b5
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/51535
Reviewed-by: Hudson CI
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
* @return TmfEventsEditor the opened editor
*/
public static TmfEventsEditor openEditor(SWTWorkbenchBot bot, String projectName, IPath elementPath) {
* @return TmfEventsEditor the opened editor
*/
public static TmfEventsEditor openEditor(SWTWorkbenchBot bot, String projectName, IPath elementPath) {
- final SWTBotView projectExplorerBot = bot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
- projectExplorerBot.setFocus();
+ final SWTBotView projectExplorerView = bot.viewById(IPageLayout.ID_PROJECT_EXPLORER);
+ projectExplorerView.setFocus();
+ SWTBot projectExplorerBot = projectExplorerView.bot();
- final SWTBotTree tree = bot.tree();
- bot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(projectName, tree));
+ final SWTBotTree tree = projectExplorerBot.tree();
+ projectExplorerBot.waitUntil(ConditionHelpers.IsTreeNodeAvailable(projectName, tree));
final SWTBotTreeItem treeItem = tree.getTreeItem(projectName);
treeItem.expand();
final SWTBotTreeItem treeItem = tree.getTreeItem(projectName);
treeItem.expand();
- SWTBotTreeItem tracesNode = getTraceProjectItem(bot, treeItem, TmfTracesFolder.TRACES_FOLDER_NAME);
+ SWTBotTreeItem tracesNode = getTraceProjectItem(projectExplorerBot, treeItem, TmfTracesFolder.TRACES_FOLDER_NAME);
tracesNode.expand();
SWTBotTreeItem currentItem = tracesNode;
for (String segment : elementPath.segments()) {
tracesNode.expand();
SWTBotTreeItem currentItem = tracesNode;
for (String segment : elementPath.segments()) {
- currentItem = getTraceProjectItem(bot, currentItem, segment);
+ currentItem = getTraceProjectItem(projectExplorerBot, currentItem, segment);
currentItem.select();
currentItem.doubleClick();
}
currentItem.select();
currentItem.doubleClick();
}
* the desired child element name (without suffix)
* @return the a {@link SWTBotTreeItem} with the specified name
*/
* the desired child element name (without suffix)
* @return the a {@link SWTBotTreeItem} with the specified name
*/
- public static SWTBotTreeItem getTraceProjectItem(SWTWorkbenchBot bot, final SWTBotTreeItem parentItem, final String name) {
+ public static SWTBotTreeItem getTraceProjectItem(SWTBot bot, final SWTBotTreeItem parentItem, final String name) {
ProjectElementHasChild condition = new ProjectElementHasChild(parentItem, name);
bot.waitUntil(condition);
return condition.getItem();
ProjectElementHasChild condition = new ProjectElementHasChild(parentItem, name);
bot.waitUntil(condition);
return condition.getItem();