Author: sdzmitrovich
Date: 2009-06-29 02:48:06 -0400 (Mon, 29 Jun 2009)
New Revision: 16238
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/
workspace/yzhishko/org.jboss.tools.ui.auto.test/.classpath
workspace/yzhishko/org.jboss.tools.ui.auto.test/.project
workspace/yzhishko/org.jboss.tools.ui.auto.test/.settings/
workspace/yzhishko/org.jboss.tools.ui.auto.test/.settings/org.eclipse.jdt.core.prefs
workspace/yzhishko/org.jboss.tools.ui.auto.test/META-INF/
workspace/yzhishko/org.jboss.tools.ui.auto.test/META-INF/MANIFEST.MF
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/SWTBot.properties
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/log4j.xml
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/Activator.class
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/JBTSWTBotTestCase.class
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/SWTBotMultiPageEditor.class
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/SWTJBTBot.class
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/WidgetVariables.class
workspace/yzhishko/org.jboss.tools.ui.auto.test/build.properties
workspace/yzhishko/org.jboss.tools.ui.auto.test/resources/
workspace/yzhishko/org.jboss.tools.ui.auto.test/resources/SWTBot.properties
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/log4j.xml
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/Activator.java
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/JBTSWTBotTestCase.java
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/SWTBotMultiPageEditor.java
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/SWTJBTBot.java
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/WidgetVariables.java
Log:
Base Test Case and settings for SWTBot auto tests
Added: workspace/yzhishko/org.jboss.tools.ui.auto.test/.classpath
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.auto.test/.classpath
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.auto.test/.classpath 2009-06-29 06:48:06 UTC
(rev 16238)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="src" path="resources"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Added: workspace/yzhishko/org.jboss.tools.ui.auto.test/.project
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.auto.test/.project (rev
0)
+++ workspace/yzhishko/org.jboss.tools.ui.auto.test/.project 2009-06-29 06:48:06 UTC (rev
16238)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.ui.auto.test</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>
+</projectDescription>
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.auto.test/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.auto.test/.settings/org.eclipse.jdt.core.prefs 2009-06-29
06:48:06 UTC (rev 16238)
@@ -0,0 +1,8 @@
+#Tue Jun 16 17:54:08 EEST 2009
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
Added: workspace/yzhishko/org.jboss.tools.ui.auto.test/META-INF/MANIFEST.MF
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.auto.test/META-INF/MANIFEST.MF
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.auto.test/META-INF/MANIFEST.MF 2009-06-29
06:48:06 UTC (rev 16238)
@@ -0,0 +1,24 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Test
+Bundle-SymbolicName: org.jboss.tools.ui.auto.test;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.ui.auto.test.Activator
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.swtbot.eclipse.core;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.finder;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.spy;bundle-version="2.0.0",
+ org.eclipse.swtbot.eclipse.ui;bundle-version="2.0.0",
+ org.eclipse.swtbot.junit4_x;bundle-version="2.0.0",
+ org.eclipse.swtbot.swt.finder;bundle-version="2.0.0",
+ org.junit4;bundle-version="4.5.0",
+ org.apache.log4j;bundle-version="1.2.13",
+ org.hamcrest;bundle-version="1.1.0",
+ org.jboss.tools.jst.jsp;bundle-version="2.0.0",
+ org.jboss.tools.common.text.ext;bundle-version="2.0.0",
+ org.jboss.tools.jst.web;bundle-version="2.0.0",
+ org.eclipse.ui,
+ org.eclipse.ui.ide;bundle-version="3.5.0"
+Bundle-ActivationPolicy: lazy
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.jboss.tools.ui.auto.test
Added: workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/SWTBot.properties
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/SWTBot.properties
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/SWTBot.properties 2009-06-29
06:48:06 UTC (rev 16238)
@@ -0,0 +1,2 @@
+SWTBotPreferences.PLAYBACK_DELAY=25
+SWTBotPreferences.TIMEOUT=1000
Added: workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/log4j.xml
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/log4j.xml
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/log4j.xml 2009-06-29 06:48:06 UTC
(rev 16238)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/"
+ debug="false">
+
+ <appender name="consoleAppender"
class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{dd MMM yyyy HH:mm:ss.SSS} - %25t - %-5p - %30c{1} - (%C{1}.java:%L) -
%m%n" />
+ </layout>
+ </appender>
+
+ <appender name="fileAppender"
class="org.apache.log4j.FileAppender">
+ <param name="File" value="/tmp/debug.log" />
+ <param name="Append" value="false" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{dd MMM yyyy HH:mm:ss.SSS} - %25t - %-5p - %30c{1} - (%C{1}.java:%L) -
%m%n" />
+ </layout>
+ </appender>
+
+ <appender name="asyncAppender"
class="org.apache.log4j.AsyncAppender">
+ <!-- appender-ref ref="consoleAppender" / -->
+ <appender-ref ref="fileAppender" />
+ </appender>
+
+ <!-- don't log matchers, this is very high amount of chatter -->
+ <category name="org.eclipse.swtbot.swt.finder.matchers">
+ <priority value="OFF" />
+ </category>
+
+ <!--
+ don't log widget notification events, this is moderately high chatter
+ -->
+ <category name="org.eclipse.swtbot.swt.finder.widgets">
+ <priority value="OFF" />
+ </category>
+
+ <!-- don't log finders, this is moderate chatter -->
+ <category name="org.eclipse.swtbot.swt.finder.finders">
+ <priority value="DEBUG" />
+ </category>
+
+ <category name="org.eclipse.swtbot.swt.finder.keyboard">
+ <!-- set to a value higher than debug to turn on. -->
+ <priority value="DEBUG" />
+ </category>
+
+ <category name="org.eclipse.swtbot">
+ <priority value="ALL" />
+ </category>
+
+ <root>
+ <priority value="INFO" />
+ <appender-ref ref="consoleAppender" />
+ <appender-ref ref="fileAppender" />
+ </root>
+
+</log4j:configuration>
\ No newline at end of file
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/Activator.class
===================================================================
(Binary files differ)
Property changes on:
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/Activator.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/JBTSWTBotTestCase.class
===================================================================
(Binary files differ)
Property changes on:
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/JBTSWTBotTestCase.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/SWTBotMultiPageEditor.class
===================================================================
(Binary files differ)
Property changes on:
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/SWTBotMultiPageEditor.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/SWTJBTBot.class
===================================================================
(Binary files differ)
Property changes on:
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/SWTJBTBot.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/WidgetVariables.class
===================================================================
(Binary files differ)
Property changes on:
workspace/yzhishko/org.jboss.tools.ui.auto.test/bin/org/jboss/tools/ui/auto/test/WidgetVariables.class
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: workspace/yzhishko/org.jboss.tools.ui.auto.test/build.properties
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.auto.test/build.properties
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.auto.test/build.properties 2009-06-29 06:48:06
UTC (rev 16238)
@@ -0,0 +1,5 @@
+source.. = src/,resources/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+
\ No newline at end of file
Added: workspace/yzhishko/org.jboss.tools.ui.auto.test/resources/SWTBot.properties
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.auto.test/resources/SWTBot.properties
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.auto.test/resources/SWTBot.properties 2009-06-29
06:48:06 UTC (rev 16238)
@@ -0,0 +1,2 @@
+SWTBotPreferences.PLAYBACK_DELAY=25
+SWTBotPreferences.TIMEOUT=1000
Added: workspace/yzhishko/org.jboss.tools.ui.auto.test/src/log4j.xml
===================================================================
--- workspace/yzhishko/org.jboss.tools.ui.auto.test/src/log4j.xml
(rev 0)
+++ workspace/yzhishko/org.jboss.tools.ui.auto.test/src/log4j.xml 2009-06-29 06:48:06 UTC
(rev 16238)
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/"
+ debug="false">
+
+ <appender name="consoleAppender"
class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{dd MMM yyyy HH:mm:ss.SSS} - %25t - %-5p - %30c{1} - (%C{1}.java:%L) -
%m%n" />
+ </layout>
+ </appender>
+
+ <appender name="fileAppender"
class="org.apache.log4j.FileAppender">
+ <param name="File" value="/tmp/debug.log" />
+ <param name="Append" value="false" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern"
+ value="%d{dd MMM yyyy HH:mm:ss.SSS} - %25t - %-5p - %30c{1} - (%C{1}.java:%L) -
%m%n" />
+ </layout>
+ </appender>
+
+ <appender name="asyncAppender"
class="org.apache.log4j.AsyncAppender">
+ <!-- appender-ref ref="consoleAppender" / -->
+ <appender-ref ref="fileAppender" />
+ </appender>
+
+ <!-- don't log matchers, this is very high amount of chatter -->
+ <category name="org.eclipse.swtbot.swt.finder.matchers">
+ <priority value="OFF" />
+ </category>
+
+ <!--
+ don't log widget notification events, this is moderately high chatter
+ -->
+ <category name="org.eclipse.swtbot.swt.finder.widgets">
+ <priority value="OFF" />
+ </category>
+
+ <!-- don't log finders, this is moderate chatter -->
+ <category name="org.eclipse.swtbot.swt.finder.finders">
+ <priority value="DEBUG" />
+ </category>
+
+ <category name="org.eclipse.swtbot.swt.finder.keyboard">
+ <!-- set to a value higher than debug to turn on. -->
+ <priority value="DEBUG" />
+ </category>
+
+ <category name="org.eclipse.swtbot">
+ <priority value="ALL" />
+ </category>
+
+ <root>
+ <priority value="INFO" />
+ <appender-ref ref="consoleAppender" />
+ <appender-ref ref="fileAppender" />
+ </root>
+
+</log4j:configuration>
\ No newline at end of file
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/Activator.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/Activator.java
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/Activator.java 2009-06-29
06:48:06 UTC (rev 16238)
@@ -0,0 +1,55 @@
+package org.jboss.tools.ui.auto.test;
+
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.ui.auto.test";
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ public static ILog getPluginLog() {
+ return plugin.getLog();
+ }
+
+}
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/JBTSWTBotTestCase.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/JBTSWTBotTestCase.java
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/JBTSWTBotTestCase.java 2009-06-29
06:48:06 UTC (rev 16238)
@@ -0,0 +1,143 @@
+package org.jboss.tools.ui.auto.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.swtbot.swt.finder.SWTBotTestCase;
+import org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundException;
+import org.eclipse.swtbot.swt.finder.utils.SWTBotPreferences;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+
+public abstract class JBTSWTBotTestCase extends SWTBotTestCase implements
+ ILogListener {
+
+ private Throwable exception;
+ public static final String swtBotProperties = "SWTBot.properties";
+ private static Properties SWT_BOT_PROPERTIES;
+ protected SWTJBTBot bot = new SWTJBTBot();
+
+ static {
+ try {
+ InputStream swtPreferenceIS =
Platform.getBundle(Activator.PLUGIN_ID).getResource(swtBotProperties)
+ .openStream();
+ SWT_BOT_PROPERTIES = new Properties();
+ SWT_BOT_PROPERTIES.load(swtPreferenceIS);
+ SWTBotPreferences.PLAYBACK_DELAY = Long
+ .parseLong(SWT_BOT_PROPERTIES
+ .getProperty("SWTBotPreferences.PLAYBACK_DELAY"));
+ SWTBotPreferences.TIMEOUT = Long.parseLong(SWT_BOT_PROPERTIES
+ .getProperty("SWTBotPreferences.TIMEOUT"));
+ swtPreferenceIS.close();
+ } catch (IOException e) {
+ fail("Can't load properties from " + swtBotProperties + "
file");
+ } catch (IllegalStateException e) {
+ fail("Property file " + swtBotProperties + " was not found");
+ }
+ }
+
+ public void logging(IStatus status, String plugin) {
+ switch (status.getSeverity()) {
+ case IStatus.ERROR:
+ Throwable throwable = status.getException();
+ if (throwable == null) {
+ throwable = new Throwable(status.getMessage() + " in "
+ + status.getPlugin());
+ }
+ setException(throwable);
+ break;
+ default:
+ break;
+ }
+ }
+
+ protected Throwable getException() {
+ return exception;
+ }
+
+ protected void setException(Throwable e) {
+ this.exception = e;
+ }
+
+ private void deleteLog() {
+ try {
+ Platform.getLogFileLocation().toFile().delete();
+ } catch (Exception e) {
+ }
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ activePerspective();
+ deleteLog();
+ setException(null);
+ Platform.addLogListener(this);
+ try {
+ bot.viewByTitle(WidgetVariables.WELCOME).close();
+ } catch (WidgetNotFoundException e) {
+ }
+ openErrorLog();
+ openPackageExplorer();
+ openProgressStatus();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ if (getException() != null) {
+ throw new Exception(getException());
+ }
+ Platform.removeLogListener(this);
+ deleteLog();
+ }
+
+ protected void delay() {
+ bot.sleep(1000);
+ }
+
+ protected void longDelay() {
+ bot.sleep(10000);
+ }
+
+ abstract protected void activePerspective ();
+
+ protected void openErrorLog() {
+ try {
+ bot.viewByTitle(WidgetVariables.ERROR_LOG);
+ } catch (WidgetNotFoundException e) {
+ bot.menu("Window").menu("Show
View").menu("Other...").click();
+ SWTBotTree viewTree = bot.tree();
+ delay();
+ viewTree.expandNode("General")
+ .expandNode(WidgetVariables.ERROR_LOG).select();
+ bot.button("OK").click();
+ }
+ }
+
+ protected void openPackageExplorer() {
+ try {
+ bot.viewByTitle(WidgetVariables.PACKAGE_EXPLORER);
+ } catch (WidgetNotFoundException e) {
+ bot.menu("Window").menu("Show
View").menu("Other...").click();
+ SWTBotTree viewTree = bot.tree();
+ delay();
+ viewTree.expandNode("Java").expandNode(
+ WidgetVariables.PACKAGE_EXPLORER).select();
+ bot.button("OK").click();
+ }
+ }
+
+ protected void openProgressStatus() {
+ try {
+ bot.viewByTitle(WidgetVariables.PROGRESS_STATUS);
+ } catch (WidgetNotFoundException e) {
+ bot.menu("Window").menu("Show
View").menu("Other...").click();
+ SWTBotTree viewTree = bot.tree();
+ delay();
+ viewTree.expandNode("General").expandNode(WidgetVariables.PROGRESS_STATUS).select();
+ bot.button("OK").click();
+ }
+ }
+
+}
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/SWTBotMultiPageEditor.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/SWTBotMultiPageEditor.java
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/SWTBotMultiPageEditor.java 2009-06-29
06:48:06 UTC (rev 16238)
@@ -0,0 +1,28 @@
+package org.jboss.tools.ui.auto.test;
+
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.ui.IEditorReference;
+import org.hamcrest.SelfDescribing;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
+
+public class SWTBotMultiPageEditor extends SWTBotEditor{
+
+ public SWTBotMultiPageEditor(IEditorReference editorReference,
+ SWTWorkbenchBot bot, SelfDescribing description) {
+ super(editorReference, bot, description);
+ }
+
+ public SWTBotMultiPageEditor(IEditorReference editorReference,
+ SWTWorkbenchBot bot) {
+ super(editorReference, bot);
+ }
+
+ public JSPMultiPageEditor getJSPMultiPageEditor(){
+ if (partReference.getPart(true) instanceof JSPMultiPageEditor) {
+ return (JSPMultiPageEditor)partReference.getPart(true);
+ }
+ return null;
+ }
+
+}
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/SWTJBTBot.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/SWTJBTBot.java
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/SWTJBTBot.java 2009-06-29
06:48:06 UTC (rev 16238)
@@ -0,0 +1,26 @@
+package org.jboss.tools.ui.auto.test;
+
+import static
org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory.withPartId;
+import static
org.eclipse.swtbot.eclipse.finder.matchers.WidgetMatcherFactory.withPartName;
+import static org.eclipse.swtbot.eclipse.finder.waits.Conditions.waitForEditor;
+import org.eclipse.swtbot.eclipse.finder.SWTWorkbenchBot;
+import org.eclipse.swtbot.eclipse.finder.waits.WaitForEditor;
+import org.hamcrest.Matcher;
+
+public class SWTJBTBot extends SWTWorkbenchBot{
+
+ public SWTBotMultiPageEditor multiPageEditor(Matcher<?> matcher) {
+ WaitForEditor waitForEditor = waitForEditor(matcher);
+ waitUntilWidgetAppears(waitForEditor);
+ return new SWTBotMultiPageEditor(waitForEditor.get(0), this);
+ }
+
+ public SWTBotMultiPageEditor multiPageEditorByTitle (String fileName) {
+ return multiPageEditor(withPartName(fileName));
+ }
+
+ public SWTBotMultiPageEditor multiPageEditorById(String id){
+ return multiPageEditor(withPartId(id));
+ }
+
+}
Added:
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/WidgetVariables.java
===================================================================
---
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/WidgetVariables.java
(rev 0)
+++
workspace/yzhishko/org.jboss.tools.ui.auto.test/src/org/jboss/tools/ui/auto/test/WidgetVariables.java 2009-06-29
06:48:06 UTC (rev 16238)
@@ -0,0 +1,10 @@
+package org.jboss.tools.ui.auto.test;
+
+public class WidgetVariables {
+
+ public static final String ERROR_LOG = "Error Log";
+ public static final String PACKAGE_EXPLORER = "Package Explorer";
+ public static final String WELCOME = "Welcome";
+ public static final String PROGRESS_STATUS = "Progress";
+
+}