[jbosstools-commits] JBoss Tools SVN: r39305 - in trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot: helper and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Tue Mar 6 11:26:18 EST 2012


Author: rhopp
Date: 2012-03-06 11:26:18 -0500 (Tue, 06 Mar 2012)
New Revision: 39305

Modified:
   trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CentralAllBotTests.java
   trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsTest.java
   trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/DocumentationSectionTest.java
   trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/WithDataMatcher.java
Log:
Changes needed to run on JBT 3.3.0.Beta1

Modified: trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CentralAllBotTests.java
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CentralAllBotTests.java	2012-03-06 16:23:01 UTC (rev 39304)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CentralAllBotTests.java	2012-03-06 16:26:18 UTC (rev 39305)
@@ -7,9 +7,9 @@
 @RunWith(RequirementAwareSuite.class)
 @SuiteClasses({
 	//BaseFunctionalityTest.class,
-	//CreateProjectsTest.class
+	CreateProjectsTest.class
 	//DocumentationSectionTest.class
-	EmptyTestForHudson.class
+	//EmptyTestForHudson.class
 	})
 public class CentralAllBotTests {
 

Modified: trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsTest.java
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsTest.java	2012-03-06 16:23:01 UTC (rev 39304)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsTest.java	2012-03-06 16:26:18 UTC (rev 39305)
@@ -15,11 +15,12 @@
 import org.jboss.tools.ui.bot.ext.parts.SWTBotBrowserExt;
 import org.jboss.tools.ui.bot.ext.parts.SWTBotTwistie;
 import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ui.bot.ext.wizards.SWTBotWizard;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-//@Require(server=@org.jboss.tools.ui.bot.ext.config.Annotations.Server(type=ServerType.JbossAS))
+ at Require(server=@org.jboss.tools.ui.bot.ext.config.Annotations.Server(type=ServerType.JbossAS))
 public class CreateProjectsTest extends SWTTestExt{
 	
 	private static final String JBOSS_INSTALL_PATH = "/tmp/jbossAS";
@@ -45,49 +46,50 @@
 		assertTrue("New Dynamic Web Project should have appeared", bot.shell(IDELabel.JBossCentralEditor.NEW_DYNAMIC_WEB_PROJECT).isActive());
 		bot.activeShell().close();
 		//Openshift app
+		log.info(bot.activeShell().getText());
 		bot.hyperlink(IDELabel.JBossCentralEditor.OPENSHIFT_APP).click();
 		bot.waitForShell(IDELabel.JBossCentralEditor.OPENSHIFT_APP_WIZARD);
 		//assertTrue("New Dynamic Web Project should have appeared", bot.shell(IDELabel.JBossCentralEditor.OPENSHIFT_APP_WIZARD).isActive());
 		bot.activeShell().close();
 		
 		//check Project example and detection of server
-		/*formsBot.formTextWithText(IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT).click();
-		SWTBotShell projectExampleShell = bot.waitForShell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE);
-		assertTrue("Project Example window should have appeared", bot.shell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE).isActive());
-		try{
-			bot.clickButton("Install");
-			SWTBotShell shell = bot.waitForShell(IDELabel.Menu.PREFERENCES);
-			if (shell == null){
-				fail("Preferences shell should have appeared");
-			}
-			bot.activeShell().close();
-		}catch(WidgetNotFoundException wnfex){
-			fail("Missing Install button");
-		}
-		try{
-			projectExampleShell.activate();
-			bot.clickButton("Download and Install...");
-		}catch(WidgetNotFoundException wnfex){
-			fail("Missing \"Download and Install\" button");
-		}
+//		formsBot.formTextWithText(IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT).click();
+//		//bot.hyperlink(IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT).click();
+//		SWTBotShell projectExampleShell = bot.waitForShell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE);
+//		assertTrue("Project Example window should have appeared", bot.shell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE).isActive());
+//		try{
+//			bot.clickButton("Install");
+//			SWTBotShell shell = bot.waitForShell(IDELabel.Menu.PREFERENCES);
+//			if (shell == null){
+//				fail("Preferences shell should have appeared");
+//			}
+//			bot.activeShell().close();
+//		}catch(WidgetNotFoundException wnfex){
+//			fail("Missing Install button");
+//		}
+//		try{
+//			projectExampleShell.activate();
+//			bot.clickButton("Download and Install...");
+//		}catch(WidgetNotFoundException wnfex){
+//			fail("Missing \"Download and Install\" button");
+//		}
+//		
+//		//create direcotry where will be JBossAS downloaded
+//		if(!createDirectory(JBOSS_INSTALL_PATH)){
+//			fail("Unable to create direcory for JBoss - \""+JBOSS_INSTALL_PATH+"\"");
+//		}
+//		
+//		bot.textWithLabel("Install folder:").setText(JBOSS_INSTALL_PATH);
+//		bot.textWithLabel("Download folder:").setText("/tmp");
+//		bot.clickButton("OK");
+//		bot.waitForShell("Progress Information");
+//		util.waitForNonIgnoredJobs(Long.MAX_VALUE);
+//		//bot.waitUntil(Conditions.shellCloses(bot.activeShell()), Long.MAX_VALUE, TIME_5S);
+//		projectExampleShell.close();
 		
-		//create direcotry where will be JBossAS downloaded
-		if(!createDirectory(JBOSS_INSTALL_PATH)){
-			fail("Unable to create direcory for JBoss - \""+JBOSS_INSTALL_PATH+"\"");
-		}
-		
-		bot.textWithLabel("Install folder:").setText(JBOSS_INSTALL_PATH);
-		bot.textWithLabel("Download folder:").setText("/tmp");
-		bot.clickButton("OK");
-		bot.waitForShell("Progress Information");
-		bot.sleep(TIME_1S);
-		util.waitForNonIgnoredJobs(Long.MAX_VALUE);
-		//bot.waitUntil(Conditions.shellCloses(bot.activeShell()), Long.MAX_VALUE, TIME_5S);
-		projectExampleShell.close();
-		bot.sleep(TIME_1S);*/
-		
 		//server should be added.. check again
-		formsBot.formTextWithText(IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT).click();
+		//formsBot.formTextWithText(IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT).click();
+		bot.hyperlink(IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT).click();
 		SWTBotShell projectExampleShell = bot.waitForShell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE);
 		assertTrue("Project Example window should have appeared", bot.shell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE).isActive());
 		try{
@@ -96,28 +98,25 @@
 		}catch(WidgetNotFoundException wnfex){
 			//ok
 		}
-		try{
-			projectExampleShell.activate();
-			bot.clickButton("Download and Install...");
-			fail("Button \"Download and Install...\" should not be enabled, because all requirements should have been met");
-		}catch(WidgetNotFoundException wnfex){
-			//ok
-		}
+		projectExampleShell.activate();
+		assertFalse("Button \"Download and Install...\" should not be enabled, because all requirements should have been met, condition", bot.button("Download and Install...").isEnabled());
+//		bot.clickButton("Download and Install...");
+//		fail("Button \"Download and Install...\" should not be enabled, because all requirements should have been met");
 		projectExampleShell.close();
 		
 		//check the rest of project examples
-		checkCreateProject(formsBot, IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT, IDELabel.JBossCentralEditor.NEW_JBOSS_PROJECT);
-		checkCreateProject(formsBot, IDELabel.JBossCentralEditor.JAVA_EE_PROJECT, IDELabel.JBossCentralEditor.NEW_JBOSS_PROJECT);
-		checkCreateProject(formsBot, IDELabel.JBossCentralEditor.HTML5_PROJECT, IDELabel.JBossCentralEditor.NEW_JBOSS_PROJECT);
-		checkCreateProject(formsBot, IDELabel.JBossCentralEditor.SPRING_MVC_PROJECT, IDELabel.JBossCentralEditor.NEW_JBOSS_PROJECT);
-		checkCreateProject(formsBot, IDELabel.JBossCentralEditor.RICHFACES_PROJECT, IDELabel.JBossCentralEditor.NEW_JBOSS_PROJECT);
+		checkCreateProject(IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT);
+		checkCreateProject(IDELabel.JBossCentralEditor.JAVA_EE_PROJECT);
+		checkCreateProject(IDELabel.JBossCentralEditor.HTML5_PROJECT);
+		checkCreateProject(IDELabel.JBossCentralEditor.SPRING_MVC_PROJECT);
+		checkCreateProject(IDELabel.JBossCentralEditor.RICHFACES_PROJECT);
 		bot.toolbarDropDownButtonWithTooltip("New").click();
 		bot.waitForShell("New");
 		assertTrue("Shell \"New\" should have appeared", bot.shell("New").isActive());
 		bot.activeShell().close();
 	}
 	
-	//@Test
+	@Test
 	public void projectExamplesSectionTest(){
 		SWTBotTwistie twistieBot = bot.twistieByLabel("JBoss Quickstarts");
 		while (!twistieBot.isExpanded()){
@@ -127,7 +126,12 @@
 			twistieBot.toggle();
 		}*/
 		SWTFormsBotExt formsBot = SWTBotFactory.getFormsBot();
-		formsBot.formTextWithText("Helloworld").click();
+		checkExample(formsBot, "Helloworld");
+		checkExample(formsBot, "Numberguess");
+		checkExample(formsBot, "Login");
+		checkExample(formsBot, "Kitchensink");
+		checkExample(formsBot, "HTML5");
+		/*formsBot.formTextWithText("Helloworld").click();
 		bot.clickButton("Start");
 		bot.waitWhile(new NonSystemJobRunsCondition(), TaskDuration.NORMAL.getTimeout());
 		formsBot.formTextWithText("Numberguess").click();
@@ -139,7 +143,7 @@
 		bot.waitWhile(new NonSystemJobRunsCondition(),TaskDuration.NORMAL.getTimeout());
 		formsBot.formTextWithText("Kitchensink").click();
 		bot.clickButton("Start");
-		bot.waitWhile(new NonSystemJobRunsCondition(), TaskDuration.NORMAL.getTimeout());
+		bot.waitWhile(new NonSystemJobRunsCondition(), TaskDuration.NORMAL.getTimeout());*/
 	}
 	
 	private void waitForAWhile(){
@@ -168,13 +172,30 @@
 	    return( path.delete() );
 	  }
 	
-	private void checkCreateProject(SWTFormsBotExt formsBot, String formText, String wizzardShellText){
+	private void checkExample(SWTFormsBotExt formsBot, String formText){
 		formsBot.formTextWithText(formText).click();
 		bot.waitForShell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE);
-		assertTrue("Project Example window should have appeared", bot.shell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE).isActive());
-		bot.button("Start").click();
-		bot.waitForShell(wizzardShellText);
-		assertTrue(wizzardShellText+"  should have appeared", bot.shell(wizzardShellText).isActive());
+		SWTBotWizard wizard = new SWTBotWizard(bot.shell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE).widget);
+		wizard.next();
+		wizard.finishWithWait();
 		bot.activeShell().close();
 	}
+	
+	private void checkCreateProject(String formText){
+		//formsBot.formTextWithText(formText).click();
+		bot.hyperlink(formText).click();
+		bot.waitForShell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE);
+		SWTBotWizard wizard = new SWTBotWizard(bot.shell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE).widget);
+		wizard.next();
+		wizard.finishWithWait();
+		bot.activeShell().close();
+		if (bot.activeEditor().getTitle().equalsIgnoreCase("cheat sheets")){
+			bot.activeEditor().close();
+		}
+//		assertTrue("Project Example window should have appeared", bot.shell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE).isActive());
+//		bot.button("Start").click();
+//		bot.waitForShell(wizzardShellText);
+//		assertTrue(wizzardShellText+"  should have appeared", bot.shell(wizzardShellText).isActive());
+//		bot.activeShell().close();
+	}
 }

Modified: trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/DocumentationSectionTest.java
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/DocumentationSectionTest.java	2012-03-06 16:23:01 UTC (rev 39304)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/DocumentationSectionTest.java	2012-03-06 16:26:18 UTC (rev 39305)
@@ -1,5 +1,8 @@
 package org.jboss.tools.central.test.ui.bot;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 import org.jboss.tools.ui.bot.ext.SWTTestExt;
 import org.jboss.tools.ui.bot.ext.condition.BrowserIsLoaded;
 import org.jboss.tools.ui.bot.ext.condition.TaskDuration;
@@ -26,7 +29,6 @@
 		testHyperlinkToBrowser("Wiki");
 		testHyperlinkToBrowser("Screencasts");
 		testHyperlinkToBrowser("Issue Tracker");
-		bot.sleep(TIME_10S);
 	}
 	
 	private void testHyperlinkToBrowser(String hyperlinkText){
@@ -34,7 +36,11 @@
 		SWTBotBrowserExt browser = bot.browserExt();
 		bot.waitUntil(new BrowserIsLoaded(browser), TaskDuration.LONG.getTimeout());
 		assertFalse("JBoss Central sould not be active editor right now", bot.activeEditor().getTitle().equals("JBoss Central"));
+		//And also can't be empty page
 		System.out.println(browser.getText());
+		Pattern pattern = Pattern.compile(".*<body></body>.*", Pattern.DOTALL);
+		Matcher matcher = pattern.matcher(browser.getText());
+		assertFalse("Page cannot be empty", matcher.matches());
 		bot.activeEditor().close();
 	}
 	

Modified: trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/WithDataMatcher.java
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/WithDataMatcher.java	2012-03-06 16:23:01 UTC (rev 39304)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/WithDataMatcher.java	2012-03-06 16:26:18 UTC (rev 39305)
@@ -1,4 +1,4 @@
-package org.jboss.tools.central.test.ui.bot.helper;
+/*package org.jboss.tools.central.test.ui.bot.helper;
 
 import org.eclipse.swt.widgets.Widget;
 import org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher;
@@ -9,7 +9,7 @@
 	/*public WithDataMatcher(String key, String value, ) {
 		
 	}*/
-	
+	/*
 	//@Override
 	public void describeTo(Description description) {
 		description.appendText("testDescription");
@@ -23,3 +23,4 @@
 	}
 
 }
+*/
\ No newline at end of file



More information about the jbosstools-commits mailing list