[jbosstools-commits] JBoss Tools SVN: r43042 - trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Aug 15 07:20:01 EDT 2012


Author: sbunciak
Date: 2012-08-15 07:20:01 -0400 (Wed, 15 Aug 2012)
New Revision: 43042

Modified:
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java
   trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java
Log:
OpenShift SWTBot tests: added creation of ssh keys.

Modified: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java	2012-08-15 10:42:34 UTC (rev 43041)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateApp.java	2012-08-15 11:20:01 UTC (rev 43042)
@@ -72,17 +72,22 @@
 
 		log.info("*** OpenShift SWTBot Tests: Application creation started. ***");
 
-		// only for the 1st time
-		// bot.waitForShell("Question", 500);
-		// bot.button(IDELabel.Button.YES).click();
+		// only for the 1st time - with known_hosts deleting it will appear every time
+		// add to known_hosts
+		bot.waitForShell("Question", TIME_60S * 3);
+		bot.button(IDELabel.Button.YES).click();
+		// create known_hosts since it does not exists any more
+		bot.waitForShell("Question", TIME_60S * 3);
+		bot.button(IDELabel.Button.YES).click();
+		
 
-		bot.waitForShell("Information", 500);
+		bot.waitForShell("Information", TIME_60S * 3);
 		bot.text(0).setText(TestProperties.get("openshift.user.pwd"));
 		bot.button(IDELabel.Button.OK).click();
 
 		log.info("*** OpenShift SWTBot Tests: SSH passphrase given. ***");
 
-		bot.waitUntil(Conditions.shellCloses(bot.activeShell()), TIME_60S);
+		bot.waitUntil(Conditions.shellCloses(bot.activeShell()), TIME_60S, TIME_1S);
 
 		log.info("*** OpenShift SWTBot Tests: New Application wizard closed. ***");
 

Modified: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java	2012-08-15 10:42:34 UTC (rev 43041)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/CreateDomain.java	2012-08-15 11:20:01 UTC (rev 43042)
@@ -4,6 +4,7 @@
 
 import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
 import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
 import org.eclipse.swtbot.swt.finder.widgets.SWTBotText;
 import org.jboss.tools.openshift.ui.bot.util.OpenShiftUI;
 import org.jboss.tools.openshift.ui.bot.util.TestProperties;
@@ -25,15 +26,16 @@
 
 	@Before
 	public void prepareSSHPrefs() {
-		// clear dir from libra stuff
-
+		// clear dir from libra stuff so wizard can create new
 		File sshDir = new File(System.getProperty("user.home") + "/.ssh");
 
 		if (sshDir.exists() && sshDir.isDirectory()
 				&& sshDir.listFiles().length > 0) {
 			for (File file : sshDir.listFiles()) {
 				if (file.getName().contains("id_rsa"))
-					keyAvailable = true;
+					file.delete();
+				if (file.getName().contains("known_hosts"))
+					file.delete();
 			}
 		}
 
@@ -60,25 +62,26 @@
 		domainText.setText(TestProperties.get("openshift.domain"));
 		log.info("*** OpenShift SWTBot Tests: Domain name set. ***");
 
+		SWTBotButton finishBtn = bot.button(IDELabel.Button.FINISH);
+		
 		if (keyAvailable) {
 
-			assertTrue("SSH key should be set!",bot.text(1).getText().contains("id_rsa"));
-			
+			assertTrue("SSH key should be set!", bot.text(1).getText()
+					.contains("id_rsa"));
+
 		} else {
-			throw new UnsupportedOperationException(
-					"Creation of ssh key not implemented yet.");
-			/*
-			 * bot.button(IDELabel.Shell.NEW).click();
-			 * bot.waitForShell(OpenShiftUI.Shell.NEW_SSH);
-			 * bot.text(0).setText(TestProperties.getPassphrase());
-			 * bot.button(IDELabel.Button.OK).click();
-			 * bot.waitForShell(OpenShiftUI.Shell.DOMAIN);
-			 * 
-			 * log.info("*** OpenShift SWTBot Tests: SSH Keys created. ***");
-			 */
+
+			bot.button(IDELabel.Shell.NEW).click();
+			bot.waitForShell(OpenShiftUI.Shell.NEW_SSH);
+			bot.text(0).setText(TestProperties.get("openshift.user.pwd"));
+			bot.button(IDELabel.Button.OK).click();
+			bot.waitForShell(OpenShiftUI.Shell.DOMAIN);
+
+			log.info("*** OpenShift SWTBot Tests: SSH Keys created. ***");
 		}
 
-		bot.button(IDELabel.Button.FINISH).click();
+		bot.waitUntil(Conditions.widgetIsEnabled(finishBtn));
+		finishBtn.click();
 
 		// wait while the domain is being created
 		bot.waitUntil(Conditions.shellCloses(bot.activeShell()), TIME_60S);

Modified: trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java
===================================================================
--- trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java	2012-08-15 10:42:34 UTC (rev 43041)
+++ trunk/openshift/tests/org.jboss.tools.openshift.ui.bot.test/src/org/jboss/tools/openshift/ui/bot/test/explorer/DeleteDomain.java	2012-08-15 11:20:01 UTC (rev 43042)
@@ -19,7 +19,7 @@
 				.getTreeItem(TestProperties.get("openshift.user.name"))
 				.contextMenu(OpenShiftUI.Labels.REFRESH).click();
 
-		bot.waitWhile(new NonSystemJobRunsCondition(), TIME_UNLIMITED);
+		bot.waitWhile(new NonSystemJobRunsCondition(), TIME_60S * 3, TIME_1S);
 		
 		// delete
 		explorer.bot().tree()
@@ -29,6 +29,6 @@
 		bot.checkBox().select();
 		bot.button("OK").click();
 
-		bot.waitWhile(new NonSystemJobRunsCondition(), TIME_60S + TIME_30S);		
+		bot.waitWhile(new NonSystemJobRunsCondition(), TIME_60S * 3, TIME_1S);		
 	}
 }



More information about the jbosstools-commits mailing list