Author: rhopp
Date: 2012-03-19 12:21:14 -0400 (Mon, 19 Mar 2012)
New Revision: 39628
Modified:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsTest.java
Log:
Extended examples testing. Still pretty messy.
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-19
15:59:50 UTC (rev 39627)
+++
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsTest.java 2012-03-19
16:21:14 UTC (rev 39628)
@@ -7,12 +7,8 @@
import org.jboss.tools.ui.bot.ext.SWTBotFactory;
import org.jboss.tools.ui.bot.ext.SWTFormsBotExt;
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.NonSystemJobRunsCondition;
-import org.jboss.tools.ui.bot.ext.condition.TaskDuration;
import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
-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;
@@ -126,37 +122,17 @@
twistieBot.toggle();
}*/
SWTFormsBotExt formsBot = SWTBotFactory.getFormsBot();
- 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();
- bot.clickButton("Start");
- bot.waitWhile(new NonSystemJobRunsCondition(), TaskDuration.NORMAL.getTimeout());
- log.info(bot.activeEditor().getTitle());
- formsBot.formTextWithText("Login").click();
- bot.clickButton("Start");
- bot.waitWhile(new NonSystemJobRunsCondition(),TaskDuration.NORMAL.getTimeout());
- formsBot.formTextWithText("Kitchensink").click();
- bot.clickButton("Start");
- bot.waitWhile(new NonSystemJobRunsCondition(), TaskDuration.NORMAL.getTimeout());*/
+ checkExample(formsBot, "Helloworld", true);
+ checkExample(formsBot, "Numberguess", true);
+ //checkExample(formsBot, "Login", false); //Login example ma nejaky divny
login.xml cheatsheet
+ //checkExample(formsBot, "Kitchensink", true); //zatim nejaka chyba v JBDS
https://issues.jboss.org/browse/JBDS-2072
+ checkExample(formsBot, "HTML5", true);
}
private void waitForAWhile(){
bot.sleep(Long.MAX_VALUE);
}
- private boolean createDirectory(String path){
- if (new File(path).mkdir()){
- return true;
- }
- return false;
- }
-
private static boolean deleteDirectory(File path) {
if( path.exists() ) {
File[] files = path.listFiles();
@@ -172,13 +148,30 @@
return( path.delete() );
}
- private void checkExample(SWTFormsBotExt formsBot, String formText){
+ private void checkExample(SWTFormsBotExt formsBot, String formText, boolean readme){
formsBot.formTextWithText(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();
+ String readmeText = bot.checkBox(1).getText();
+ assertFalse("Quick fix should not be enabled (Everything should be fine)",
bot.checkBox(0).isEnabled());
+ if (readme){
+ assertTrue("Show readme checkbox should be enabled",
bot.checkBox(1).isEnabled());
+ assertTrue("Show readme checkbox should be checked by default",
bot.checkBox(1).isChecked());
+ if (readmeText.contains("cheatsheet.xml")){
+ bot.clickButton("Finish");
+ assertTrue("Cheat Sheets view should be open right now",
bot.activeView().getTitle().equals("Cheat Sheets"));
+ bot.activeView().close();
+ }else if (readmeText.toLowerCase().contains("readme.md")){
+ bot.clickButton("Finish");
+ assertTrue("Readme should have opened in Text Editor",
bot.activeEditor().getReference().getEditor(false).getClass().getName().contains("org.eclipse.ui.editors.text.TextEditor"));
+ bot.activeEditor().close();
+ }else if (readmeText.toLowerCase().contains("readme.htm")){
+ bot.clickButton("Finish");
+ assertTrue("Readme should have opened in Internal Browser",
bot.activeEditor().getReference().getEditor(false).getClass().getName().contains("org.eclipse.ui.internal.browser.WebBrowserEditor"));
+ }
+ }
}
private void checkCreateProject(String formText){