Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2016-04-27 17:12:17 -0400
committerThomas Wolf2016-05-03 14:36:13 -0400
commit4bdcf80be11c7b3e2b9ec2b7d7383cf5ab0412df (patch)
tree8b93d620131d3a9645aa28d405458e17427efa02 /org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/submodule
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/org/eclipse/egit/ui/submodule')
-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
3 files changed, 10 insertions, 13 deletions
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 49ea478a7..a953e3e43 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 07345cb0f..814d0f027 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 21f0a0e9e..aa2d394e1 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));

Back to the top