Author: nbelaevski
Date: 2009-01-05 11:19:55 -0500 (Mon, 05 Jan 2009)
New Revision: 12106
Added:
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/resources/regressionArea-ds.xml
trunk/test-applications/regressionArea/regressionArea-tests/
trunk/test-applications/regressionArea/regressionArea-tests/pom.xml
trunk/test-applications/regressionArea/regressionArea-tests/src/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/RichSeleniumTest.java
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/SeleniumTestBase.java
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/TestAnnotationTransformer.java
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/SimpleTest.java
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf4507/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf4507/Test.java
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf4709/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf4709/Test.java
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5264/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5264/Test.java
trunk/test-applications/regressionArea/regressionArea-tests/src/test/resources/
trunk/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml
Removed:
trunk/test-applications/regressionArea/regressionArea-ear/resources/
trunk/test-applications/regressionArea/regressionArea-ear/src/main/resources/seam-ds.xml
Modified:
trunk/test-applications/regressionArea/pom.xml
trunk/test-applications/regressionArea/regressionArea-ear/pom.xml
trunk/test-applications/regressionArea/regressionArea-ejb/pom.xml
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/resources/META-INF/MANIFEST.MF
trunk/test-applications/regressionArea/regressionArea-web/pom.xml
Log:
Refactor of regressionArea application
Modified: trunk/test-applications/regressionArea/pom.xml
===================================================================
--- trunk/test-applications/regressionArea/pom.xml 2009-01-05 16:19:31 UTC (rev 12105)
+++ trunk/test-applications/regressionArea/pom.xml 2009-01-05 16:19:55 UTC (rev 12106)
@@ -1,124 +1,125 @@
-<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <!--parent>
- <groupId>org.richfaces</groupId>
- <artifactId>samples</artifactId>
- <version>3.3.0-SNAPSHOT</version>
- </parent-->
- <groupId>org.richfaces.test-applications</groupId>
- <artifactId>regressionArea</artifactId>
- <packaging>pom</packaging>
- <version>3.3.0-SNAPSHOT</version>
- <name>Regresion Area:Seam Application</name>
- <repositories>
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- <updatePolicy>never</updatePolicy>
- </snapshots>
- <id>maven-repository.dev.java.net</id>
- <
name>Java.net Repository for Maven</name>
- <
url>http://download.java.net/maven/1</url>
- <layout>legacy</layout>
- </repository>
-
- <repository>
- <releases />
- <snapshots>
- <enabled>false</enabled>
- <updatePolicy>never</updatePolicy>
- </snapshots>
- <id>repository.jboss.org</id>
- <
url>http://repository.jboss.org/maven2</url>
- </repository>
- <repository>
- <id>openqa</id>
- <name>OpenQA Repository</name>
- <
url>http://archiva.openqa.org/repository/releases</url>
- <layout>default</layout>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- <releases>
- <enabled>true</enabled>
- </releases>
- </repository>
- <repository>
- <id>openqa-snapshots</id>
- <name>OpenQA Snapshots Repository</name>
- <
url>http://archiva.openqa.org/repository/snapshots</url>
- <layout>default</layout>
- <snapshots>
- <enabled>true</enabled>
- </snapshots>
- <releases>
- <enabled>false</enabled>
- </releases>
- </repository>
- </repositories>
-
- <properties>
- <contextroot>regressionArea</contextroot>
- <earname>regressionArea-ear</earname>
- <richversion>3.3.0-SNAPSHOT</richversion>
- <seamversion>2.1.0.SP1</seamversion>
- <jsfversion>1.2_10</jsfversion>
- <jbosshome>C:/tmp/jboss-4.2.3.GA</jbosshome>
- <jbosscontext>default</jbosscontext>
- </properties>
-
-
-
- <modules>
- <module>regressionArea-ejb</module>
- <module>regressionArea-web</module>
- <module>regressionArea-ear</module>
- </modules>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-eclipse-plugin</artifactId>
- <version>2.5</version>
- <configuration>
- <wtpmanifest>true</wtpmanifest>
- <wtpapplicationxml>true</wtpapplicationxml>
- <wtpversion>2.0</wtpversion>
- <manifest>
- ${basedir}/src/main/resources/META-INF/MANIFEST.MF
- </manifest>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <version>2.4</version>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </configuration>
- </plugin>
-
-
- </plugins>
- </build>
-<!--pluginRepositories>
- <pluginRepository>
- <id>people.apache.org</id>
- <
url>http://people.apache.org/repo/m2-snapshot-repository/</url>
- </pluginRepository>
- <pluginRepository>
- <id>repository-int.exadel.com</id>
- <
url>http://repository-int.exadel.com/</url>
- </pluginRepository>
- </pluginRepositories-->
-
+<?xml version="1.0" encoding="UTF-8"?>
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <!--parent>
+ <groupId>org.richfaces</groupId>
+ <artifactId>samples</artifactId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent-->
+ <groupId>org.richfaces.test-applications</groupId>
+ <artifactId>regressionArea</artifactId>
+ <packaging>pom</packaging>
+ <version>3.3.0-SNAPSHOT</version>
+ <name>Regresion Area:Seam Application</name>
+ <repositories>
+ <repository>
+ <releases/>
+ <snapshots>
+ <enabled>false</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <id>maven-repository.dev.java.net</id>
+ <
name>Java.net Repository for Maven</name>
+ <
url>http://download.java.net/maven/1</url>
+ <layout>legacy</layout>
+ </repository>
+
+ <repository>
+ <releases/>
+ <snapshots>
+ <enabled>false</enabled>
+ <updatePolicy>never</updatePolicy>
+ </snapshots>
+ <id>repository.jboss.org</id>
+ <
url>http://repository.jboss.org/maven2</url>
+ </repository>
+ <repository>
+ <id>openqa</id>
+ <name>OpenQA Repository</name>
+ <
url>http://archiva.openqa.org/repository/releases</url>
+ <layout>default</layout>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ <releases>
+ <enabled>true</enabled>
+ </releases>
+ </repository>
+ <repository>
+ <id>openqa-snapshots</id>
+ <name>OpenQA Snapshots Repository</name>
+ <
url>http://archiva.openqa.org/repository/snapshots</url>
+ <layout>default</layout>
+ <snapshots>
+ <enabled>true</enabled>
+ </snapshots>
+ <releases>
+ <enabled>false</enabled>
+ </releases>
+ </repository>
+ </repositories>
+
+ <properties>
+ <contextroot>regressionArea</contextroot>
+ <earname>regressionArea-ear</earname>
+ <richversion>3.3.0-SNAPSHOT</richversion>
+ <seamversion>2.1.0.SP1</seamversion>
+ <jsfversion>1.2_10</jsfversion>
+ <jbosshome>C:/tmp/jboss-4.2.3.GA</jbosshome>
+ <jbosscontext>default</jbosscontext>
+ </properties>
+
+
+
+ <modules>
+ <module>regressionArea-ejb</module>
+ <module>regressionArea-web</module>
+ <module>regressionArea-ear</module>
+ <module>regressionArea-tests</module>
+ </modules>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-eclipse-plugin</artifactId>
+ <version>2.5</version>
+ <configuration>
+ <wtpmanifest>true</wtpmanifest>
+ <wtpapplicationxml>true</wtpapplicationxml>
+ <wtpversion>2.0</wtpversion>
+ <manifest>
+ ${basedir}/src/main/resources/META-INF/MANIFEST.MF
+ </manifest>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </configuration>
+ </plugin>
+
+
+ </plugins>
+ </build>
+<!--pluginRepositories>
+ <pluginRepository>
+ <id>people.apache.org</id>
+ <
url>http://people.apache.org/repo/m2-snapshot-repository/</url>
+ </pluginRepository>
+ <pluginRepository>
+ <id>repository-int.exadel.com</id>
+ <
url>http://repository-int.exadel.com/</url>
+ </pluginRepository>
+ </pluginRepositories-->
+
</project>
\ No newline at end of file
Modified: trunk/test-applications/regressionArea/regressionArea-ear/pom.xml
===================================================================
--- trunk/test-applications/regressionArea/regressionArea-ear/pom.xml 2009-01-05 16:19:31
UTC (rev 12105)
+++ trunk/test-applications/regressionArea/regressionArea-ear/pom.xml 2009-01-05 16:19:55
UTC (rev 12106)
@@ -140,6 +140,65 @@
</modules>
</configuration>
</plugin>
- </plugins>
- </build>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <version>1.0-beta-2</version>
+ <executions>
+ <execution>
+ <id>start-container</id>
+ <phase>pre-integration-test</phase>
+ <goals>
+ <goal>deploy</goal>
+ <goal>start</goal>
+ </goals>
+ </execution>
+ <execution>
+ <id>stop-container</id>
+ <phase>post-integration-test</phase>
+ <goals>
+ <goal>stop</goal>
+ <goal>undeploy</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <wait>false</wait>
+ <container>
+ <containerId>jboss4x</containerId>
+ <append>false</append>
+
+ <zipUrlInstaller>
+ <url>file:Y:\Distribs\jboss-4.2.3.GA.zip</url>
+ <installDir>
+ ${project.basedir}/target/installs
+ </installDir>
+ </zipUrlInstaller>
+ </container>
+ <configuration>
+ <home>${jbosshome}/server/${jbosscontext}</home>
+ <type>existing</type>
+ <properties>
+ <cargo.hostname>localhost</cargo.hostname>
+
<cargo.jboss.configuration>${jbosscontext}</cargo.jboss.configuration>
+ <cargo.rmi.port>1099</cargo.rmi.port>
+ </properties>
+ </configuration>
+ <deployer>
+ <type>installed</type>
+ <deployables>
+ <deployable>
+ <artifactId>regressionArea-ear</artifactId>
+ <type>ear</type>
+ </deployable>
+ </deployables>
+ </deployer>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <properties>
+ <jbosshome>${project.basedir}/target/installs/jboss-4.2.3.GA/jboss-4.2.3.GA</jbosshome>
+ </properties>
</project>
Deleted:
trunk/test-applications/regressionArea/regressionArea-ear/src/main/resources/seam-ds.xml
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-ear/src/main/resources/seam-ds.xml 2009-01-05
16:19:31 UTC (rev 12105)
+++
trunk/test-applications/regressionArea/regressionArea-ear/src/main/resources/seam-ds.xml 2009-01-05
16:19:55 UTC (rev 12106)
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!DOCTYPE datasources
- PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
- "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
-
-<datasources>
-
- <local-tx-datasource>
- <jndi-name>seamDatasource</jndi-name>
- <connection-url>jdbc:hsqldb:.</connection-url>
- <driver-class>org.hsqldb.jdbcDriver</driver-class>
- <user-name>sa</user-name>
- <password></password>
- </local-tx-datasource>
-
-</datasources>
-
Modified: trunk/test-applications/regressionArea/regressionArea-ejb/pom.xml
===================================================================
--- trunk/test-applications/regressionArea/regressionArea-ejb/pom.xml 2009-01-05 16:19:31
UTC (rev 12105)
+++ trunk/test-applications/regressionArea/regressionArea-ejb/pom.xml 2009-01-05 16:19:55
UTC (rev 12106)
@@ -174,8 +174,6 @@
<target>1.5</target>
</configuration>
</plugin>
-
-
</plugins>
</build>
Modified:
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/resources/META-INF/MANIFEST.MF
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/resources/META-INF/MANIFEST.MF 2009-01-05
16:19:31 UTC (rev 12105)
+++
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/resources/META-INF/MANIFEST.MF 2009-01-05
16:19:55 UTC (rev 12106)
@@ -1,10 +1,10 @@
Manifest-Version: 1.0
Class-Path: bsh-1.3.0.jar commons-beanutils-1.7.0.jar commons-collecti
ons-3.2.jar commons-digester-1.8.jar commons-lang-2.3.jar commons-log
- ging-1.0.4.jar dom4j-1.6.1-jboss.jar el-api-1.0.jar javassist-3.3.GA.
- jar jboss-el-2.0.1.GA.jar jboss-seam-2.0.2.SP1.jar jboss-seam-debug-2
- .0.2.SP1.jar jboss-seam-remoting-2.0.2.SP1.jar jboss-seam-ui-2.0.2.SP
- 1.jar jsf-api-1.2_09.jar jsf-facelets-1.1.14.jar jsf-impl-1.2_09.jar
- log4j-1.2.14.jar richfaces-api-3.3.0-SNAPSHOT.jar richfaces-impl-3.3.
- 0-SNAPSHOT.jar richfaces-ui-3.3.0-SNAPSHOT.jar
+ ging-1.0.4.jar dom4j-1.6.1-brew.jar el-api-1.0.jar jboss-el-1.0_02.CR
+ 2.jar jboss-seam-2.1.0.SP1.jar jboss-seam-debug-2.1.0.SP1.jar jboss-s
+ eam-jul-2.1.0.SP1.jar jboss-seam-remoting-2.1.0.SP1.jar jboss-seam-ui
+ -2.1.0.SP1.jar jsf-api-1.2_10.jar jsf-facelets-1.1.15.B1.jar jsf-impl
+ -1.2_10.jar log4j-1.2.14.jar richfaces-api-3.3.0-SNAPSHOT.jar richfac
+ es-impl-3.3.0-SNAPSHOT.jar richfaces-ui-3.3.0-SNAPSHOT.jar
Added:
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/resources/regressionArea-ds.xml
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/resources/regressionArea-ds.xml
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-ejb/src/main/resources/regressionArea-ds.xml 2009-01-05
16:19:55 UTC (rev 12106)
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE datasources
+ PUBLIC "-//JBoss//DTD JBOSS JCA Config 1.5//EN"
+ "http://www.jboss.org/j2ee/dtd/jboss-ds_1_5.dtd">
+
+<datasources>
+
+ <local-tx-datasource>
+ <jndi-name>seamDatasource</jndi-name>
+ <connection-url>jdbc:hsqldb:.</connection-url>
+ <driver-class>org.hsqldb.jdbcDriver</driver-class>
+ <user-name>sa</user-name>
+ <password></password>
+ </local-tx-datasource>
+
+</datasources>
+
Property changes on: trunk/test-applications/regressionArea/regressionArea-tests
___________________________________________________________________
Name: svn:ignore
+ target
Added: trunk/test-applications/regressionArea/regressionArea-tests/pom.xml
===================================================================
--- trunk/test-applications/regressionArea/regressionArea-tests/pom.xml
(rev 0)
+++ trunk/test-applications/regressionArea/regressionArea-tests/pom.xml 2009-01-05
16:19:55 UTC (rev 12106)
@@ -0,0 +1,110 @@
+<?xml version="1.0"?><project>
+ <parent>
+ <artifactId>regressionArea</artifactId>
+ <groupId>org.richfaces.test-applications</groupId>
+ <version>3.3.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.test-applications.regressionArea</groupId>
+ <artifactId>regressionArea-tests</artifactId>
+ <packaging>jar</packaging>
+ <name>Regression Area Tests</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.8</version>
+ <scope>test</scope>
+ <type>pom</type>
+ </dependency>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>5.8</version>
+ <scope>test</scope>
+ <classifier>jdk15</classifier>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-api</artifactId>
+ <version>${richversion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.framework</groupId>
+ <artifactId>richfaces-impl</artifactId>
+ <version>${richversion}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.ui</groupId>
+ <artifactId>richfaces-ui</artifactId>
+ <version>${richversion}</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_11</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.openqa.selenium.client-drivers</groupId>
+ <artifactId>selenium-java-client-driver</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.openqa.selenium.server</groupId>
+ <artifactId>selenium-server-coreless</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>jetty</groupId>
+ <artifactId>org.mortbay.jetty</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <version>2.4.3</version>
+ <configuration>
+
+ <!-- Skip the normal tests, we'll run them in the integration-test phase
-->
+ <skip>true</skip>
+
+ <suiteXmlFiles>
+ <suiteXmlFile>
+ src/test/resources/testng.xml
+ </suiteXmlFile>
+ </suiteXmlFiles>
+ </configuration>
+ <executions>
+ <execution>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <skip>false</skip>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
Added:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/RichSeleniumTest.java
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/RichSeleniumTest.java
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/RichSeleniumTest.java 2009-01-05
16:19:55 UTC (rev 12106)
@@ -0,0 +1,11 @@
+package org.richfaces;
+
+public interface RichSeleniumTest {
+
+ public void startSelenium(String browser, String filterPrefix);
+
+ public void stopSelenium();
+
+ public String getTestUrl();
+
+}
Added:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/SeleniumTestBase.java
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/SeleniumTestBase.java 2009-01-05
16:19:55 UTC (rev 12106)
@@ -0,0 +1,834 @@
+package org.richfaces;
+
+
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.ajax4jsf.javascript.ScriptUtils;
+import org.openqa.selenium.server.RemoteControlConfiguration;
+import org.openqa.selenium.server.SeleniumServer;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Parameters;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+
+/**
+ * The base java class for selenium tests implementation.
+ *
+ * @author Andrey Markavtsov
+ *
+ */
+public abstract class SeleniumTestBase implements RichSeleniumTest {
+
+ /** Specifies the time to wait for page rendering */
+ private static final Integer pageRenderTime = 5000;
+
+ /** Specifies the time to wait for ajax processing */
+ protected static final int ajaxCompletionTime = 3000;
+
+ protected static final String serverPort = "8080";
+
+ protected static final String WINDOW_JS_RESOLVER =
"selenium.browserbot.getCurrentWindow().";
+
+ /** Parent component id */
+ private String parentId;
+
+ /** The default selenium instance */
+ public DefaultSelenium selenium;
+
+ /** Host */
+ public String host;
+
+ /** Port */
+ public String port;
+
+ /** Protocol */
+ public String protocol;
+
+ private String filterPrefix;
+
+ private SeleniumServer seleniumServer;
+
+ private Object[][] data;
+
+ private int seleniumServerPort = 5556;
+
+ /** Defines the name of current j2ee application name */
+ public static final String APPLICATION_NAME = "regressionArea";
+
+ public SeleniumTestBase() {
+ this("http", "localhost", serverPort);
+ }
+
+ public SeleniumTestBase(String protocol, String host, String port) {
+ this.host = host;
+ this.port = port;
+ this.protocol = protocol;
+ }
+
+ @BeforeSuite
+ public void startSeleniumServer() throws Exception {
+ RemoteControlConfiguration config = new RemoteControlConfiguration();
+ config.setMultiWindow(false);
+ config.setPort(seleniumServerPort);
+ seleniumServer = new SeleniumServer(false, config);
+ seleniumServer.start();
+ }
+
+ //@DataProvider(name = "templates")
+// protected Object[][] templates() {
+// return new Object[][] { { Template.SIMPLE }, { Template.DATA_TABLE }, {
Template.MODAL_PANEL } };
+// //return this.data;
+// }
+
+ /**
+ * This method are invoked before selenium tests started
+ */
+ @BeforeClass
+ @Parameters({"browser", "filterPrefix"})
+ public void startSelenium(String browser, String filterPrefix) {
+ synchronized (MUTEX) {
+ this.filterPrefix = filterPrefix;
+ selenium = createSeleniumClient(protocol + "://" + host +
":" + port + "/", browser);
+ selenium.start();
+ selenium.allowNativeXpath("false");
+ }
+ }
+
+ /**
+ * This method are invoked after selenium tests completed
+ */
+ @AfterClass(alwaysRun=true)
+ public void stopSelenium() {
+ synchronized (MUTEX) {
+ selenium.stop();
+ selenium = null;
+ }
+ }
+
+// protected void loadTemplates(String templateExpr) {
+// String[] array = new String[]{};
+// if(null != templateExpr) {
+// array = templateExpr.split(",");
+// }
+//
+// List<Object[]> list = new ArrayList<Object[]>();
+// for (String string : array) {
+// Object[] elem = new Object[] {Template.valueOf(string)};
+// list.add(elem);
+// }
+//
+// this.data = (Object[][]) list.toArray(new Object[0][0]);
+// }
+
+ @AfterSuite
+ public void stopSeleniumServer() throws Exception {
+ seleniumServer.stop();
+ }
+
+ /**
+ * @param url
+ * @param browser
+ * @return
+ */
+ private DefaultSelenium createSeleniumClient(String url, String browser) {
+ return new DefaultSelenium(host, seleniumServerPort, browser, url);
+ }
+
+ private static final Object MUTEX = new Object();
+
+ /**
+ * Renders page
+ */
+ protected void renderPage() {
+ selenium.open(protocol + "://" + host + ":" + port +
"/" + APPLICATION_NAME + filterPrefix + getTestUrl());
+ selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
+
+ //setParentId(template.getPrefix());
+ //runScript("loadTemplate('" + template + "');",
false);
+ //waitForPageToLoad();
+
+ checkPageRendering(); // At the first we check if page has been
+ // rendered
+ checkJSError(); // At the second we check if JS errors occurred
+
+ reRenderForm(); // ReRender component
+
+ checkPageRendering(); // Check all again
+ checkJSError();
+
+ }
+
+ /**
+ * Writes status message on client side
+ *
+ * @param message
+ */
+ public void writeStatus(String message, boolean isError) {
+ message = message.replace("'", "\\'");
+ StringBuffer buffer = new StringBuffer("writeStatus('");
+ buffer.append(message);
+ if (!isError) {
+ buffer.append("')");
+ }else {
+ buffer.append("',true)");
+ }
+ runScript(buffer.toString());
+ }
+
+ /**
+ * Writes status message on client side
+ *
+ * @param message
+ */
+ public void writeStatus(String message) {
+ writeStatus(message, false);
+ }
+
+ /**
+ * ReRenders the component
+ */
+ public void reRenderForm() {
+
selenium.getEval("selenium.browserbot.getCurrentWindow().reRenderAll();");
+ // clickById("_Selenium_Test_ReRender_Form:_reRender");
+ waitForAjaxCompletion(3000);
+ }
+
+ /**
+ * Performs script defined in parameter
+ *
+ * @param script
+ * @return
+ */
+ public String runScript(String script) {
+ String result = selenium.getEval(WINDOW_JS_RESOLVER + script);
+ checkJSError();
+ return result;
+ }
+
+ /**
+ * Performs script defined in parameter
+ *
+ * @param script
+ * @return
+ */
+ public String runScript(String script, boolean checkEerror) {
+ String result = selenium.getEval(WINDOW_JS_RESOLVER + script);
+ if (checkEerror) {
+ checkJSError();
+ }
+ return result;
+ }
+
+ /**
+ * Checks if JS error occurred. Fails test if yes. This method should be
+ * invoked after each event or any thing which can be a cause of JS error.
+ */
+ public void checkJSError() {
+ String error = selenium.getEval(WINDOW_JS_RESOLVER + "checkError();");
+ if (error != null && !("null".equals(error)) &&
!("".equals(error))) {
+ Assert.fail("Failure by the following Javascript error: " +
error);
+ }
+ }
+
+ /**
+ * Checks if page containing component test has been rendered completely
+ */
+ public void checkPageRendering() {
+ try {
+ String t1 = getTextById("_Selenium_Test_ControlPoint1");
+ String t2 = getTextById("_Selenium_Test_ControlPoint2");
+ if (t1 == null || t2 == null || !"Control1".equals(t1) ||
!"Control2".equals(t2)) {
+ Assert.fail("The page has been not rendered properlly");
+ }
+ } catch (Exception e) {
+ Assert.fail("The page has not been rendered properly due the following
error: " + e);
+ }
+ }
+
+ /**
+ * Waits while AJAX request will be completed
+ *
+ * @param miliseconds -
+ * time to wait
+ */
+ public void waitForAjaxCompletion(int miliseconds) {
+ selenium.waitForCondition(WINDOW_JS_RESOLVER + "done==true",
String.valueOf(miliseconds));
+ runScript("window.done=false");
+ }
+
+ /**
+ * Waits while AJAX request will be completed
+ *
+ * @param miliseconds -
+ * time to wait
+ */
+ public void waitForAjaxCompletion() {
+ waitForAjaxCompletion(ajaxCompletionTime);
+ }
+
+ /**
+ * Waits while simple request will be completed
+ *
+ * @param miliseconds -
+ * time to wait
+ */
+ public void waitForPageToLoad(int miliseconds) {
+ selenium.waitForPageToLoad(String.valueOf(miliseconds));
+ }
+
+ /**
+ * Waits for condition
+ *
+ * @param condition
+ * @param miliseconds
+ */
+ public void waiteForCondition(String condition, int miliseconds) {
+ selenium.waitForCondition(WINDOW_JS_RESOLVER + condition,
String.valueOf(miliseconds));
+ checkJSError();
+ }
+
+ /**
+ * Waits while simple request will be completed
+ *
+ */
+ public void waitForPageToLoad() {
+ selenium.waitForPageToLoad(String.valueOf(pageRenderTime));
+ }
+
+ /**
+ * Asserts DOM node value equals to value defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * value defined
+ */
+ public void AssertValueEquals(String id, String value) {
+ String _v = getValueById(id);
+ Assert.assertEquals(_v, value);
+ }
+
+ /**
+ * Asserts DOM node value equals to value defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * value defined
+ * @param message = message to be displayed in failure case
+ */
+ public void AssertValueEquals(String id, String value, String message) {
+ String _v = getValueById(id);
+ Assert.assertEquals(_v, value, message);
+ }
+
+ /**
+ * Asserts DOM node value does not equal to value defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * value defined
+ */
+ public void AssertValueNotEquals(String id, String value) {
+ String _v = getValueById(id);
+ Assert.assertNotSame(_v, value);
+ }
+
+
+ /**
+ * Asserts DOM node value does not equal to value defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * value defined
+ * @param message = message to be displayed in failure case
+ */
+ public void AssertValueNotEquals(String id, String value, String message) {
+ String _v = getValueById(id);
+ Assert.assertNotSame(_v, value, message);
+ }
+
+
+ /**
+ * Asserts DOM node text equals to text defined
+ *
+ * @param locator -
+ * locator an element locator
+ * @param value -
+ * text defined
+ */
+ public void AssertTextEquals(String locator, String value) {
+ String _v = selenium.getText(locator);
+ Assert.assertEquals(_v, value);
+ }
+
+ /**
+ * Asserts DOM node text equals to text defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * text defined
+ * @param message = message to be displayed in failure case
+ */
+ public void AssertTextEquals(String id, String value, String message) {
+ String _v = getTextById(id);
+ Assert.assertEquals(_v, value, message);
+ }
+
+
+ /**
+ * Asserts DOM node text does not equal to text defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * text defined
+ */
+ public void AssertTextNotEquals(String id, String value) {
+ String _v = getTextById(id);
+ Assert.assertNotSame(_v, value);
+ }
+
+ /**
+ * Asserts DOM node text does not equal to text defined
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * text defined
+ * @param message = message to be displayed in failure case
+ */
+ public void AssertTextNotEquals(String id, String value, String message) {
+ String _v = getTextById(id);
+ Assert.assertNotSame(_v, value, message);
+ }
+
+ /**
+ * Asserts DOM node is visible
+ *
+ * @param id -
+ * DOM element id
+ */
+ public void AssertVisible(String id) {
+ Assert.assertTrue(isVisibleById(id));
+ }
+
+ /**
+ * Asserts DOM node is not present
+ *
+ * @param id -
+ * DOM element id
+ */
+ public void AssertNotPresent(String id) {
+ Assert.assertFalse(isPresentById(id));
+ }
+
+ /**
+ * Asserts DOM node is not visible
+ *
+ * @param id -
+ * DOM element id
+ */
+ public void AssertNotVisible(String id) {
+ Assert.assertFalse(isVisibleById(id));
+ }
+
+ /**
+ * Asserts DOM node is present
+ *
+ * @param id -
+ * DOM element id
+ */
+ public void AssertPresent(String id) {
+ Assert.assertTrue(isPresentById(id));
+ }
+
+ /**
+ * Asserts DOM node is present
+ * @param id - DOM element id
+ */
+ public void AssertRendered(String id) {
+ if (!isPresentById(id)) {
+ Assert.fail("Component " + id + " should be rendered on page");
+ }
+ }
+
+ /**
+ * Asserts DOM node is not present
+ * @param id - DOM element id
+ */
+ public void AssertNotRendered(String id) {
+ if (isPresentById(id)) {
+ Assert.fail("Component " + id + " should not be rendered on
page");
+ }
+ }
+
+ /**
+ * Returns element's text
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public String getTextById(String id) {
+ return selenium.getText("id=" + id);
+ }
+
+ /**
+ * Returns element's value
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public String getValueById(String id) {
+ return selenium.getValue("id=" + id);
+ }
+
+ /**
+ * Sets a new value for DOM node with specified id.
+ *
+ * @param id -
+ * DOM element id
+ * @param value -
+ * a new DOM element's value
+ */
+ public void setValueById(String id, String value) {
+
runScript(String.format("document.getElementById('%1$s').value='%2$s';",
id, value));
+ }
+
+ /**
+ * Returns element's width
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public Number getWidthById(String id) {
+ return selenium.getElementWidth("id=" + id);
+ }
+
+ /**
+ * Returns element's height
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public Number getHeightById(String id) {
+ return selenium.getElementHeight("id=" + id);
+ }
+
+ /**
+ * Clicks on element
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public void clickById(String id) {
+ selenium.click("id=" + id);
+ checkJSError();
+ }
+
+ /**
+ * Clicks an ajax command and wait for ajax request completion.
+ * @param locator an element locator
+ */
+ public void clickAjaxCommandAndWait(String locator) {
+ selenium.click(locator);
+ waitForAjaxCompletion();
+ }
+
+ /**
+ * This method should be used for click on command controls instead of
+ * 'clickById' method.
+ *
+ * @param commandId
+ */
+ public void clickCommandAndWait(String commandId) {
+ selenium.click("id=" + commandId);
+ waitForPageToLoad();
+ }
+
+ /**
+ * Return true if element is visible
+ *
+ * @param id -
+ * DOM element id
+ * @return
+ */
+ public boolean isVisibleById(String id) {
+ return selenium.isVisible("id=" + id);
+ }
+
+ /**
+ * Returns true if element with given id is present.
+ *
+ * @param id -
+ * DOM element id
+ * @return true if element with given id is present, otherwise - false
+ */
+ public boolean isPresentById(String id) {
+ return selenium.isElementPresent("id=" + id);
+ }
+
+ /**
+ * Invokes JS method on client.
+ *
+ * @param id -
+ * DOM id of component
+ * @param method -
+ * string method name
+ * @param parameters -
+ * parameters
+ * @return
+ */
+ public String invokeFromComponent(String id, String method, Object parameters) {
+ String _return = null;
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("$('");
+ buffer.append(id);
+ buffer.append("').component.");
+ buffer.append(method);
+ buffer.append("(");
+ buffer.append(ScriptUtils.toScript(parameters));
+ buffer.append(");");
+ _return = runScript(buffer.toString());
+ return _return;
+ }
+
+ /**
+ * Creates delay
+ *
+ * @param miliSeconds
+ * @throws InterruptedException
+ */
+ public void delay(int miliSeconds) {
+ try {
+ Thread.sleep(miliSeconds);
+ } catch (Exception e) {
+
+ }
+ }
+
+ /**
+ * Creates pause for defined time in miliSeconds
+ *
+ * @param miliSeconds
+ */
+ public void pause(int miliSeconds, String id) {
+ StringBuffer script = new StringBuffer("pause(");
+ script.append(miliSeconds);
+ script.append(",'");
+ script.append(id);
+ script.append("');");
+ runScript(script.toString());
+ selenium.waitForCondition(WINDOW_JS_RESOLVER + "pauseHolder['" + id
+ "'] == true;", String
+ .valueOf(miliSeconds + 1000));
+ }
+
+ /**
+ * @return the parentId
+ */
+ public String getParentId() {
+ return parentId;
+ }
+
+ /**
+ * @param parentId
+ * the parentId to set
+ */
+ public void setParentId(String parentId) {
+ this.parentId = parentId;
+ }
+
+ /**
+ * Workaround for selenium.type/selenium.typeKeys
+ * @param locator
+ * @param string
+ */
+ public void type(String locator, String string) {
+ selenium.type(locator, "");
+ StringBuffer value = new StringBuffer(selenium.getValue(locator));
+ char[] chars = string.toCharArray();
+ for (int i = 0; i < chars.length; i++) {
+ String key = Character.toString(chars[i]);
+ value.append(key);
+
+ selenium.keyDown(locator, key);
+
+ if(!isFF()) {
+ selenium.type(locator, value.toString());
+ }
+
+ selenium.keyPress(locator, key);
+ selenium.keyUp(locator, key);
+
+ }
+ }
+
+ public void testOnclickEvent(String testElementId, String testElementResultId, String
beforeResult, String afterResult) {
+ writeStatus("Testing onclick event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.click(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnDblclickEvent(String testElementId, String testElementResultId,
String beforeResult, String afterResult) {
+ writeStatus("Testing ondblclick event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.doubleClick(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnfocusEvent(String testElementId, String testElementResultId, String
beforeResult, String afterResult) {
+ writeStatus("Testing onfocus event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.focus(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnkeydownEvent(String testElementId, String testElementResultId,
String beforeResult, String afterResult) {
+ writeStatus("Testing onkeydown event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.keyDown(testElementId, "1");
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnkeypressEvent(String testElementId, String testElementResultId,
String beforeResult, String afterResult) {
+ writeStatus("Testing onkeypress event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.keyPress(testElementId, "1");
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnkeyupEvent(String testElementId, String testElementResultId, String
beforeResult, String afterResult) {
+ writeStatus("Testing onkeyup event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.keyUp(testElementId, "1");
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnmousedownEvent(String testElementId, String testElementResultId,
String beforeResult, String afterResult) {
+ writeStatus("Testing onmousedown event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.mouseDown(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnmousemoveEvent(String testElementId, String testElementResultId,
String beforeResult, String afterResult) {
+ writeStatus("Testing onmousemove event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.mouseMove(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnmouseoutEvent(String testElementId, String testElementResultId,
String beforeResult, String afterResult) {
+ writeStatus("Testing onmouseout event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.mouseOut(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnmouseoverEvent(String testElementId, String testElementResultId,
String beforeResult, String afterResult) {
+ writeStatus("Testing onmouseover event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.mouseOver(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ public void testOnmouseupEvent(String testElementId, String testElementResultId,
String beforeResult, String afterResult) {
+ writeStatus("Testing onmouseup event");
+ AssertTextEquals(testElementResultId, beforeResult);
+ selenium.mouseUp(testElementId);
+ AssertTextEquals(testElementResultId, afterResult);
+ }
+
+ /**
+ * Method to assert element style attribute with expected
+ * @param elementId - tested element id
+ * @param expectedExpression - expected style attribute
+ */
+ public void assertStyleAttribute(String elementId, String expectedExpression) {
+ String styleAttribute = selenium.getAttribute("//*[@id='" + elementId +
"']/@style");
+ if (!styleAttribute.toLowerCase().contains(expectedExpression.toLowerCase())) {
+ Assert.fail("Element '" + elementId + "' with style
'" + styleAttribute + "' doesn't contain '" +
expectedExpression + "'");
+ }
+ }
+
+ /**
+ * Asserts that expected columns count equals actual one.
+ * @param i the expected columns count
+ * @param tableId id of table to be checked
+ */
+ public void assertColumnsCount(int i, String tableId) {
+ StringBuffer script = new StringBuffer("$('");
+ script.append(tableId);
+ script.append("').rows[0].cells.length");
+
+ String count = runScript(script.toString());
+ Assert.assertEquals(count, String.valueOf(i));
+ }
+
+ /**
+ * Asserts that expected rows count equals actual one.
+ * @param i the expected rows count
+ * @param tableId id of table to be checked
+ */
+ public void assertRowsCount(int i, String tableId) {
+ int count = selenium.getXpathCount("//table[@id='" + tableId +
"']/tbody/tr").intValue();
+ Assert.assertEquals(count, i);
+ }
+
+ /**
+ * Checks whether client is FireFox
+ *
+ * @return true if client is FireFox
+ */
+ public boolean isFF() {
+ return new
Boolean(selenium.getEval("navigator.userAgent.indexOf('Firefox') >
-1"));
+ }
+
+ /**
+ * Returns the url to test page to be opened by selenium
+ *
+ * @return
+ */
+ public abstract String getTestUrl();
+
+ /**
+ * Simulates mouse event for element
+ * @param id - Element ID
+ * @param eventName - Mouse event Name
+ * @param x - X mouse position
+ * @param y - Y mouse position
+ * @return - Event
+ */
+ public String fireMouseEvent(String id, String eventName, int x, int y, boolean ctrl)
{
+ return runScript("fireMouseEvent('" + id + "','" +
eventName + "', "
+ + x + "," + y + ","+ctrl+");");
+ }
+
+ /**
+ * Calls component JS API
+ *
+ * @param id - Client id of the component to call operation on
+ * @param function - JS function representing operation that should be called
+ * @return - Result of execution
+ */
+ public String callComponentOperation(String id, JSFunction function) {
+ StringBuffer command = new StringBuffer();
+ new JSFunction("document.getElementById", id).appendScript(command);
+ command.append(".component.");
+ function.appendScript(command);
+ return runScript(command.toString());
+ }
+}
Added:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/TestAnnotationTransformer.java
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/TestAnnotationTransformer.java
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/TestAnnotationTransformer.java 2009-01-05
16:19:55 UTC (rev 12106)
@@ -0,0 +1,28 @@
+package org.richfaces;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import org.testng.internal.annotations.IAnnotationTransformer;
+import org.testng.internal.annotations.ITest;
+import org.testng.internal.annotations.TestAnnotation;
+
+/**
+ * This transformer sets necessary data provider for each test method.
+ *
+ * @author carcasser
+ */
+public class TestAnnotationTransformer implements IAnnotationTransformer {
+
+ /**
+ * @see IAnnotationTransformer#transform(ITest, Class, Constructor, Method)
+ */
+ public void transform(ITest annotation, Class testClass, Constructor testConstructor,
Method testMethod) {
+
+ if ((testClass == null || RichSeleniumTest.class.isAssignableFrom(testClass))
+ && (annotation instanceof TestAnnotation)) {
+ ((TestAnnotation) annotation).setDataProvider("templates");
+ }
+ }
+
+}
\ No newline at end of file
Added:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/SimpleTest.java
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/SimpleTest.java
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/SimpleTest.java 2009-01-05
16:19:55 UTC (rev 12106)
@@ -0,0 +1,26 @@
+package org.richfaces.testng;
+
+import org.richfaces.SeleniumTestBase;
+import org.testng.annotations.Test;
+
+public class SimpleTest extends SeleniumTestBase {
+
+ @Test
+ public void testXHTML() {
+ renderPage();
+
+ }
+
+ @Test
+ public void testJSP() {
+ selenium.open("http://localhost:" + serverPort + "/" +
APPLICATION_NAME + "/faces/NEKO/pages/examples/home.jsp");
+ waitForPageToLoad();
+
+ }
+
+ @Override
+ public String getTestUrl() {
+ return "pages/examples/home.xhtml";
+ }
+
+}
Added:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf4507/Test.java
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf4507/Test.java
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf4507/Test.java 2009-01-05
16:19:55 UTC (rev 12106)
@@ -0,0 +1,58 @@
+package org.richfaces.testng.rf4507;
+
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+
+public class Test extends SeleniumTestBase {
+
+ private String getIdSelector(String id) {
+ return "//*[@id='" + id + "']";
+ }
+
+ private void testCalendarSwitch(int buttonPosition, String cellText) {
+ renderPage();
+
+ AssertTextEquals(getIdSelector("form:calendarDayCell6") + "/div",
"5-10");
+
+ selenium.assignId(getIdSelector("form:calendarHeader") +
"//td[*[@class='rich-calendar-tool-btn']][" + buttonPosition +
"]/div", "testButton");
+ fireMouseEvent("testButton", "click", 0, 0, false);
+ waitForAjaxCompletion();
+
+ AssertTextEquals(getIdSelector( "form:calendarDayCell6") + "/div",
cellText);
+ }
+
+ private void testLink(String linkId, String data) throws Exception {
+ renderPage();
+
+ Assert.assertEquals("null",
selenium.getEval("window.receivedData"));
+
+ clickAjaxCommandAndWait(getIdSelector(linkId));
+
+ Assert.assertEquals(data, selenium.getEval("window.receivedData"));
+ }
+
+ @org.testng.annotations.Test
+ public void testNextMonth() throws Exception {
+ testCalendarSwitch(4, "2-11");
+ }
+
+ @org.testng.annotations.Test
+ public void testPreviousMonth() throws Exception {
+ testCalendarSwitch(2, "7-9");
+ }
+
+ @org.testng.annotations.Test
+ public void testFirstLink() throws Exception {
+ testLink("form:link1", "firstLink");
+ }
+
+ @org.testng.annotations.Test
+ public void testSecondLink() throws Exception {
+ testLink("form:link2", "secondLink");
+ }
+
+ public String getTestUrl() {
+ return "pages/rf4507.xhtml";
+ }
+
+}
Added:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf4709/Test.java
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf4709/Test.java
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf4709/Test.java 2009-01-05
16:19:55 UTC (rev 12106)
@@ -0,0 +1,53 @@
+package org.richfaces.testng.rf4709;
+
+import org.richfaces.SeleniumTestBase;
+
+public class Test extends SeleniumTestBase {
+
+ private String getMessagesLocator() {
+ return "//*[@id='" + "messages']";
+ }
+
+ @org.testng.annotations.Test
+ public void testTabPanel() throws Exception {
+ renderPage();
+
+ AssertTextEquals(getMessagesLocator(), "");
+
+ selenium.assignId("//*[@id='form:secondTab_lbl']",
"testElement");
+ fireMouseEvent("testElement", "click", 0, 0, false);
+ waitForAjaxCompletion();
+
+ AssertTextEquals(getMessagesLocator(), "tabPanel");
+ }
+
+ @org.testng.annotations.Test
+ public void testTogglePanel() throws Exception {
+ renderPage();
+
+ AssertTextEquals(getMessagesLocator(), "");
+
+ selenium.click("//*[@id='form:firstControl']");
+ waitForAjaxCompletion();
+
+ AssertTextEquals(getMessagesLocator(), "togglePanel");
+ }
+
+ @org.testng.annotations.Test
+ public void testPanelBar() throws Exception {
+ renderPage();
+
+ AssertTextEquals(getMessagesLocator(), "");
+ selenium.assignId("//*[@id='form:secondPanelBarItem']/div[1]",
"testElement");
+ fireMouseEvent("testElement", "click", 0, 0, false);
+ waitForAjaxCompletion();
+
+ AssertTextEquals(getMessagesLocator(), "panelBar");
+ }
+
+ @Override
+ public String getTestUrl() {
+ return "pages/rf4709.xhtml";
+ }
+
+}
Added:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5264/Test.java
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5264/Test.java
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/java/org/richfaces/testng/rf5264/Test.java 2009-01-05
16:19:55 UTC (rev 12106)
@@ -0,0 +1,74 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+package org.richfaces.testng.rf5264;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.richfaces.SeleniumTestBase;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class Test extends SeleniumTestBase {
+
+ private static final String PROGRESS_BAR_ID = "form:progressBar";
+ private static final String PROGRESS_BAR_TEST_ELEMENT_ID = PROGRESS_BAR_ID +
":upload";
+
+ private static final String PROGRESS_BAR_INITIAL_ELEMENT_ID = PROGRESS_BAR_ID +
":initialState";
+ private static final String PROGRESS_BAR_COMPLETE_ELEMENT_ID = PROGRESS_BAR_ID +
":completeState";
+
+ @org.testng.annotations.Test
+ public void testBeyondMinimum() throws Exception {
+ renderPage();
+
+ assertStyleAttribute(PROGRESS_BAR_TEST_ELEMENT_ID, "width: 50%;");
+ AssertNotVisible(PROGRESS_BAR_INITIAL_ELEMENT_ID);
+ AssertNotVisible(PROGRESS_BAR_COMPLETE_ELEMENT_ID);
+
+ callComponentOperation(PROGRESS_BAR_ID, new JSFunction("setValue", 0));
+ AssertVisible(PROGRESS_BAR_INITIAL_ELEMENT_ID);
+ AssertNotVisible(PROGRESS_BAR_COMPLETE_ELEMENT_ID);
+ AssertNotVisible(PROGRESS_BAR_TEST_ELEMENT_ID);
+ }
+
+ @org.testng.annotations.Test
+ public void testAboveMaximum() throws Exception {
+ renderPage();
+
+ assertStyleAttribute(PROGRESS_BAR_TEST_ELEMENT_ID, "width: 50%;");
+ AssertNotVisible(PROGRESS_BAR_INITIAL_ELEMENT_ID);
+ AssertNotVisible(PROGRESS_BAR_COMPLETE_ELEMENT_ID);
+
+ callComponentOperation(PROGRESS_BAR_ID, new JSFunction("setValue", 1000));
+ AssertVisible(PROGRESS_BAR_COMPLETE_ELEMENT_ID);
+ AssertNotVisible(PROGRESS_BAR_INITIAL_ELEMENT_ID);
+ AssertNotVisible(PROGRESS_BAR_TEST_ELEMENT_ID);
+ }
+
+ @Override
+ public String getTestUrl() {
+ return "pages/rf5264.xhtml";
+ }
+
+
+}
Added:
trunk/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml
===================================================================
---
trunk/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml
(rev 0)
+++
trunk/test-applications/regressionArea/regressionArea-tests/src/test/resources/testng.xml 2009-01-05
16:19:55 UTC (rev 12106)
@@ -0,0 +1,27 @@
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="seleniumTestDANe">
+ <!--test name="IEFunctionalTests">
+ <parameter name="browser" value="*iexplore"/>
+ <parameter name="loadStyleStrategy" value="DEFAULT"/>
+ <parameter name="loadScriptStrategy" value="ALL"/>
+ <parameter name="filterPrefix" value="/faces/NEKO/"/>
+ <packages>
+ <package name="org.richfaces.testng" />
+ <package name="org.richfaces.testng.rf4507" />
+ <package name="org.richfaces.testng.rf4709" />
+ <package name="org.richfaces.testng.rf5264" />
+ </packages>
+ </test-->
+ <test name="FireFoxFunctionalTestsDANe">
+ <parameter name="loadStyleStrategy" value="DEFAULT"/>
+ <parameter name="loadScriptStrategy" value="ALL"/>
+ <parameter name="filterPrefix" value="/faces/NEKO/"/>
+ <parameter name="browser" value="*firefox"/>
+ <packages>
+ <package name="org.richfaces.testng" />
+ <package name="org.richfaces.testng.rf4507" />
+ <package name="org.richfaces.testng.rf4709" />
+ <package name="org.richfaces.testng.rf5264" />
+ </packages>
+ </test>
+</suite>
Modified: trunk/test-applications/regressionArea/regressionArea-web/pom.xml
===================================================================
--- trunk/test-applications/regressionArea/regressionArea-web/pom.xml 2009-01-05 16:19:31
UTC (rev 12105)
+++ trunk/test-applications/regressionArea/regressionArea-web/pom.xml 2009-01-05 16:19:55
UTC (rev 12106)
@@ -38,10 +38,10 @@
<artifactId>richfaces-ui</artifactId>
<version>${richversion}</version>
</dependency>
- <dependency>
- <groupId>org.richfaces.test-applications.regressionArea</groupId>
- <artifactId>regressionArea-ejb</artifactId>
- <version>${project.version}</version>
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <version>1.2_11</version>
<scope>provided</scope>
</dependency>
<dependency>
@@ -131,7 +131,7 @@
<build>
<plugins>
- <plugin>
+ <!-- plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
@@ -148,7 +148,7 @@
</execution>
</executions>
</plugin>
- <plugin>
+ <plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>0.3.1</version>
@@ -195,7 +195,7 @@
</deployables>
</deployer>
</configuration>
- </plugin>
+ </plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>