Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2015-08-01 22:25:10 +0000
committerAndrey Loskutov2015-08-01 22:25:10 +0000
commitb8856598334e53ec6807a380939839ac0bb5920c (patch)
treeaf5b75014219740ba8fc382320bda0002f63770f /org.eclipse.egit.ui.test
parente56089548aecffc9706506cc97ab798728cc05c6 (diff)
downloadegit-b8856598334e53ec6807a380939839ac0bb5920c.tar.gz
egit-b8856598334e53ec6807a380939839ac0bb5920c.tar.xz
egit-b8856598334e53ec6807a380939839ac0bb5920c.zip
[test stability] Fix test crash on timeout due running wizard operation
Sometimes we are too fast checking the wizard state and fail afterwards to close it, causing test crash. If one tries to close wizard dialog while operation is still running, wizard opens each time a new message dialog with the warning about running task. This causes SWTBot to give up closing the wizard shell, but after the timeout of one minute, for each test running after the current one => the execution will be aborted after 40 minutes timeout. So before trying to validate search result, give the wizard operation a chance to complete! Change-Id: I2287725261a6c012029152d160ba6fae07c9f289 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.egit.ui.test')
-rw-r--r--org.eclipse.egit.ui.test/src/org/eclipse/egit/ui/view/repositories/GitRepositoriesViewRepoHandlingTest.java21
1 files changed, 18 insertions, 3 deletions
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 69d9ca5761..797113fd11 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
@@ -265,11 +265,24 @@ public class GitRepositoriesViewRepoHandlingTest extends
myUtil
.getPluginLocalizedValue("RepoViewAddRepository.tooltip"))
.click();
+ TestUtil.processUIEvents();
SWTBotShell shell = bot
.shell(UIText.RepositorySearchDialog_AddGitRepositories);
shell.bot().textWithLabel(UIText.RepositorySearchDialog_directory)
.setText(getTestDirectory().getPath());
+
+ assertEquals(0, ModalContext.getModalLevel());
+
shell.bot().button(UIText.RepositorySearchDialog_Search).click();
+ TestUtil.processUIEvents(500);
+ int max = 5000;
+ int slept = 0;
+ while (ModalContext.getModalLevel() > 0 && slept < max) {
+ TestUtil.processUIEvents(100);
+ slept += 100;
+ }
+
+ shell.activate();
SWTBotTreeItem item = shell.bot().tree().getAllItems()[0];
item.check();
shell.bot().button(IDialogConstants.FINISH_LABEL).click();
@@ -375,15 +388,17 @@ public class GitRepositoriesViewRepoHandlingTest extends
shell.bot().textWithLabel(UIText.RepositorySearchDialog_directory)
.setText(getTestDirectory().getPath());
- shell.bot().button(UIText.RepositorySearchDialog_Search).click();
+ assertEquals(0, ModalContext.getModalLevel());
+ shell.bot().button(UIText.RepositorySearchDialog_Search).click();
+ TestUtil.processUIEvents(500);
int max = 5000;
int slept = 0;
while (ModalContext.getModalLevel() > 0 && slept < max) {
- Thread.sleep(100);
+ TestUtil.processUIEvents(100);
slept += 100;
}
-
+ shell.activate();
TestUtil.waitUntilTreeHasNodeContainsText(shell.bot(), shell.bot()
.tree(), "BareRepository1", 10000);
TestUtil.waitUntilTreeHasNodeContainsText(shell.bot(), shell.bot()

Back to the top