Author: rhopp
Date: 2012-01-31 05:55:53 -0500 (Tue, 31 Jan 2012)
New Revision: 38318
Added:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.classpath
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.resources/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.resources/.root/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.resources/.safetable/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.runtime/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.runtime/.settings/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.jdt.core/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.project
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.settings/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.settings/org.eclipse.jdt.core.prefs
trunk/central/tests/org.jboss.tools.central.test.ui.bot/META-INF/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/META-INF/MANIFEST.MF
trunk/central/tests/org.jboss.tools.central.test.ui.bot/build.properties
trunk/central/tests/org.jboss.tools.central.test.ui.bot/properties/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/properties/as7.swtbot.test.properties
trunk/central/tests/org.jboss.tools.central.test.ui.bot/screenshots/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/
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/CreateProjectsTest.java
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/SWTJBossCentralEditorExt.java
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/WithDataMatcher.java
Log:
Initial commit for centra bot tests
Added: trunk/central/tests/org.jboss.tools.central.test.ui.bot/.classpath
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/.classpath
(rev 0)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/.classpath 2012-01-31 10:55:53
UTC (rev 38318)
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="lib"
path="/home/rhopp/jbdevstudio/studio/plugins/org.eclipse.ui.forms_3.5.100.v20110425.jar"/>
+ <classpathentry kind="lib"
path="/home/rhopp/jbdevstudio/studio/plugins/org.eclipse.swtbot.forms.finder_2.0.5.20111003_1754-3676ac8-dev-e36.jar"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: trunk/central/tests/org.jboss.tools.central.test.ui.bot/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version
===================================================================
(Binary files differ)
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.resources/.root/.indexes/properties.version
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs
===================================================================
---
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs
(rev 0)
+++
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs 2012-01-31
10:55:53 UTC (rev 38318)
@@ -0,0 +1,3 @@
+#Wed Dec 07 09:51:58 CET 2011
+version=1
+eclipse.preferences.version=1
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.core.resources.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/central/tests/org.jboss.tools.central.test.ui.bot/.project
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/.project
(rev 0)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/.project 2012-01-31 10:55:53
UTC (rev 38318)
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.central.test.ui.bot</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>lib-org.jboss.tools.ui.bot.ext_3.2.0.v20111115-2301-Beta1</name>
+ <type>2</type>
+ <location>/home/rax/eclipse-pracovni/plugins/org.jboss.tools.ui.bot.ext_3.2.0.v20111115-2301-Beta1</location>
+ </link>
+ </linkedResources>
+</projectDescription>
Property changes on: trunk/central/tests/org.jboss.tools.central.test.ui.bot/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.settings/org.eclipse.jdt.core.prefs 2012-01-31
10:55:53 UTC (rev 38318)
@@ -0,0 +1,12 @@
+#Tue Dec 06 10:54:42 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/central/tests/org.jboss.tools.central.test.ui.bot/META-INF/MANIFEST.MF
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/META-INF/MANIFEST.MF
(rev 0)
+++
trunk/central/tests/org.jboss.tools.central.test.ui.bot/META-INF/MANIFEST.MF 2012-01-31
10:55:53 UTC (rev 38318)
@@ -0,0 +1,11 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.jboss.tools.central.test.ui.bot
+Bundle-SymbolicName: org.jboss.tools.central.test.ui.bot;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-ActivationPolicy: lazy
+Bundle-Vendor: Red Hat
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Require-Bundle: org.eclipse.swtbot.go,
+ org.jboss.tools.ui.bot.ext;bundle-version="3.2.0"
+Import-Package: org.jboss.tools.ui.bot.ext
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: trunk/central/tests/org.jboss.tools.central.test.ui.bot/build.properties
===================================================================
--- trunk/central/tests/org.jboss.tools.central.test.ui.bot/build.properties
(rev 0)
+++ trunk/central/tests/org.jboss.tools.central.test.ui.bot/build.properties 2012-01-31
10:55:53 UTC (rev 38318)
@@ -0,0 +1,4 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/properties/as7.swtbot.test.properties
===================================================================
---
trunk/central/tests/org.jboss.tools.central.test.ui.bot/properties/as7.swtbot.test.properties
(rev 0)
+++
trunk/central/tests/org.jboss.tools.central.test.ui.bot/properties/as7.swtbot.test.properties 2012-01-31
10:55:53 UTC (rev 38318)
@@ -0,0 +1 @@
+SERVER=AS,7.0,default,/home/rhopp/jboss-as-7.0.2.Final
\ No newline at end of file
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/properties/as7.swtbot.test.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
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
(rev 0)
+++
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/BaseFunctionalityTest.java 2012-01-31
10:55:53 UTC (rev 38318)
@@ -0,0 +1,122 @@
+package org.jboss.tools.central.test.ui.bot;
+
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+//(a)RunWith(SWTBotJunit4ClassRunner.class)
+(a)RunWith(RequirementAwareSuite.class)
+(a)SuiteClasses({CentralAllBotTests.class})
+public class BaseFunctionalityTest extends SWTTestExt {
+
+ /**
+ * Close usage report window
+ */
+ @BeforeClass
+ public static void setup(){
+ //jbt.closeReportUsageWindowIfOpened(false);
+ util.closeAllEditors(false);
+ util.closeAllViews();
+ }
+ /**
+ * Tests whether JBoss central is accessible from Help menu
+ */
+ @Test
+ public void testIsInstalled(){
+ try {
+ bot.menu("Help").menu(IDELabel.JBossCentralEditor.JBOSS_CENTRAL).click();
+ } catch (WidgetNotFoundException e) {
+ e.printStackTrace(System.out);
+ assertTrue("JBoss Cenral isn't in menu Help", false);
+ }
+ //JBoss Central should be visible right now
+ assertTrue("JBoss Central is not
active",bot.editorByTitle(IDELabel.JBossCentralEditor.JBOSS_CENTRAL).isActive());
+ bot.editorByTitle(IDELabel.JBossCentralEditor.JBOSS_CENTRAL).close();
+ try {
+ bot.toolbarButtonWithTooltip(IDELabel.JBossCentralEditor.JBOSS_CENTRAL).click();
+ }catch (WidgetNotFoundException e) {
+ assertTrue("JBoss Central isn't accessible through toolbar", false);
+ }
+ assertTrue("JBoss Central is not
active",bot.editorByTitle(IDELabel.JBossCentralEditor.JBOSS_CENTRAL).isActive());
+ }
+
+// @Test
+// public void testSearch(){
+// assertTrue("JBoss Central is not active",bot.editorByTitle("JBoss
Central").isActive());
+// //SWTBotEditor editor = bot.editorByTitle("JBoss Central");
+// SWTBotCTabItem cTabItem = bot.cTabItem("Software/Update");
+// cTabItem.activate();
+// util.waitForJobs("Discovering...");
+// //captureScreenshot("pokus.jpg");
+// //features available is ready
+// //bot.checkBox("Show installed").click();
+// SWTBotToolbarPushButton button = (SWTBotToolbarPushButton)
bot.toolbarButtonWithTooltip("JBoss Tools Home");
+// button.click();
+// SWTBotBrowser browser = new SWTBotExt().browser();
+// while (!browser.getUrl().equals("http://www.jboss.org/tools")){
+// }
+//
browser.setUrl("http://www.jboss.org/tools");
+// if (browser.isPageLoaded()){
+// log.info("Uz je pry nactena");
+// }
+// log.info(browser.getText());
+// bot.editorByTitle(bot.activeEditor().getTitle()).close();
+//
+//
+// /*Matcher matcher = allOf(widgetOfType(Button.class), withLabel("JBoss Maven CDI
Configurator."), withStyle(SWT.CHECK, "SWT.CHECK"));
+// //SWTBotCheckBox box = new SWTBotCheckBox((Button) bot.widgets(matcher, matcher);
+// List<Button> boxy = bot.widgets(matcher);
+// for (Button btn : boxy) {
+// SWTBotCheckBox box = new SWTBotCheckBox(btn);
+// box.click();
+// }*/
+// /*asyncExec(new VoidResult() {
+//
+// @Override
+// public void run() {
+// for (Control but : bot.checkBox(5).widget.getParent().getChildren()){
+// log.info(but.getClass());
+// if (but instanceof Button){
+// log.info(but.getData("connectorId"));
+// }
+// if (but instanceof Label){
+// Label lab = (Label) but;
+// log.info(lab.toString());
+// }
+// }
+// }
+// });*/
+// //bot.checkBox(1).select();
+// //bot.checkBox(5).toString();
+// /*button = (SWTBotToolbarPushButton)
bot.toolbarButtonWithTooltip("Install");
+// button.click();
+// log.info("Kliknul jsem na "+button.toString());
+// //bot.sleep(80000);
+// bot.waitUntil(Conditions.shellIsActive("Install"), 80000);
+// log.info("Cil by mel byt otevreny Install");*/
+// //bot.shell("Install").close();
+// /*SWTBotCheckBox box = bot.checkBoxWithLabel("JBoss Maven CDI
Configurator.");
+// log.info(box.toString());
+// box.select();*/
+// //log.info(box.widget.getData("connectorId"));
+// //browser.refresh();
+// /*while (!browser.isPageLoaded()){
+// bot.sleep(TIME_500MS);
+// }*/
+// //log.info(browser.getText());
+// /*log.info(bot.activeEditor().getTitle());
+// assertTrue("The main page wasn't opened",bot.activeEditor().getTitle()
== "JBoss Tools | Overview - JBoss Community");
+// bot.editorByTitle("JBoss Tools | Overview - JBoss Community").close();*/
+// bot.sleep(TIME_5S);
+// /*bot.sleep(TIME_5S);
+// bot.sleep(TIME_5S);
+// bot.sleep(TIME_5S);
+// bot.sleep(TIME_5S);
+// bot.sleep(TIME_5S);*/
+// }
+}
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/BaseFunctionalityTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
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
(rev 0)
+++
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CentralAllBotTests.java 2012-01-31
10:55:53 UTC (rev 38318)
@@ -0,0 +1,14 @@
+package org.jboss.tools.central.test.ui.bot;
+
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({
+ //BaseFunctionalityTest.class,
+ CreateProjectsTest.class
+ })
+public class CentralAllBotTests {
+
+}
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CentralAllBotTests.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
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
(rev 0)
+++
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsTest.java 2012-01-31
10:55:53 UTC (rev 38318)
@@ -0,0 +1,210 @@
+package org.jboss.tools.central.test.ui.bot;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+
+import java.awt.Button;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.waits.Conditions;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotButton;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotToolbarDropDownButton;
+import org.eclipse.ui.forms.widgets.Twistie;
+import org.hamcrest.core.IsAnything;
+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.config.ConfiguredState.Server;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.Perspective.JBOSSAS;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.Server.JBossCommunityJBossAS71;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+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.types.JobState;
+import org.jboss.tools.ui.bot.ext.widgets.SWTBotSection;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import com.sun.org.apache.xml.internal.serializer.utils.Utils;
+
+//@Require(server=(a)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";
+
+ @BeforeClass
+ public static void setup(){
+ log.info(configuredState.getServer().name);
+ 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(){
+ //waitForAWhile();
+ 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);
+ 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");
+ }
+
+ //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.waitForAll(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();
+ 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
+ }
+ 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.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);
+ bot.toolbarDropDownButtonWithTooltip("New").click();
+ bot.waitForShell("New");
+ assertTrue("Shell \"New\" should have appeared",
bot.shell("New").isActive());
+ bot.activeShell().close();
+ }
+
+ @Test
+ public void projectExamplesSectionTest(){
+ //SWTBotSection section = bot.section("Project Examples");
+ SWTBotTwistie twistieBot = bot.twistieByLabel("JBoss Quickstarts");
+ if (!twistieBot.isExpanded()){
+ twistieBot.toggle();
+ }
+ SWTFormsBotExt formsBot = SWTBotFactory.getFormsBot();
+ formsBot.formTextWithText("Helloworld").click();
+ bot.clickButton("Start");
+ waitForAllMultipleTimes(3);
+ formsBot.formTextWithText("Numberguess").click();
+ bot.clickButton("Start");
+ waitForAllMultipleTimes(3);
+ log.info(bot.activeEditor().getTitle());
+ formsBot.formTextWithText("Login").click();
+ bot.clickButton("Start");
+ waitForAllMultipleTimes(3);
+ formsBot.formTextWithText("Kitchensink").click();
+ bot.clickButton("Start");
+ waitForAllMultipleTimes(3);
+ }
+
+ /**
+ * calls method waitForAll x times
+ * @param value how many times waitForAll should be called
+ */
+ private void waitForAllMultipleTimes(int value){
+ for (int i=0; i<value; i++){
+ util.waitForAll();
+ }
+ }
+
+ 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();
+ for(int i=0; i<files.length; i++) {
+ if(files[i].isDirectory()) {
+ deleteDirectory(files[i]);
+ }
+ else {
+ files[i].delete();
+ }
+ }
+ }
+ return( path.delete() );
+ }
+
+ private void checkCreateProject(SWTFormsBotExt formsBot, String formText, String
wizzardShellText){
+ 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());
+ bot.activeShell().close();
+ }
+}
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/CreateProjectsTest.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/SWTJBossCentralEditorExt.java
===================================================================
---
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/SWTJBossCentralEditorExt.java
(rev 0)
+++
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/SWTJBossCentralEditorExt.java 2012-01-31
10:55:53 UTC (rev 38318)
@@ -0,0 +1,28 @@
+package org.jboss.tools.central.test.ui.bot.helper;
+
+import static org.eclipse.swtbot.swt.finder.matchers.WidgetMatcherFactory.widgetOfType;
+
+import java.util.List;
+
+import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.ui.IEditorReference;
+import org.jboss.tools.ui.bot.ext.parts.SWTBotEditorExt;
+
+public class SWTJBossCentralEditorExt extends SWTBotEditorExt{
+
+ public SWTJBossCentralEditorExt(IEditorReference editorReference,
+ SWTWorkbenchBot bot) throws WidgetNotFoundException {
+ super(editorReference, bot);
+ }
+
+ public String getPages(){
+ List<? extends CTabFolder> pokus =
this.findWidgets(widgetOfType(CTabFolder.class));
+ for (CTabFolder cTabFolder : pokus) {
+ return Integer.toString(cTabFolder.getItemCount());
+ }
+ return "konec";
+ }
+
+}
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/SWTJBossCentralEditorExt.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
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
(rev 0)
+++
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/WithDataMatcher.java 2012-01-31
10:55:53 UTC (rev 38318)
@@ -0,0 +1,25 @@
+package org.jboss.tools.central.test.ui.bot.helper;
+
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.swtbot.swt.finder.matchers.AbstractMatcher;
+import org.hamcrest.Description;
+
+public class WithDataMatcher<T extends Widget> extends AbstractMatcher<T> {
+
+ /*public WithDataMatcher(String key, String value, ) {
+
+ }*/
+
+ //@Override
+ public void describeTo(Description description) {
+ description.appendText("testDescription");
+
+ }
+
+ @Override
+ protected boolean doMatch(Object item) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+}
Property changes on:
trunk/central/tests/org.jboss.tools.central.test.ui.bot/src/org/jboss/tools/central/test/ui/bot/helper/WithDataMatcher.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain