[jbosstools-commits] JBoss Tools SVN: r43855 - trunk/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/src/org/jboss/ide/eclipse/as/ui/bot/test/wizard.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Thu Sep 20 05:14:56 EDT 2012


Author: ljelinko
Date: 2012-09-20 05:14:56 -0400 (Thu, 20 Sep 2012)
New Revision: 43855

Modified:
   trunk/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/src/org/jboss/ide/eclipse/as/ui/bot/test/wizard/ImportProjectWizard.java
Log:
Added wait for projects to load.

Modified: trunk/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/src/org/jboss/ide/eclipse/as/ui/bot/test/wizard/ImportProjectWizard.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/src/org/jboss/ide/eclipse/as/ui/bot/test/wizard/ImportProjectWizard.java	2012-09-20 09:11:22 UTC (rev 43854)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.ui.bot.test/src/org/jboss/ide/eclipse/as/ui/bot/test/wizard/ImportProjectWizard.java	2012-09-20 09:14:56 UTC (rev 43855)
@@ -3,6 +3,7 @@
 import org.eclipse.swtbot.swt.finder.SWTBot;
 import org.eclipse.swtbot.swt.finder.keyboard.KeyboardFactory;
 import org.eclipse.swtbot.swt.finder.keyboard.Keystrokes;
+import org.eclipse.swtbot.swt.finder.waits.ICondition;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
 import org.jboss.tools.ui.bot.ext.SWTBotFactory;
@@ -49,12 +50,14 @@
 	private void loadProjectsFromFolder() {
 		getBot().text(0).setText(projectPath);
 		KeyboardFactory.getAWTKeyboard().pressShortcut(Keystrokes.TAB);
+		getBot().waitUntil(new ProjectIsLoaded());
 	}
 
 	private void loadProjectsFromZIP() {
 		getBot().radio("Select archive file:").click();
 		getBot().text(1).setText(zipFilePath);
 		KeyboardFactory.getAWTKeyboard().pressShortcut(Keystrokes.TAB);
+		getBot().waitUntil(new ProjectIsLoaded());
 	}
 
 	private void selectProjects() {
@@ -114,4 +117,24 @@
 	private SWTBot getBot(){
 		return SWTBotFactory.getBot();
 	}
+	
+	private class ProjectIsLoaded implements ICondition {
+
+		private SWTBotTree tree;
+		
+		@Override
+		public boolean test() {
+			return tree.hasItems();
+		}
+
+		@Override
+		public String getFailureMessage() {
+			return "At least one project is loaded";
+		}
+
+		@Override
+		public void init(SWTBot bot) {
+			tree = getBot().treeWithLabel("Projects:");
+		}
+	}
 }



More information about the jbosstools-commits mailing list