Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2016-04-27 21:12:17 +0000
committerThomas Wolf2016-05-03 18:36:13 +0000
commit4bdcf80be11c7b3e2b9ec2b7d7383cf5ab0412df (patch)
tree8b93d620131d3a9645aa28d405458e17427efa02 /org.eclipse.egit.ui.test/src
parent59629220c97854b9b480916d8522a340dc8de978 (diff)
downloadegit-4bdcf80be11c7b3e2b9ec2b7d7383cf5ab0412df.tar.gz
egit-4bdcf80be11c7b3e2b9ec2b7d7383cf5ab0412df.tar.xz
egit-4bdcf80be11c7b3e2b9ec2b7d7383cf5ab0412df.zip
Test stability: avoid asynchronous SWTBotTreeItem.expand()
Sometimes tests do not find children of expanded tree nodes. The root cause appears to be that expand() expands the node in an asyncExec.[1] Add a utility operation that after expanding waits until the desired node exists, and replace all calls to expand() that do expect children by that. [1] https://wiki.eclipse.org/Linux_Tools_Project/SWTBot_Workarounds#Tree_Item_Expansion_Failure Change-Id: I23ea6a7bc519692c0e9dbe480bb2eb8dfb96adc1 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.egit.ui.test/src')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java3
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java10
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchDialogTest.java3
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleAddTest.java10
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleSyncTest.java5
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleUpdateTest.java8
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java29
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java10
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java27
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java7
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java9
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/MergeToolTest.java6
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java71
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java15
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java75
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoDeletionTest.java9
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java4
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java20
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java132
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestUtils.java35
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java4
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewWorkspaceModelTest.java11
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/share/SharingWizardTest.java4
23 files changed, 287 insertions, 220 deletions
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java
index 9fde54af5e..45fcfd0f17 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/internal/submodules/SubmoduleFolderTest.java
@@ -290,7 +290,8 @@ public class SubmoduleFolderTest extends LocalRepositoryTestCase {
TestUtil.waitForDecorations();
assertTrue("Folder should have repo/branch decoration",
node.getText().contains("[master"));
- node = TestUtil.getChildNode(node.expand(), CHILDPROJECT);
+ TestUtil.expandAndWait(node);
+ node = TestUtil.getChildNode(node, CHILDPROJECT);
TestUtil.waitForDecorations();
assertFalse("Folder should not have repo/branch decoration",
node.getText().contains("["));
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java
index 590109903a..895a92966d 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/prefpages/configuration/GlobalConfigurationPageTest.java
@@ -74,11 +74,11 @@ public class GlobalConfigurationPageTest {
private void getGitConfigurationPreferencePage() {
preferencePage = new Eclipse().openPreferencePage(preferencePage);
SWTBotTreeItem team = preferencePage.bot().tree().getTreeItem("Team");
- team.expand()
- .getNode(util.getPluginLocalizedValue("GitPreferences_name"))
- .expand()
- .getNode(util.getPluginLocalizedValue("ConfigurationPage.name"))
- .select();
+ team = TestUtil.expandAndWait(team)
+ .getNode(util.getPluginLocalizedValue("GitPreferences_name"));
+ team = TestUtil.expandAndWait(team).getNode(
+ util.getPluginLocalizedValue("ConfigurationPage.name"));
+ team.select();
}
@After
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchDialogTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchDialogTest.java
index 7d2f09d18f..e7d2c0a74d 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchDialogTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/search/CommitSearchDialogTest.java
@@ -95,7 +95,8 @@ public class CommitSearchDialogTest extends LocalRepositoryTestCase {
assertTrue(repoData instanceof RepositoryMatch);
assertEquals(repository.getDirectory(), ((RepositoryMatch) repoData)
.getRepository().getDirectory());
- final SWTBotTreeItem[] commits = repos[0].expand().getItems();
+ final SWTBotTreeItem[] commits = TestUtil.expandAndWait(repos[0])
+ .getItems();
assertEquals(1, commits.length);
Object commitData = UIThreadRunnable.syncExec(new Result<Object>() {
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleAddTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleAddTest.java
index 49ea478a73..a953e3e43e 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleAddTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleAddTest.java
@@ -79,13 +79,11 @@ public class SubmoduleAddTest extends GitRepositoriesViewTestBase {
refreshAndWait();
tree = getOrOpenView().bot().tree();
- SWTBotTreeItem submodules = tree.getAllItems()[0]
- .select()
- .expand()
- .getNode(
- UIText.RepositoriesViewLabelProvider_SubmodulesNodeText);
+ SWTBotTreeItem submodules = tree.getAllItems()[0].select();
+ submodules = TestUtil.expandAndWait(submodules).getNode(
+ UIText.RepositoriesViewLabelProvider_SubmodulesNodeText);
assertNotNull(submodules);
- submodules.expand();
+ TestUtil.expandAndWait(submodules);
assertEquals(1, submodules.rowCount());
}
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleSyncTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleSyncTest.java
index 07345cb0fc..814d0f0272 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleSyncTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleSyncTest.java
@@ -95,9 +95,8 @@ public class SubmoduleSyncTest extends GitRepositoriesViewTestBase {
refreshAndWait();
SWTBotTree tree = getOrOpenView().bot().tree();
- tree.getAllItems()[0]
- .expand()
- .expandNode(
+ TestUtil.expandAndWait(tree.getAllItems()[0])
+ .getNode(
UIText.RepositoriesViewLabelProvider_SubmodulesNodeText)
.select();
ContextMenuHelper.clickContextMenuSync(tree, myUtil
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleUpdateTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleUpdateTest.java
index 21f0a0e9e9..aa2d394e1f 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleUpdateTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule/SubmoduleUpdateTest.java
@@ -32,6 +32,7 @@ import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.transport.URIish;
import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -84,10 +85,9 @@ public class SubmoduleUpdateTest extends GitRepositoriesViewTestBase {
refreshAndWait();
SWTBotTree tree = getOrOpenView().bot().tree();
- tree.getAllItems()[0]
- .expand()
- .expandNode(
- UIText.RepositoriesViewLabelProvider_SubmodulesNodeText)
+ SWTBotTreeItem item = TestUtil.expandAndWait(tree.getAllItems()[0]);
+ TestUtil.expandAndWait(item.getNode(
+ UIText.RepositoriesViewLabelProvider_SubmodulesNodeText))
.select();
ContextMenuHelper.clickContextMenuSync(tree, myUtil
.getPluginLocalizedValue(UPDATE_SUBMODULE_CONTEXT_MENU_LABEL));
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
index 5f47d337b3..48ca9edd3f 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/TestUtil.java
@@ -57,6 +57,7 @@ import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
import org.eclipse.swtbot.swt.finder.SWTBot;
import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
import org.eclipse.swtbot.swt.finder.waits.ICondition;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTable;
@@ -569,6 +570,32 @@ public class TestUtil {
}
/**
+ * Expand a node and wait until it is expanded. Use only if the node is
+ * expected to have children.
+ *
+ * @param treeItem
+ * to expand
+ * @return the {@code treeItem}
+ */
+ public static SWTBotTreeItem expandAndWait(final SWTBotTreeItem treeItem) {
+ treeItem.expand();
+ new SWTBot().waitUntil(new DefaultCondition() {
+
+ @Override
+ public boolean test() {
+ SWTBotTreeItem[] children = treeItem.getItems();
+ return children != null && children.length > 0;
+ }
+
+ @Override
+ public String getFailureMessage() {
+ return "No children found for " + treeItem.getText();
+ }
+ });
+ return treeItem;
+ }
+
+ /**
* Navigates in the given tree to the node denoted by the labels in the
* path, using {@link #getNode(SWTBotTreeItem[], String)} to find children.
*
@@ -587,7 +614,7 @@ public class TestUtil {
new SWTBot().waitUntil(widgetIsEnabled(tree));
SWTBotTreeItem item = getNode(tree.getAllItems(), path[0]);
for (int i = 1; item != null && i < path.length; i++) {
- item.expand();
+ item = expandAndWait(item);
item = getChildNode(item, path[i]);
}
return item;
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
index a40fa7ef52..ba34382aed 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/history/HistoryViewTest.java
@@ -239,11 +239,13 @@ public class HistoryViewTest extends LocalRepositoryTestCase {
if (path.length == 1)
explorerItem = projectItem;
else if (path.length == 2)
- explorerItem = TestUtil.getChildNode(projectItem.expand(), path[1]);
+ explorerItem = TestUtil
+ .getChildNode(TestUtil.expandAndWait(projectItem), path[1]);
else {
- SWTBotTreeItem childItem = TestUtil.getChildNode(
- projectItem.expand(), path[1]);
- explorerItem = TestUtil.getChildNode(childItem.expand(), path[2]);
+ SWTBotTreeItem childItem = TestUtil
+ .getChildNode(TestUtil.expandAndWait(projectItem), path[1]);
+ explorerItem = TestUtil
+ .getChildNode(TestUtil.expandAndWait(childItem), path[2]);
}
explorerItem.select();
ContextMenuHelper.clickContextMenuSync(projectExplorerTree, "Team",
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
index 9d7fd468bb..6e2ad4139d 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/BranchAndResetActionTest.java
@@ -270,8 +270,8 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
String master = getTestFileContent();
assertFalse(stable.equals(master));
SWTBotShell resetDialog = openResetDialog();
- SWTBotTreeItem localBranches = resetDialog.bot().tree()
- .getTreeItem(LOCAL_BRANCHES).expand();
+ SWTBotTreeItem localBranches = TestUtil.expandAndWait(
+ resetDialog.bot().tree().getTreeItem(LOCAL_BRANCHES));
TestUtil.getChildNode(localBranches, "stable").select();
resetDialog.bot().radio(
UIText.ResetTargetSelectionDialog_ResetTypeHardButton).click();
@@ -300,8 +300,8 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
assertNotNull(lookupRepository(repositoryFile).resolve("newBranch"));
SWTBotShell deleteBranchDialog = openDeleteBranchDialog();
- SWTBotTreeItem localBranches = deleteBranchDialog.bot().tree()
- .getTreeItem(LOCAL_BRANCHES).expand();
+ SWTBotTreeItem localBranches = TestUtil.expandAndWait(
+ deleteBranchDialog.bot().tree().getTreeItem(LOCAL_BRANCHES));
TestUtil.getChildNode(localBranches, "newBranch").select();
deleteBranchDialog.bot().button(IDialogConstants.OK_LABEL).click();
@@ -407,8 +407,8 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
public void testRenameBranch() throws Exception {
SWTBotShell dialog = openRenameBranchDialog();
- SWTBotTreeItem localBranches = dialog.bot().tree()
- .getTreeItem(LOCAL_BRANCHES).expand();
+ SWTBotTreeItem localBranches = TestUtil
+ .expandAndWait(dialog.bot().tree().getTreeItem(LOCAL_BRANCHES));
TestUtil.getChildNode(localBranches, "stable").select();
dialog.bot().button(UIText.RenameBranchDialog_RenameButtonLabel)
.click();
@@ -425,7 +425,8 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
TestUtil.joinJobs(JobFamilies.CHECKOUT);
dialog = openRenameBranchDialog();
- SWTBotTreeItem localBranches2 = dialog.bot().tree().getTreeItem(LOCAL_BRANCHES).expand();
+ SWTBotTreeItem localBranches2 = TestUtil
+ .expandAndWait(dialog.bot().tree().getTreeItem(LOCAL_BRANCHES));
TestUtil.getChildNode(localBranches2, "renamed").select();
dialog.bot().button(UIText.RenameBranchDialog_RenameButtonLabel)
.click();
@@ -438,8 +439,8 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
TestUtil.joinJobs(JobFamilies.CHECKOUT);
dialog = openRenameBranchDialog();
- SWTBotTreeItem localBranches3 = dialog.bot().tree()
- .getTreeItem(LOCAL_BRANCHES).expand();
+ SWTBotTreeItem localBranches3 = TestUtil
+ .expandAndWait(dialog.bot().tree().getTreeItem(LOCAL_BRANCHES));
TestUtil.getChildNode(localBranches3, "stable").select();
dialog.close();
}
@@ -455,9 +456,7 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
TableCollection tc = dialog.bot().tree().selection();
assertEquals("Wrong selection count", 0, tc.rowCount());
- SWTBotTreeItem parentNode = dialog.bot().tree()
- .getTreeItem(nodeTexts[0]).expand();
- TestUtil.getChildNode(parentNode, nodeTexts[1]).select();
+ TestUtil.navigateTo(dialog.bot().tree(), nodeTexts).select();
tc = dialog.bot().tree().selection();
assertEquals("Wrong selection count", 1, tc.rowCount());
assertTrue("Wrong item selected", tc.get(0, 0).startsWith(nodeTexts[1]));
@@ -478,9 +477,7 @@ public class BranchAndResetActionTest extends LocalRepositoryTestCase {
private void checkout(String[] nodeTexts) throws Exception {
SWTBotShell dialog = openCheckoutBranchDialog();
- SWTBotTreeItem parentNode = dialog.bot().tree()
- .getTreeItem(nodeTexts[0]).expand();
- TestUtil.getChildNode(parentNode, nodeTexts[1]).select();
+ TestUtil.navigateTo(dialog.bot().tree(), nodeTexts).select();
TableCollection tc = dialog.bot().tree().selection();
assertEquals("Wrong selection count", 1, tc.rowCount());
assertTrue("Wrong item selected", tc.get(0, 0).startsWith(nodeTexts[1]));
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java
index 1cfd14e2f4..9cdc47d908 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/CompareActionsTest.java
@@ -162,7 +162,8 @@ public class CompareActionsTest extends LocalRepositoryTestCase {
// use the tag -> should have a change
dialog = openCompareWithDialog(compareWithRefActionLabel, dialogTitle);
- SWTBotTreeItem tags = dialog.bot().tree().getTreeItem(TAGS).expand();
+ SWTBotTreeItem tags = TestUtil
+ .expandAndWait(dialog.bot().tree().getTreeItem(TAGS));
TestUtil.getChildNode(tags, "SomeTag").select();
jobJoiner = JobJoiner.startListening(
@@ -350,12 +351,12 @@ public class CompareActionsTest extends LocalRepositoryTestCase {
String text = syncItems[0].getText();
assertTrue("Received unexpected text: " + text, text.contains(PROJ1));
- syncItems[0].expand();
+ TestUtil.expandAndWait(syncItems[0]);
SWTBotTreeItem[] level1Children = syncItems[0].getItems();
assertEquals(level1Children.length, 1);
assertTrue(level1Children[0].getText().contains(FOLDER));
- level1Children[0].expand();
+ TestUtil.expandAndWait(level1Children[0]);
SWTBotTreeItem[] level2Children = level1Children[0].getItems();
assertEquals(level2Children.length, 1);
assertTrue(level2Children[0].getText().contains(FILE1));
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
index 22f2ce6eee..de5c97c8cc 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/FetchAndMergeActionTest.java
@@ -111,8 +111,8 @@ public class FetchAndMergeActionTest extends LocalRepositoryTestCase {
SWTBotShell mergeDialog = openMergeDialog();
- SWTBotTreeItem remoteBranches = mergeDialog.bot().tree()
- .getTreeItem(REMOTE_BRANCHES).expand();
+ SWTBotTreeItem remoteBranches = TestUtil.expandAndWait(
+ mergeDialog.bot().tree().getTreeItem(REMOTE_BRANCHES));
TestUtil.getChildNode(remoteBranches, "origin/master").select();
mergeDialog.bot().button(UIText.MergeTargetSelectionDialog_ButtonMerge)
.click();
@@ -148,9 +148,8 @@ public class FetchAndMergeActionTest extends LocalRepositoryTestCase {
private void mergeBranch(String branchToMerge, boolean squash) throws Exception {
SWTBotShell mergeDialog = openMergeDialog();
- SWTBotTreeItem localBranches = mergeDialog.bot().tree()
- .getTreeItem(LOCAL_BRANCHES).expand();
- TestUtil.getChildNode(localBranches, branchToMerge).select();
+ TestUtil.navigateTo(mergeDialog.bot().tree(),
+ new String[] { LOCAL_BRANCHES, branchToMerge }).select();
if (squash)
mergeDialog.bot().radio(UIText.MergeTargetSelectionDialog_MergeTypeSquashButton).click();
mergeDialog.bot().button(UIText.MergeTargetSelectionDialog_ButtonMerge).click();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/MergeToolTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/MergeToolTest.java
index 0d27d8efd9..0228db3daf 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/MergeToolTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/test/team/actions/MergeToolTest.java
@@ -70,8 +70,10 @@ public class MergeToolTest extends LocalRepositoryTestCase {
SWTBotTreeItem project1 = getProjectItem(packageExplorer, PROJ1)
.select();
- SWTBotTreeItem folderNode = project1.expand().getNode(FOLDER);
- SWTBotTreeItem fileNode = folderNode.expand().getNode(FILE1);
+ SWTBotTreeItem folderNode = TestUtil.expandAndWait(project1)
+ .getNode(FOLDER);
+ SWTBotTreeItem fileNode = TestUtil.expandAndWait(folderNode)
+ .getNode(FILE1);
fileNode.select();
ContextMenuHelper.clickContextMenu(packageExplorer,
util.getPluginLocalizedValue("TeamMenu.label"),
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java
index bea1771e1a..9ffdc2c1c6 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewBranchHandlingTest.java
@@ -94,7 +94,7 @@ public class GitRepositoriesViewBranchHandlingTest extends
final SWTBotView view = getOrOpenView();
SWTBotTreeItem localItem = myRepoViewUtil.getLocalBranchesItem(view
.bot().tree(), repositoryFile);
- localItem.expand();
+ TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 1, localItem.getNodes().size());
assertEquals("master", localItem.getNodes().get(0));
@@ -115,7 +115,7 @@ public class GitRepositoriesViewBranchHandlingTest extends
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(),
repositoryFile);
- localItem.expand();
+ TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 2, localItem.getNodes().size());
localItem.getNode(0).select();
@@ -138,7 +138,7 @@ public class GitRepositoriesViewBranchHandlingTest extends
refreshAndWait();
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(),
repositoryFile);
- localItem.expand();
+ TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 1, localItem.getNodes().size());
}
@@ -153,7 +153,7 @@ public class GitRepositoriesViewBranchHandlingTest extends
final SWTBotView view = getOrOpenView();
SWTBotTreeItem localItem = myRepoViewUtil.getLocalBranchesItem(view
.bot().tree(), repositoryFile);
- localItem.expand();
+ TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 1, localItem.getNodes().size());
assertEquals("master", localItem.getNodes().get(0));
@@ -175,7 +175,7 @@ public class GitRepositoriesViewBranchHandlingTest extends
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(),
repositoryFile);
- localItem.expand();
+ TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 2, localItem.getNodes().size());
touchAndSubmit("Some more changes");
@@ -197,7 +197,7 @@ public class GitRepositoriesViewBranchHandlingTest extends
refreshAndWait();
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(),
repositoryFile);
- localItem.expand();
+ TestUtil.expandAndWait(localItem);
assertEquals("Wrong number of children", 1, localItem.getNodes().size());
}
@@ -205,14 +205,14 @@ public class GitRepositoriesViewBranchHandlingTest extends
public void testClonedRepository() throws Exception {
SWTBotTree tree = getOrOpenView().bot().tree();
- SWTBotTreeItem item = myRepoViewUtil.getLocalBranchesItem(tree,
- clonedRepositoryFile).expand();
+ SWTBotTreeItem item = TestUtil.expandAndWait(myRepoViewUtil
+ .getLocalBranchesItem(tree, clonedRepositoryFile));
List<String> children = item.getNodes();
assertEquals("Wrong number of local children", 1, children.size());
- item = myRepoViewUtil.getRemoteBranchesItem(tree, clonedRepositoryFile)
- .expand();
+ item = TestUtil.expandAndWait(myRepoViewUtil.getRemoteBranchesItem(tree,
+ clonedRepositoryFile));
children = item.getNodes();
assertEquals("Wrong number of children", 2, children.size());
assertTrue("Missing remote branch", children.contains("origin/master"));
@@ -225,8 +225,8 @@ public class GitRepositoriesViewBranchHandlingTest extends
assertEquals("stable", shell.bot().textWithId("BranchName").getText());
shell.bot().button(IDialogConstants.FINISH_LABEL).click();
refreshAndWait();
- item = myRepoViewUtil.getLocalBranchesItem(tree, clonedRepositoryFile)
- .expand();
+ item = TestUtil.expandAndWait(myRepoViewUtil.getLocalBranchesItem(tree,
+ clonedRepositoryFile));
children = item.getNodes();
assertEquals("Wrong number of local children", 2, children.size());
@@ -247,8 +247,8 @@ public class GitRepositoriesViewBranchHandlingTest extends
touchAndSubmit(null);
refreshAndWait();
- item = myRepoViewUtil.getRemoteBranchesItem(tree, clonedRepositoryFile)
- .expand();
+ item = TestUtil.expandAndWait(myRepoViewUtil.getRemoteBranchesItem(tree,
+ clonedRepositoryFile));
List<String> children = item.getNodes();
assertEquals("Wrong number of remote children", 2, children.size());
@@ -265,9 +265,8 @@ public class GitRepositoriesViewBranchHandlingTest extends
.getBranch()));
// now let's try to create a local branch from the remote one
- item = myRepoViewUtil.getRemoteBranchesItem(tree, clonedRepositoryFile)
- .expand();
- item.getNode("origin/stable").select();
+ item = myRepoViewUtil.getRemoteBranchesItem(tree, clonedRepositoryFile);
+ TestUtil.expandAndWait(item).getNode("origin/stable").select();
ContextMenuHelper.clickContextMenu(tree,
myUtil.getPluginLocalizedValue("CreateBranchCommand"));
@@ -279,8 +278,8 @@ public class GitRepositoriesViewBranchHandlingTest extends
createPage.close();
// checkout master again
- myRepoViewUtil.getLocalBranchesItem(tree, clonedRepositoryFile)
- .expand().getNode("master").select();
+ item = myRepoViewUtil.getLocalBranchesItem(tree, clonedRepositoryFile);
+ TestUtil.expandAndWait(item).getNode("master").select();
ContextMenuHelper.clickContextMenu(tree,
myUtil.getPluginLocalizedValue("CheckoutCommand"));
TestUtil.joinJobs(JobFamilies.CHECKOUT);
@@ -291,8 +290,8 @@ public class GitRepositoriesViewBranchHandlingTest extends
public void testRenameBranch() throws Exception {
SWTBotTree tree = getOrOpenView().bot().tree();
- SWTBotTreeItem item = myRepoViewUtil.getLocalBranchesItem(tree,
- clonedRepositoryFile).expand();
+ SWTBotTreeItem item = TestUtil.expandAndWait(myRepoViewUtil
+ .getLocalBranchesItem(tree, clonedRepositoryFile));
item.getNode("master").select();
ContextMenuHelper.clickContextMenu(tree, myUtil
@@ -314,8 +313,8 @@ public class GitRepositoriesViewBranchHandlingTest extends
refreshAndWait();
- item = myRepoViewUtil.getLocalBranchesItem(tree, clonedRepositoryFile)
- .expand();
+ item = TestUtil.expandAndWait(myRepoViewUtil.getLocalBranchesItem(tree,
+ clonedRepositoryFile));
assertEquals("newmaster", item.getNode(0).select().getText());
ContextMenuHelper.clickContextMenu(tree, myUtil
@@ -330,8 +329,8 @@ public class GitRepositoriesViewBranchHandlingTest extends
refreshAndWait();
- item = myRepoViewUtil.getLocalBranchesItem(tree, clonedRepositoryFile)
- .expand();
+ item = TestUtil.expandAndWait(myRepoViewUtil.getLocalBranchesItem(tree,
+ clonedRepositoryFile));
assertEquals("master", item.getNode(0).select().getText());
}
@@ -370,7 +369,7 @@ public class GitRepositoriesViewBranchHandlingTest extends
SWTBotTreeItem localItem = myRepoViewUtil.getLocalBranchesItem(view
.bot().tree(), clonedRepositoryFile);
- localItem.expand().getNode("configTest").select();
+ TestUtil.expandAndWait(localItem).getNode("configTest").select();
ContextMenuHelper.clickContextMenuSync(view.bot().tree(),
myUtil.getPluginLocalizedValue("ShowIn"),
@@ -382,24 +381,24 @@ public class GitRepositoriesViewBranchHandlingTest extends
.tree()
.getTreeItem(
UIText.BranchPropertySource_UpstreamConfigurationCategory);
- SWTBotTreeItem rebaseItem = rootItem.expand().getNode(
- UIText.BranchPropertySource_RebaseDescriptor);
+ SWTBotTreeItem rebaseItem = TestUtil.expandAndWait(rootItem)
+ .getNode(UIText.BranchPropertySource_RebaseDescriptor);
assertEquals(UIText.BranchPropertySource_ValueNotSet,
rebaseItem.cell(1));
- SWTBotTreeItem remoteItem = rootItem.expand().getNode(
- UIText.BranchPropertySource_RemoteDescriptor);
+ SWTBotTreeItem remoteItem = rootItem
+ .getNode(UIText.BranchPropertySource_RemoteDescriptor);
assertEquals("origin", remoteItem.cell(1));
- SWTBotTreeItem upstreamItem = rootItem.expand().getNode(
- UIText.BranchPropertySource_UpstreamBranchDescriptor);
+ SWTBotTreeItem upstreamItem = rootItem
+ .getNode(UIText.BranchPropertySource_UpstreamBranchDescriptor);
assertEquals("refs/heads/master", upstreamItem.cell(1));
view = getOrOpenView();
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(),
clonedRepositoryFile);
- localItem.expand().getNode("configTest").select();
+ TestUtil.expandAndWait(localItem).getNode("configTest").select();
ContextMenuHelper.clickContextMenu(view.bot().tree(),
myUtil.getPluginLocalizedValue("ConfigurBranchCommand.label"));
@@ -455,7 +454,7 @@ public class GitRepositoriesViewBranchHandlingTest extends
localItem = myRepoViewUtil.getLocalBranchesItem(view.bot().tree(),
clonedRepositoryFile);
- localItem.expand().getNode("configTest").select();
+ TestUtil.expandAndWait(localItem).getNode("configTest").select();
ContextMenuHelper.clickContextMenu(view.bot().tree(),
myUtil.getPluginLocalizedValue("ShowIn"),
@@ -467,8 +466,8 @@ public class GitRepositoriesViewBranchHandlingTest extends
.tree()
.getTreeItem(
UIText.BranchPropertySource_UpstreamConfigurationCategory);
- rebaseItem = rootItem.expand().getNode(
- UIText.BranchPropertySource_RebaseDescriptor);
+ rebaseItem = TestUtil.expandAndWait(rootItem)
+ .getNode(UIText.BranchPropertySource_RebaseDescriptor);
assertEquals("true", rebaseItem.cell(1));
}
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
index 85a4a38349..35c103d100 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewFetchAndPushTest.java
@@ -277,13 +277,16 @@ public class GitRepositoriesViewFetchAndPushTest extends
private void selectNode(SWTBotTree tree, boolean useRemote, boolean fetchMode)
throws Exception {
- if (useRemote)
- myRepoViewUtil.getRemotesItem(tree, clonedRepositoryFile).expand()
- .getNode("origin").select();
- else
- myRepoViewUtil.getRemotesItem(tree, clonedRepositoryFile).expand()
- .getNode("origin").expand().getNode(fetchMode ? 0 : 1)
+ SWTBotTreeItem remotesNode = myRepoViewUtil.getRemotesItem(tree,
+ clonedRepositoryFile);
+ SWTBotTreeItem originNode = TestUtil.expandAndWait(remotesNode)
+ .getNode("origin");
+ if (useRemote) {
+ originNode.select();
+ } else {
+ TestUtil.expandAndWait(originNode).getNode(fetchMode ? 0 : 1)
.select();
+ }
}
private void runPush(SWTBotTree tree) {
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java
index 9e34eeb096..5bab7a5f1b 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRemoteHandlingTest.java
@@ -19,6 +19,7 @@ import java.util.List;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.UIText;
import org.eclipse.egit.ui.test.ContextMenuHelper;
+import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jgit.lib.Repository;
import org.eclipse.jgit.lib.StoredConfig;
@@ -63,8 +64,8 @@ public class GitRepositoriesViewRemoteHandlingTest extends
removeRemotesConfig(repositoryFile);
refreshAndWait();
SWTBotTree tree = getOrOpenView().bot().tree();
- SWTBotTreeItem remotesItem = myRepoViewUtil.getRemotesItem(tree,
- repositoryFile).expand();
+ SWTBotTreeItem remotesItem = myRepoViewUtil
+ .getRemotesItem(tree, repositoryFile).expand();
assertEquals("Wrong number of remotes", 0, remotesItem.getNodes()
.size());
StoredConfig cfg = lookupRepository(repositoryFile).getConfig();
@@ -81,22 +82,20 @@ public class GitRepositoriesViewRemoteHandlingTest extends
cfg.save();
cfg.load();
refreshAndWait();
- remotesItem = myRepoViewUtil.getRemotesItem(tree, repositoryFile)
- .expand();
+ remotesItem = TestUtil.expandAndWait(
+ myRepoViewUtil.getRemotesItem(tree, repositoryFile));
assertEquals("Wrong number of remotes", 3, remotesItem.getNodes()
.size());
- remotesItem = myRepoViewUtil.getRemotesItem(tree, repositoryFile)
- .expand();
- List<String> testnodes = remotesItem.getNode("test").expand()
- .getNodes();
+ List<String> testnodes = TestUtil
+ .expandAndWait(remotesItem.getNode("test")).getNodes();
assertEquals(2, testnodes.size());
- List<String> test2nodes = remotesItem.getNode("test2").expand()
- .getNodes();
+ List<String> test2nodes = TestUtil
+ .expandAndWait(remotesItem.getNode("test2")).getNodes();
assertEquals(2, test2nodes.size());
// error node should be shown
- remotesItem.getNode("test3").expand().getNodes();
- assertEquals(1, remotesItem.getNode("test3").expand().getNodes().size());
+ assertEquals(1, TestUtil.expandAndWait(remotesItem.getNode("test3"))
+ .getNodes().size());
// test the properties view on remote
remotesItem.getNode("test").select();
@@ -126,10 +125,8 @@ public class GitRepositoriesViewRemoteHandlingTest extends
refreshAndWait();
SWTBotTree tree = getOrOpenView().bot().tree();
SWTBotTreeItem remotesItem = myRepoViewUtil.getRemotesItem(tree,
- repositoryFile).expand();
+ repositoryFile);
- remotesItem = myRepoViewUtil.getRemotesItem(tree, repositoryFile)
- .expand();
remotesItem.select();
ContextMenuHelper.clickContextMenu(tree, myUtil
.getPluginLocalizedValue("NewRemoteCommand"));
@@ -167,9 +164,10 @@ public class GitRepositoriesViewRemoteHandlingTest extends
.click();
refreshAndWait();
- // assert 1 children
- SWTBotTreeItem item = myRepoViewUtil.getRemotesItem(tree,
- repositoryFile).expand().getNode("testRemote").expand();
+ // assert children (push is shown also if there's only a fetch URI)
+ SWTBotTreeItem item = TestUtil.expandAndWait(
+ myRepoViewUtil.getRemotesItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode("testRemote"));
List<String> children = item.getNodes();
assertEquals(2, children.size());
item.select();
@@ -205,8 +203,9 @@ public class GitRepositoriesViewRemoteHandlingTest extends
refreshAndWait();
// assert 2 children
- item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand()
- .getNode("testRemote").expand();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getRemotesItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode("testRemote"));
children = item.getNodes();
assertEquals(2, children.size());
item.getNode(0).select();
@@ -215,8 +214,9 @@ public class GitRepositoriesViewRemoteHandlingTest extends
.getPluginLocalizedValue("RemoveFetchCommand"));
refreshAndWait();
// assert 1 children
- item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand()
- .getNode("testRemote").expand();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getRemotesItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode("testRemote"));
children = item.getNodes();
assertEquals(1, children.size());
item.getNode(0).select();
@@ -225,13 +225,13 @@ public class GitRepositoriesViewRemoteHandlingTest extends
.getPluginLocalizedValue("RemovePushCommand"));
refreshAndWait();
// assert 0 children
- item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand()
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getRemotesItem(tree, repositoryFile))
.getNode("testRemote").expand();
children = item.getNodes();
assertEquals(0, children.size());
- myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode(
- "testRemote").select();
+ item.select();
ContextMenuHelper.clickContextMenu(tree, myUtil
.getPluginLocalizedValue("ConfigureFetchCommand"));
@@ -263,14 +263,16 @@ public class GitRepositoriesViewRemoteHandlingTest extends
.click();
refreshAndWait();
// assert 1 children
- item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand()
- .getNode("testRemote").expand();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getRemotesItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode("testRemote"));
children = item.getNodes();
assertEquals(2, children.size());
// we remove the fetch again
- item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand()
- .getNode("testRemote").expand();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getRemotesItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode("testRemote"));
children = item.getNodes();
assertEquals(2, children.size());
item.getNode(0).select();
@@ -278,8 +280,9 @@ public class GitRepositoriesViewRemoteHandlingTest extends
.getPluginLocalizedValue("RemoveFetchCommand"));
refreshAndWait();
- myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand().getNode(
- "testRemote").select();
+ TestUtil.expandAndWait(
+ myRepoViewUtil.getRemotesItem(tree, repositoryFile))
+ .getNode("testRemote").select();
ContextMenuHelper.clickContextMenu(tree, myUtil
.getPluginLocalizedValue("ConfigurePushCommand"));
@@ -325,8 +328,9 @@ public class GitRepositoriesViewRemoteHandlingTest extends
shell.bot().button(UIText.SimpleConfigurePushDialog_SaveButton).click();
refreshAndWait();
// assert 2 children
- item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand()
- .getNode("testRemote").expand();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getRemotesItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode("testRemote"));
children = item.getNodes();
assertEquals(1, children.size());
item.select();
@@ -338,8 +342,9 @@ public class GitRepositoriesViewRemoteHandlingTest extends
refreshAndWait();
// assert 2 children
- item = myRepoViewUtil.getRemotesItem(tree, repositoryFile).expand()
- .getNode("testRemote").expand();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getRemotesItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode("testRemote"));
children = item.getNodes();
assertEquals(1, children.size());
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoDeletionTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoDeletionTest.java
index b9cda2da93..35bbadea6b 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoDeletionTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoDeletionTest.java
@@ -298,11 +298,10 @@ public class GitRepositoriesViewRepoDeletionTest extends
refreshAndWait();
SWTBotTree tree = getOrOpenView().bot().tree();
- tree.getAllItems()[0]
- .expand()
- .expandNode(
- UIText.RepositoriesViewLabelProvider_SubmodulesNodeText)
- .getItems()[0].select();
+ SWTBotTreeItem item = TestUtil.expandAndWait(tree.getAllItems()[0]);
+ item = TestUtil.expandAndWait(item.getNode(
+ UIText.RepositoriesViewLabelProvider_SubmodulesNodeText));
+ item.getItems()[0].select();
ContextMenuHelper.clickContextMenu(tree, myUtil
.getPluginLocalizedValue(DELETE_REPOSITORY_CONTEXT_MENU_LABEL));
SWTBotShell shell = bot
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
index c3dde96548..f4fead8528 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java
@@ -244,7 +244,9 @@ public class GitRepositoriesViewRepoHandlingTest extends
.getText().startsWith(nodeText));
view.show();
- projectItem.expand().getNode(FOLDER).expand().getNode(FILE1).select();
+ SWTBotTreeItem item = TestUtil.expandAndWait(projectItem);
+ item = TestUtil.expandAndWait(item.getNode(FOLDER));
+ item.getNode(FILE1).select();
ContextMenuHelper.clickContextMenuSync(explorerTree, "Show In",
viewName);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java
index 25e0c7d80c..fc9fec341e 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTagHandlingTest.java
@@ -76,8 +76,8 @@ public class GitRepositoriesViewTagHandlingTest extends
String newObject = getObjectIdOfCommit();
createTag("SecondTag", "The second tag");
refreshAndWait();
- SWTBotTreeItem tagsItem = myRepoViewUtil.getTagsItem(tree,
- repositoryFile).expand();
+ SWTBotTreeItem tagsItem = TestUtil.expandAndWait(
+ myRepoViewUtil.getTagsItem(tree, repositoryFile));
SWTBotTreeItem[] items = tagsItem.getItems();
assertEquals("Wrong number of tags", initialCount + 2, items.length);
@@ -95,8 +95,8 @@ public class GitRepositoriesViewTagHandlingTest extends
createTag("Delete1", "The first tag");
refreshAndWait();
- SWTBotTreeItem tagsItem = myRepoViewUtil.getTagsItem(tree,
- repositoryFile).expand();
+ SWTBotTreeItem tagsItem = TestUtil.expandAndWait(
+ myRepoViewUtil.getTagsItem(tree, repositoryFile));
SWTBotTreeItem[] items = tagsItem.getItems();
assertEquals("Wrong number of tags", initialCount + 1, items.length);
tagsItem.select("Delete1");
@@ -124,8 +124,8 @@ public class GitRepositoriesViewTagHandlingTest extends
createTag("Delete2", "The first tag");
createTag("Delete3", "The second tag");
refreshAndWait();
- SWTBotTreeItem tagsItem = myRepoViewUtil.getTagsItem(tree,
- repositoryFile).expand();
+ SWTBotTreeItem tagsItem = TestUtil.expandAndWait(
+ myRepoViewUtil.getTagsItem(tree, repositoryFile));
SWTBotTreeItem[] items = tagsItem.getItems();
assertEquals("Wrong number of tags", initialCount + 2, items.length);
tagsItem.select("Delete2", "Delete3");
@@ -151,8 +151,8 @@ public class GitRepositoriesViewTagHandlingTest extends
assertFalse("Wrong content", initialContent.equals(newContent));
createTag("ResetToSecond", "The second tag");
refreshAndWait();
- myRepoViewUtil.getTagsItem(tree, repositoryFile).expand().getNode(
- "ResetToFirst").select();
+ TestUtil.expandAndWait(myRepoViewUtil.getTagsItem(tree, repositoryFile))
+ .getNode("ResetToFirst").select();
ContextMenuHelper.clickContextMenu(tree, myUtil
.getPluginLocalizedValue("ResetCommand"));
@@ -178,8 +178,8 @@ public class GitRepositoriesViewTagHandlingTest extends
public void testPushTagPreselectsTag() throws Exception {
createTag("tag-to-push", "Tag to push");
SWTBotTree tree = getOrOpenView().bot().tree();
- myRepoViewUtil.getTagsItem(tree, repositoryFile)
- .expand().getNode("tag-to-push").select();
+ TestUtil.expandAndWait(myRepoViewUtil.getTagsItem(tree, repositoryFile))
+ .getNode("tag-to-push").select();
ContextMenuHelper.clickContextMenu(tree,
myUtil.getPluginLocalizedValue("RepoViewPushTag.label"));
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
index 7196648991..6e2cba3d54 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTest.java
@@ -93,8 +93,8 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
@Test
public void testExpandFirstLevel() throws Exception {
SWTBotTree tree = getOrOpenView().bot().tree();
- SWTBotTreeItem item = myRepoViewUtil.getRootItem(tree, repositoryFile)
- .expand();
+ SWTBotTreeItem item = TestUtil.expandAndWait(
+ myRepoViewUtil.getRootItem(tree, repositoryFile));
SWTBotTreeItem[] children = item.getItems();
assertEquals("Wrong number of children", 5, children.length);
}
@@ -116,9 +116,11 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
item.doubleClick();
assertTrue("Item should be expanded", item.isExpanded());
// open a file in editor
- item = myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand();
- SWTBotTreeItem fileiItem = item.getNode(PROJ1).expand().getNode(FOLDER)
- .expand().getNode(FILE1).select();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getWorkdirItem(tree, repositoryFile));
+ SWTBotTreeItem fileiItem = TestUtil.expandAndWait(item.getNode(PROJ1))
+ .getNode(FOLDER);
+ fileiItem = TestUtil.expandAndWait(fileiItem).getNode(FILE1).select();
fileiItem.doubleClick();
assertTrue(bot.activeEditor().getTitle().equals(FILE1));
bot.activeEditor().close();
@@ -136,8 +138,9 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
private void checkoutWithDoubleClick(SWTBotTree tree, String branch)
throws Exception {
- myRepoViewUtil.getLocalBranchesItem(tree, repositoryFile).expand()
- .getNode(branch).doubleClick();
+ SWTBotTreeItem node = myRepoViewUtil.getLocalBranchesItem(tree,
+ repositoryFile);
+ TestUtil.expandAndWait(node).getNode(branch).doubleClick();
SWTBotShell shell = bot
.shell(UIText.RepositoriesView_CheckoutConfirmationTitle);
shell.bot().button(IDialogConstants.OK_LABEL).click();
@@ -154,13 +157,16 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
@Test
public void testExpandSymbolicRef() throws Exception {
SWTBotTree tree = getOrOpenView().bot().tree();
- SWTBotTreeItem item = myRepoViewUtil.getSymbolicRefsItem(tree,
- repositoryFile).expand();
+ SWTBotTreeItem item = TestUtil.expandAndWait(
+ myRepoViewUtil.getSymbolicRefsItem(tree, repositoryFile));
List<String> children = item.getNodes();
boolean found = false;
- for (String child : children)
- if (child.contains(Constants.HEAD))
+ for (String child : children) {
+ if (child.contains(Constants.HEAD)) {
found = true;
+ break;
+ }
+ }
assertTrue(found);
}
@@ -175,12 +181,17 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
Repository myRepository = lookupRepository(repositoryFile);
List<String> children = Arrays
.asList(myRepository.getWorkTree().list());
- List<String> treeChildren = myRepoViewUtil.getWorkdirItem(tree,
- repositoryFile).expand().getNodes();
+ List<String> treeChildren = TestUtil
+ .expandAndWait(
+ myRepoViewUtil.getWorkdirItem(tree, repositoryFile))
+ .getNodes();
assertTrue(children.containsAll(treeChildren)
&& treeChildren.containsAll(children));
- myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
- PROJ1).expand().getNode(FOLDER).expand().getNode(FILE1);
+ SWTBotTreeItem item = TestUtil.expandAndWait(
+ myRepoViewUtil.getWorkdirItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode(PROJ1));
+ item = TestUtil.expandAndWait(item.getNode(FOLDER));
+ item.getNode(FILE1);
}
/**
@@ -253,8 +264,9 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
.getText(), wizardNode);
shell.close();
// start wizard from .git
- myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
- Constants.DOT_GIT).select();
+ TestUtil.expandAndWait(
+ myRepoViewUtil.getWorkdirItem(tree, repositoryFile))
+ .getNode(Constants.DOT_GIT).select();
ContextMenuHelper.clickContextMenu(tree, myUtil
.getPluginLocalizedValue("ImportProjectsCommand"));
shell = bot.shell(wizardTitle);
@@ -292,8 +304,9 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
UIText.GitCreateProjectViaWizardWizard_WizardTitle,
repositoryFile.getPath());
// start wizard from PROJ2
- myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
- PROJ2).select();
+ TestUtil.expandAndWait(
+ myRepoViewUtil.getWorkdirItem(tree, repositoryFile))
+ .getNode(PROJ2).select();
ContextMenuHelper.clickContextMenu(tree, myUtil
.getPluginLocalizedValue("ImportProjectsCommand"));
SWTBotShell shell = bot.shell(wizardTitle);
@@ -315,15 +328,17 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());
// switch to a sub directory and see if this is used
shell.bot().button(IDialogConstants.BACK_LABEL).click();
- shell.bot().tree().getAllItems()[0].expand().getNode(PROJ2).expand()
- .getNode(FOLDER).select();
+ SWTBotTreeItem item = TestUtil
+ .expandAndWait(shell.bot().tree().getAllItems()[0]);
+ TestUtil.expandAndWait(item.getNode(PROJ2)).getNode(FOLDER).select();
shell.bot().button(IDialogConstants.NEXT_LABEL).click();
String name = shell.bot().textWithLabel(
UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText();
assertEquals(FOLDER, name);
shell.bot().button(IDialogConstants.BACK_LABEL).click();
// switch back to the root directory
- shell.bot().tree().getAllItems()[0].expand().getNode(PROJ2).select();
+ TestUtil.expandAndWait(shell.bot().tree().getAllItems()[0])
+ .getNode(PROJ2).select();
shell.bot().button(IDialogConstants.NEXT_LABEL).click();
assertEquals(PROJ2, shell.bot().textWithLabel(
UIText.GitCreateGeneralProjectPage_ProjectNameLabel).getText());
@@ -345,8 +360,9 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
UIText.GitCreateProjectViaWizardWizard_WizardTitle,
repositoryFile.getPath());
// start wizard from PROJ1
- myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand().getNode(
- PROJ1).select();
+ TestUtil.expandAndWait(
+ myRepoViewUtil.getWorkdirItem(tree, repositoryFile))
+ .getNode(PROJ1).select();
ContextMenuHelper.clickContextMenu(tree, myUtil
.getPluginLocalizedValue("ImportProjectsCommand"));
SWTBotShell shell = bot.shell(wizardTitle);
@@ -467,13 +483,15 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
SWTBotView view = TestUtil.showExplorerView();
SWTBotTree projectExplorerTree = view.bot().tree();
- SWTBotTreeItem item = getProjectItem(projectExplorerTree, PROJ1)
- .expand().getNode(FOLDER).expand().getNode(FILE1);
+ SWTBotTreeItem item = TestUtil
+ .expandAndWait(getProjectItem(projectExplorerTree, PROJ1));
+ item = TestUtil.expandAndWait(item.getNode(FOLDER)).getNode(FILE1);
view.show();
item.doubleClick();
- item = getProjectItem(projectExplorerTree, PROJ1).expand()
- .getNode(FOLDER).expand().getNode(FILE2);
+ item = TestUtil
+ .expandAndWait(getProjectItem(projectExplorerTree, PROJ1));
+ item = TestUtil.expandAndWait(item.getNode(FOLDER)).getNode(FILE2);
view.show();
item.doubleClick();
// now we should have two editors
@@ -501,9 +519,11 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
bot.editorByTitle(FILE1).show();
- myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand()
- .getNode(PROJ1).expand().getNode(FOLDER).expand()
- .getNode(FILE2).select();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getWorkdirItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode(PROJ1));
+ item = TestUtil.expandAndWait(item.getNode(FOLDER));
+ item.getNode(FILE2).select();
// the editor should still be test.txt
assertEquals(FILE1, bot.activeEditor().getTitle());
@@ -516,22 +536,28 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
// tried setting focus, waiting for focus, joining RepositoriesView
// refresh job
waitInUI();
- myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand()
- .getNode(PROJ1).expand().getNode(FOLDER).expand()
- .getNode(FILE2).select();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getWorkdirItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode(PROJ1));
+ item = TestUtil.expandAndWait(item.getNode(FOLDER));
+ item.getNode(FILE2).select();
TestUtil.waitUntilEditorIsActive(bot, bot.editorByTitle(FILE2), 10000);
- myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand()
- .getNode(PROJ1).expand().getNode(FOLDER).expand()
- .getNode(FILE1).select();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getWorkdirItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode(PROJ1));
+ item = TestUtil.expandAndWait(item.getNode(FOLDER));
+ item.getNode(FILE1).select();
TestUtil.waitUntilEditorIsActive(bot, bot.editorByTitle(FILE1), 10000);
// deactivate the link with editor
toggleLinkWithSelection();
- myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand()
- .getNode(PROJ1).expand().getNode(FOLDER).expand()
- .getNode(FILE2).select();
+ item = TestUtil.expandAndWait(
+ myRepoViewUtil.getWorkdirItem(tree, repositoryFile));
+ item = TestUtil.expandAndWait(item.getNode(PROJ1));
+ item = TestUtil.expandAndWait(item.getNode(FOLDER));
+ item.getNode(FILE2).select();
TestUtil.waitUntilEditorIsActive(bot, bot.editorByTitle(FILE1), 10000);
}
@@ -541,8 +567,8 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
SWTBotTree tree = getOrOpenView().bot().tree();
refreshAndWait();
// create a branch (no checkout)
- SWTBotTreeItem localBranchesItem = myRepoViewUtil.getLocalBranchesItem(
- tree, repositoryFile).expand();
+ SWTBotTreeItem localBranchesItem = TestUtil.expandAndWait(
+ myRepoViewUtil.getLocalBranchesItem(tree, repositoryFile));
SWTBotTreeItem masterNode = localBranchesItem.getNode("master");
masterNode.select();
ContextMenuHelper.clickContextMenu(tree, myUtil
@@ -556,8 +582,8 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
refreshAndWait();
// delete branch
// lookup node again. Widget might have changed due to refresh
- localBranchesItem = myRepoViewUtil.getLocalBranchesItem(
- tree, repositoryFile).expand();
+ localBranchesItem = TestUtil.expandAndWait(
+ myRepoViewUtil.getLocalBranchesItem(tree, repositoryFile));
localBranchesItem.getNode("abc").select();
ContextMenuHelper.clickContextMenuSync(tree,
myUtil.getPluginLocalizedValue("RepoViewDeleteBranch.label"));
@@ -576,8 +602,8 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
SWTBotTree tree = getOrOpenView().bot().tree();
refreshAndWait();
// open a branch (checkout)
- SWTBotTreeItem localBranchesItem = myRepoViewUtil.getLocalBranchesItem(
- tree, repositoryFile).expand();
+ SWTBotTreeItem localBranchesItem = TestUtil.expandAndWait(
+ myRepoViewUtil.getLocalBranchesItem(tree, repositoryFile));
SWTBotTreeItem masterNode = localBranchesItem.getNode("master");
// create first branch (abc)
masterNode.select();
@@ -596,8 +622,8 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
.checkBox(UIText.CreateBranchPage_CheckoutButton).deselect();
createBranchShell.bot().button(IDialogConstants.FINISH_LABEL).click();
refreshAndWait();
- localBranchesItem = myRepoViewUtil.getLocalBranchesItem(tree,
- repositoryFile).expand();
+ localBranchesItem = TestUtil.expandAndWait(
+ myRepoViewUtil.getLocalBranchesItem(tree, repositoryFile));
// delete both
localBranchesItem.select("abc", "123");
ContextMenuHelper.clickContextMenuSync(tree, myUtil
@@ -664,9 +690,11 @@ public class GitRepositoriesViewTest extends GitRepositoriesViewTestBase {
}
private SWTBotTreeItem findWorkdirNode(SWTBotTree tree, String... nodes) throws Exception {
- SWTBotTreeItem item = myRepoViewUtil.getWorkdirItem(tree, repositoryFile).expand();
- for (String node : nodes)
- item = item.getNode(node).expand();
- return item;
+ SWTBotTreeItem item = myRepoViewUtil.getWorkdirItem(tree,
+ repositoryFile);
+ for (String node : nodes) {
+ item = TestUtil.expandAndWait(item).getNode(node);
+ }
+ return item.expand();
}
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestUtils.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestUtils.java
index a5fccb758d..69b2c18595 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestUtils.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewTestUtils.java
@@ -69,9 +69,9 @@ public class GitRepositoriesViewTestUtils {
String rootText = labelProvider.getStyledText(root).getString();
SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
- SWTBotTreeItem branchesItem = rootItem.expand().getNode(
- labelProvider.getStyledText(branches).getString());
- SWTBotTreeItem localItem = branchesItem.expand().getNode(
+ SWTBotTreeItem branchesItem = TestUtil.expandAndWait(rootItem)
+ .getNode(labelProvider.getStyledText(branches).getString());
+ SWTBotTreeItem localItem = TestUtil.expandAndWait(branchesItem).getNode(
labelProvider.getStyledText(localBranches).getString());
return localItem;
}
@@ -84,8 +84,8 @@ public class GitRepositoriesViewTestUtils {
String rootText = labelProvider.getStyledText(root).getString();
SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
- SWTBotTreeItem tagsItem = rootItem.expand().getNode(
- labelProvider.getStyledText(tags).getString());
+ SWTBotTreeItem tagsItem = TestUtil.expandAndWait(rootItem)
+ .getNode(labelProvider.getStyledText(tags).getString());
return tagsItem;
}
@@ -99,10 +99,11 @@ public class GitRepositoriesViewTestUtils {
String rootText = labelProvider.getStyledText(root).getString();
SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
- SWTBotTreeItem branchesItem = rootItem.expand().getNode(
- labelProvider.getStyledText(branches).getString());
- SWTBotTreeItem remoteItem = branchesItem.expand().getNode(
- labelProvider.getStyledText(remoteBranches).getString());
+ SWTBotTreeItem branchesItem = TestUtil.expandAndWait(rootItem)
+ .getNode(labelProvider.getStyledText(branches).getString());
+ SWTBotTreeItem remoteItem = TestUtil.expandAndWait(branchesItem)
+ .getNode(labelProvider.getStyledText(remoteBranches)
+ .getString());
return remoteItem;
}
@@ -115,8 +116,8 @@ public class GitRepositoriesViewTestUtils {
String rootText = labelProvider.getStyledText(root).getString();
SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
- SWTBotTreeItem workdirItem = rootItem.expand().getNode(
- labelProvider.getStyledText(workdir).getString());
+ SWTBotTreeItem workdirItem = TestUtil.expandAndWait(rootItem)
+ .getNode(labelProvider.getStyledText(workdir).getString());
return workdirItem;
}
@@ -134,10 +135,10 @@ public class GitRepositoriesViewTestUtils {
Repository repository = lookupRepository(repositoryFile);
RepositoryNode root = new RepositoryNode(null, repository);
AdditionalRefsNode symrefsnode = new AdditionalRefsNode(root, repository);
- SWTBotTreeItem rootItem = tree.getTreeItem(
- labelProvider.getStyledText(root).getString()).expand();
- SWTBotTreeItem symrefsitem = rootItem.getNode(labelProvider
- .getText(symrefsnode));
+ SWTBotTreeItem rootItem = tree
+ .getTreeItem(labelProvider.getStyledText(root).getString());
+ SWTBotTreeItem symrefsitem = TestUtil.expandAndWait(rootItem)
+ .getNode(labelProvider.getStyledText(symrefsnode).getString());
return symrefsitem;
}
@@ -149,8 +150,8 @@ public class GitRepositoriesViewTestUtils {
String rootText = labelProvider.getStyledText(root).getString();
SWTBotTreeItem rootItem = tree.getTreeItem(rootText);
- SWTBotTreeItem remotesItem = rootItem.expand().getNode(
- labelProvider.getStyledText(remotes).getString());
+ SWTBotTreeItem remotesItem = TestUtil.expandAndWait(rootItem)
+ .getNode(labelProvider.getStyledText(remotes).getString());
return remotesItem;
}
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java
index 83a1f60b0e..b6550b13b8 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/AbstractSynchronizeViewTest.java
@@ -132,8 +132,8 @@ public abstract class AbstractSynchronizeViewTest extends
protected void changeFilesInProject() throws Exception {
SWTBot packageExlBot = bot.viewById(JavaUI.ID_PACKAGES).bot();
SWTBotTreeItem coreTreeItem = selectProject(PROJ1, packageExlBot.tree());
- SWTBotTreeItem rootNode = coreTreeItem.expand().getNode(0)
- .expand().select();
+ SWTBotTreeItem rootNode = TestUtil.expandAndWait(coreTreeItem);
+ rootNode = TestUtil.expandAndWait(rootNode.getNode(0)).select();
rootNode.getNode(0).select().doubleClick();
SWTBotEditor corePomEditor = bot.editorByTitle(FILE1);
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewWorkspaceModelTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewWorkspaceModelTest.java
index 31e29d8222..c8d98b6d13 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewWorkspaceModelTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/synchronize/SynchronizeViewWorkspaceModelTest.java
@@ -35,6 +35,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.resources.mapping.ModelProvider;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.egit.ui.common.CompareEditorTester;
+import org.eclipse.egit.ui.test.TestUtil;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.SWTBot;
@@ -230,7 +231,7 @@ public class SynchronizeViewWorkspaceModelTest extends AbstractSynchronizeViewTe
// then
SWTBotTree syncViewTree = bot.viewById(ISynchronizeView.VIEW_ID).bot().tree();
SWTBotTreeItem projectTree = waitForNodeWithText(syncViewTree, PROJ1);
- projectTree.expand();
+ TestUtil.expandAndWait(projectTree);
assertEquals(1, projectTree.getItems().length);
}
@@ -253,7 +254,7 @@ public class SynchronizeViewWorkspaceModelTest extends AbstractSynchronizeViewTe
SWTBotTree syncViewTree = bot.viewById(ISynchronizeView.VIEW_ID).bot().tree();
SWTBotTreeItem[] syncItems = syncViewTree.getAllItems();
assertTrue(syncItems[0].getText().contains(PROJ1));
- syncItems[0].expand();
+ TestUtil.expandAndWait(syncItems[0]);
// WidgetNotFoundException will be thrown when node named 'new.txt' not exists
assertNotNull(syncItems[0].getNode(newFileName));
}
@@ -268,8 +269,8 @@ public class SynchronizeViewWorkspaceModelTest extends AbstractSynchronizeViewTe
SWTBotTree syncViewTree = bot.viewById(ISynchronizeView.VIEW_ID).bot().tree();
SWTBotTreeItem[] syncItems = syncViewTree.getAllItems();
assertTrue(syncItems[0].getText().contains(PROJ1));
- syncItems[0].expand();
- syncItems[0].getItems()[0].expand();
+ TestUtil.expandAndWait(syncItems[0]);
+ TestUtil.expandAndWait(syncItems[0].getItems()[0]);
assertEquals(2, syncItems[0].getItems()[0].getItems().length);
// when
@@ -328,7 +329,7 @@ public class SynchronizeViewWorkspaceModelTest extends AbstractSynchronizeViewTe
SWTBotTree syncViewTree = bot.viewById(ISynchronizeView.VIEW_ID).bot().tree();
SWTBotTreeItem workingTree = syncViewTree.expandNode(PROJ1);
assertEquals(1, syncViewTree.getAllItems().length);
- workingTree.expand().getNode(name).doubleClick();
+ TestUtil.expandAndWait(workingTree).getNode(name).doubleClick();
SWTBotEditor editor = bot.editorByTitle(name);
editor.setFocus();
diff --git a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/share/SharingWizardTest.java b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/share/SharingWizardTest.java
index 5b05a33374..6fb4a3a73a 100644
--- a/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/share/SharingWizardTest.java
+++ b/org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/wizards/share/SharingWizardTest.java
@@ -51,6 +51,7 @@ import org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner;
import org.eclipse.swtbot.swt.finder.waits.Conditions;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
@@ -91,7 +92,8 @@ public class SharingWizardTest extends LocalRepositoryTestCase {
throws CoreException {
bot.menu("File").menu("New").menu("Project...").click();
SWTBotShell createProjectDialogShell = bot.shell("New Project");
- bot.tree().getTreeItem("General").expand().getNode("Project").select();
+ SWTBotTreeItem item = bot.tree().getTreeItem("General");
+ TestUtil.expandAndWait(item).getNode("Project").select();
bot.button("Next >").click();
bot.textWithLabel("Project name:").setText(projectName);

Back to the top