[jbosstools-commits] JBoss Tools SVN: r42862 - trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Mon Aug 6 09:16:36 EDT 2012
Author: rhopp
Date: 2012-08-06 09:16:35 -0400 (Mon, 06 Aug 2012)
New Revision: 42862
Removed:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithoutServerTest.java
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/EmptyTestForHudson.java
Modified:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/BaseFunctionalityTest.java
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/CreateProjectsWithServerTest.java
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/DocumentationSectionTest.java
Log:
Cleanup of JBoss Central tests
Modified: trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/BaseFunctionalityTest.java
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/BaseFunctionalityTest.java 2012-08-06 13:13:23 UTC (rev 42861)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/BaseFunctionalityTest.java 2012-08-06 13:16:35 UTC (rev 42862)
@@ -9,7 +9,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
-//@RunWith(SWTBotJunit4ClassRunner.class)
@RunWith(RequirementAwareSuite.class)
@SuiteClasses({CentralAllBotTests.class})
public class BaseFunctionalityTest extends SWTTestExt {
@@ -19,7 +18,6 @@
*/
@BeforeClass
public static void setup(){
- //jbt.closeReportUsageWindowIfOpened(false);
util.closeAllEditors(false);
util.closeAllViews();
}
@@ -45,6 +43,8 @@
assertTrue("JBoss Central is not active",bot.editorByTitle(IDELabel.JBossCentralEditor.JBOSS_CENTRAL).isActive());
}
+
+ //TODO Refactor search Test
// @Test
// public void testSearch(){
// assertTrue("JBoss Central is not active",bot.editorByTitle("JBoss Central").isActive());
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-08-06 13:13:23 UTC (rev 42861)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CentralAllBotTests.java 2012-08-06 13:16:35 UTC (rev 42862)
@@ -8,9 +8,7 @@
@SuiteClasses({
BaseFunctionalityTest.class,
CreateProjectsWithServerTest.class,
-// CreateProjectsWithoutServerTest.class
DocumentationSectionTest.class
-// EmptyTestForHudson.class
// InstallTest.class
})
public class CentralAllBotTests {
Modified: trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithServerTest.java
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithServerTest.java 2012-08-06 13:13:23 UTC (rev 42861)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithServerTest.java 2012-08-06 13:16:35 UTC (rev 42862)
@@ -93,13 +93,9 @@
@After
public void teardown(){
servers.removeAllProjectsFromServer("AS-7.0");
- /*SWTBotTreeItem[] items = ProblemsView.getErrorsNode(bot).getItems();
- for (SWTBotTreeItem swtBotTreeItem : items) {
- log.error(swtBotTreeItem.toString());
- }*/
}
-// @Test
+ @Test
public void createProjectsSectionTest(){
//Dynamic web project
bot.hyperlink(IDELabel.JBossCentralEditor.DYNAMIC_WEB_PROJECT).click();
@@ -108,14 +104,11 @@
bot.activeShell().close();
//Openshift app
log.info(bot.activeShell().getText());
-
- //TODO will put back when IDELabel.JBossCentralEditor.OPENSHIFT_APP_WIZARD will be correct
bot.hyperlink(IDELabel.JBossCentralEditor.OPENSHIFT_APP).click();
bot.waitForShell(IDELabel.JBossCentralEditor.OPENSHIFT_APP_WIZARD);
bot.waitWhile(new NonSystemJobRunsCondition());
assertTrue("New OpenShift Express Application window should have appeared", bot.activeShell().getText().equals(IDELabel.JBossCentralEditor.OPENSHIFT_APP_WIZARD));
bot.waitWhile(new NonSystemJobRunsCondition());
- //assertTrue("New OpenShift Express Application window should have appeared", bot.shell(IDELabel.JBossCentralEditor.OPENSHIFT_APP_WIZARD).isActive());
bot.activeShell().close();
bot.waitWhile(new NonSystemJobRunsCondition());
bot.hyperlink(IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT).click();
@@ -150,17 +143,14 @@
public void projectExamplesSectionTest(){
SWTBotTwistie twistieBot = bot.twistieByLabel("JBoss Quickstarts");
int counter = 0;
- while (!twistieBot.isExpanded() && counter>10){
+ while (!twistieBot.isExpanded() && counter<10){
twistieBot.toggle();
counter++;
}
- /*if (!twistieBot.isExpanded()){
- twistieBot.toggle();
- }*/
SWTFormsBotExt formsBot = SWTBotFactory.getFormsBot();
checkExample(formsBot, "Helloworld", true);
checkExample(formsBot, "Numberguess", true);
- checkExample(formsBot, "Login", true, "login.xml"); //Login example ma nejaky divny login.xml cheatsheet
+ checkExample(formsBot, "Login", true, "login.xml"); //Login has some weird login.xml cheatsheet
checkExample(formsBot, "Kitchensink", true);
checkExample(formsBot, "HTML5", true);
canBeDeployedTest();
@@ -291,22 +281,4 @@
bot.clickButton("Finish");
}
}
-
-// 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();
-// }
}
Deleted: trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithoutServerTest.java
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithoutServerTest.java 2012-08-06 13:13:23 UTC (rev 42861)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsWithoutServerTest.java 2012-08-06 13:16:35 UTC (rev 42862)
@@ -1,192 +0,0 @@
-package org.jboss.tools.central.test.ui.bot;
-
-import java.io.File;
-
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
-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.ShellIsActiveCondition;
-import org.jboss.tools.ui.bot.ext.condition.TaskDuration;
-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;
-
-public class CreateProjectsWithoutServerTest extends SWTTestExt {
-
- private static final String JBOSS_INSTALL_PATH = "/tmp/jbossAS";
-
-
- @BeforeClass
- public static void setup(){
- bot.menu("Help").menu(IDELabel.JBossCentralEditor.JBOSS_CENTRAL).click();
- util.waitForAll();
- }
-
- @AfterClass
- public static void teardown(){
- deleteDirectory(new File(JBOSS_INSTALL_PATH));
- }
-
- @Test
- public void createProjectsSectionTest(){
-// SWTFormsBotExt formsBot = SWTBotFactory.getFormsBot();
- //Dynamic web project
- bot.hyperlink(IDELabel.JBossCentralEditor.DYNAMIC_WEB_PROJECT).click();
- bot.waitForShell(IDELabel.JBossCentralEditor.NEW_DYNAMIC_WEB_PROJECT);
- assertTrue("New Dynamic Web Project should have appeared", bot.shell(IDELabel.JBossCentralEditor.NEW_DYNAMIC_WEB_PROJECT).isActive());
- bot.activeShell().close();
- //Openshift app
- bot.hyperlink(IDELabel.JBossCentralEditor.OPENSHIFT_APP).click();
- bot.waitForShell(IDELabel.JBossCentralEditor.OPENSHIFT_APP_WIZARD);
- bot.activeShell().close();
-
- //check Project example and detection of server
- 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.table().select(0);
- 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");
- //downloading jboss AS could take really long time, that's why waiting for shell twice.
- try{
- bot.waitUntil(new ShellIsActiveCondition(projectExampleShell), TaskDuration.VERY_LONG.getTimeout());
- }catch(Exception ex){
- //do nothing
- }
- bot.waitUntil(new ShellIsActiveCondition(projectExampleShell), TaskDuration.VERY_LONG.getTimeout());
- projectExampleShell.close();
-
- //server should be added.. check again
- bot.hyperlink(IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT).click();
- 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");
- fail("Button \"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());
- projectExampleShell.close();
-
- //check the rest of project examples
- checkExample(null, IDELabel.JBossCentralEditor.JAVA_EE_WEB_PROJECT, true);
- checkExample(null, IDELabel.JBossCentralEditor.JAVA_EE_PROJECT, true);
- checkExample(null, IDELabel.JBossCentralEditor.HTML5_PROJECT, true);
- checkExample(null, IDELabel.JBossCentralEditor.RICHFACES_PROJECT, true);
- checkExample(null, IDELabel.JBossCentralEditor.SPRING_MVC_PROJECT, false);
-
- bot.toolbarDropDownButtonWithTooltip("New").click();
- bot.waitForShell("New");
- assertTrue("Shell \"New\" should have appeared", bot.shell("New").isActive());
- bot.activeShell().close();
- }
-
-
- /**
- *
- * @param formsBot formBot==null => link is of type HyperLink else it is of type FormText
- * @param formText
- * @param readme true if readme should be shown
- */
-
- private void checkExample(SWTFormsBotExt formsBot, String formText, boolean readme){
- checkExample(formsBot, formText, readme, null);
- }
-
- /**
- * Checks example
- * @param formsBot bot for Forms
- * @param formText text to be clicked at
- * @param readme true if readme is supposed to show, false otherwise
- * @param readmeFileName
- */
-
- private void checkExample(SWTFormsBotExt formsBot, String formText, boolean readme, String readmeFileName){
- if (formsBot==null){
- bot.hyperlink(formText).click();
- }else{
- formsBot.formTextWithText(formText).click();
- }
- bot.waitForShell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE);
- SWTBotWizard wizard = new SWTBotWizard(bot.shell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE).widget);
- wizard.next();
- if (wizard.canNext()) wizard.next();
- wizard.finishWithWait();
- 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 (readmeFileName != null){
- assertTrue(readmeText.toLowerCase().contains(readmeFileName));
- bot.clickButton("Finish");
- assertTrue("Cheat Sheets view should be opened right now", bot.activeView().getTitle().equals("Cheat Sheets"));
- bot.activeView().close();
- }else if (readmeText.contains("cheatsheet.xml")){
- bot.clickButton("Finish");
- assertTrue("Cheat Sheets view should be opened right now", bot.activeView().getTitle().equals("Cheat Sheets"));
- bot.activeView().close();
- }else if (readmeText.toLowerCase().contains("readme.md") || readmeText.toLowerCase().contains("readme.txt")){
- 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")); //because readmes are opening in browser now.. It's a bug. Jira is created.
- 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"));
- }
- }else{
- bot.clickButton("Finish");
- }
- }
-
-
- private boolean createDirectory(String path){
- File file = new File(path);
- return file.mkdir();
- }
-
- private static boolean deleteDirectory(File path) {
- if( path.exists() ) {
- File[] files = path.listFiles();
- for(int i=0; i<files.length; i++) {
- if(files[i].isDirectory()) {
- deleteDirectory(files[i]);
- }
- else {
- files[i].delete();
- }
- }
- }
- return( path.delete() );
- }
-}
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-08-06 13:13:23 UTC (rev 42861)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/DocumentationSectionTest.java 2012-08-06 13:16:35 UTC (rev 42862)
@@ -37,7 +37,6 @@
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());
Deleted: trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/EmptyTestForHudson.java
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/EmptyTestForHudson.java 2012-08-06 13:13:23 UTC (rev 42861)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/EmptyTestForHudson.java 2012-08-06 13:16:35 UTC (rev 42862)
@@ -1,120 +0,0 @@
-package org.jboss.tools.central.test.ui.bot;
-
-import java.io.FileNotFoundException;
-
-import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-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.config.Annotations.Require;
-import org.jboss.tools.ui.bot.ext.config.Annotations.ServerType;
-import org.jboss.tools.ui.bot.ext.types.IDELabel;
-import org.jboss.tools.ui.bot.ext.wizards.SWTBotWizard;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-
- at Require
-public class EmptyTestForHudson extends SWTTestExt {
-
-
- @BeforeClass
- public static void setup() throws FileNotFoundException{
- util.closeAllEditors(false);
- util.closeAllViews();
- bot.menu("Window").menu("Preferences").click();
- bot.waitForShell("Preferences");
- bot.tree().getTreeItem("Maven").select();
- bot.checkBox("Download repository index updates on startup").deselect();
- bot.clickButton("OK");
- bot.menu("Help").menu(IDELabel.JBossCentralEditor.JBOSS_CENTRAL).click();
- util.waitForAll();
- }
-
- @Test
- public void testTest(){
- checkExample(null, IDELabel.JBossCentralEditor.RICHFACES_PROJECT, true);
- checkExample(null, IDELabel.JBossCentralEditor.SPRING_MVC_PROJECT, true);
- SWTFormsBotExt formsBot = SWTBotFactory.getFormsBot();
- formsBot.formTextWithText("Helloworld").click();
- bot.sleep(TIME_10S);
- }
-
-
-
- /**
- *
- * @param formsBot formBot==null => link is of type HyperLink else it is of type FormText
- * @param formText
- * @param readme true if readme should be shown
- */
-
- private void checkExample(SWTFormsBotExt formsBot, String formText, boolean readme){
- checkExample(formsBot, formText, readme, null);
- }
-
- /**
- * Checks example
- * @param formsBot bot for Forms
- * @param formText text to be clicked at
- * @param readme true if readme is supposed to show, false otherwise
- * @param readmeFileName
- */
-
- private void checkExample(SWTFormsBotExt formsBot, String formText, boolean readme, String readmeFileName){
- problems.show();
- if (formsBot==null){
- bot.hyperlink(formText).click();
- }else{
- try{
- formsBot.formTextWithText(formText).click();
- }catch(WidgetNotFoundException wnfex){
- throw new WidgetNotFoundException("Could not found widget of type Hyperlink and text " +
- formText, wnfex);
- }
- }
- bot.waitForShell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE);
- /*SWTBotWizard wizard = new SWTBotWizard(bot.shell(IDELabel.JBossCentralEditor.PROJECT_EXAMPLE).widget);
- wizard.next();
- if (wizard.canNext()){
- bot.comboBox(2).setSelection(1);
- try{
- bot.link();
- fail("There is something wrong with maven repo. Message: \n"+bot.link().getText());
- }catch (WidgetNotFoundException ex){
- //everything fine
- }
- wizard.next();
- }
- wizard.finishWithWait();
- 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 (readmeFileName != null){
- assertTrue(readmeText.toLowerCase().contains(readmeFileName));
- bot.clickButton("Finish");
- assertTrue("Cheat Sheets view should be opened right now", bot.activeView().getTitle().equals("Cheat Sheets"));
- bot.activeView().close();
- }else if (readmeText.contains("cheatsheet.xml")){
- bot.clickButton("Finish");
- assertTrue("Cheat Sheets view should be opened right now", bot.activeView().getTitle().equals("Cheat Sheets"));
- bot.activeView().close();
- }else if (readmeText.toLowerCase().contains("readme.md") || readmeText.toLowerCase().contains("readme.txt")){
- 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")); //because readmes are opening in browser now.. It's a bug. Jira is created.
- 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"));
- }
- }else{
- bot.clickButton("Finish");
- }*/
- bot.activeShell().close();
- }
-
-}
More information about the jbosstools-commits
mailing list