[gatein-commits] gatein SVN: r4988 - in portal/trunk/testsuite: selenium-tests-other and 20 other directories.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Nov 9 08:45:49 EST 2010


Author: mstruk
Date: 2010-11-09 08:45:48 -0500 (Tue, 09 Nov 2010)
New Revision: 4988

Added:
   portal/trunk/testsuite/selenium-tests-other/
   portal/trunk/testsuite/selenium-tests-other/Readme.txt
   portal/trunk/testsuite/selenium-tests-other/pom.xml
   portal/trunk/testsuite/selenium-tests-other/src/
   portal/trunk/testsuite/selenium-tests-other/src/main/
   portal/trunk/testsuite/selenium-tests-other/src/main/java/
   portal/trunk/testsuite/selenium-tests-other/src/main/resources/
   portal/trunk/testsuite/selenium-tests-other/src/suite/
   portal/trunk/testsuite/selenium-tests-other/src/suite/user-extensions.js
   portal/trunk/testsuite/selenium-tests-other/src/test/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractContextual.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractSingleTest.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractSingleTestWithAnt.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractTestCase.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/SeleniumContext.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/TestCaseFailListener.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/TestMethodSelector.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/build/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/build/BuildHelper.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/common/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/common/CommonHelper.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/jira/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/jira/Test_GTNPORTAL_1257_SeamSessionOutlivesTheGateInSession.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/messages.properties
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/navigation/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/navigation/NavigationHelper.java
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/page/
   portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/page/PageHelper.java
   portal/trunk/testsuite/selenium-tests-other/src/test/resources/
   portal/trunk/testsuite/selenium-tests-other/src/test/resources/org/
   portal/trunk/testsuite/selenium-tests-other/src/test/resources/org/jboss/
   portal/trunk/testsuite/selenium-tests-other/src/test/resources/org/jboss/gatein/
   portal/trunk/testsuite/selenium-tests-other/src/test/resources/org/jboss/gatein/selenium/
   portal/trunk/testsuite/selenium-tests-other/src/test/resources/org/jboss/gatein/selenium/jira/
   portal/trunk/testsuite/selenium-tests-other/src/test/resources/org/jboss/gatein/selenium/jira/Test_GTNPORTAL_1257_SeamSessionOutlivesTheGateInSession-build.xml
   portal/trunk/testsuite/selenium-tests-other/src/test/resources/testng.xml
Log:
TestNG + Java based Selenium testsuite

Added: portal/trunk/testsuite/selenium-tests-other/Readme.txt
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/Readme.txt	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/Readme.txt	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,47 @@
+
+An alternative selenium testsuite.
+
+
+
+== Features ==
+
+- API for simple programmatic test composition
+- includes ready made per-test ant build - allowing individual tests to prepare and deploy any server-side dependency they might need but are unavailable
+- no support for 'macro' .html files
+- more control at every step of execution allowing for a more robust while still efficient tests
+
+
+
+== Usage ==
+
+To run against an already running GateIn instance use:
+
+  mvn integration-test -Pselenium
+
+
+
+To start an already built GateIn JBoss (avaialbe in packaging/pkg/target/jboss) before starting tests use:
+
+  mvn integration-test -Pselenium -DcontainerId=jboss5x
+
+
+
+== Using per-test ant builds ==
+
+This functionality is very useful for integration testing where individual tests need to pull in custom dependencies for deployment to an already running GateIn instance for example.
+
+When a test class extends AbstractSingleTestWithAnt it inherits functionality that allows for test-specific build.xml file discovery and execution. Discovery is based on a naming convention - it looks for a file called TEST_CLASS_NAME-build.xml (where TEST_CLASS_NAME is the name of the test class), and it expects to find it in test class' package.
+
+A test making use of this functionality can easily trigger a complete discovery and execution cycle by calling one single method.
+
+(For an example see Test_GTNPORTAL_1257_SeamSessionOutlivesTheGateInSession.java which deploys JBoss Portlet Bridge's Seam booking example)
+
+
+
+== Known issues ==
+
+Using maven-ant-tasks-2.1.1 from ant builds doesn't work with Maven 3.
+
+
+
+

Added: portal/trunk/testsuite/selenium-tests-other/pom.xml
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/pom.xml	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/pom.xml	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,480 @@
+<!--
+  ~ JBoss, Home of Professional Open Source.
+  ~ Copyright 2010, Red Hat Middleware LLC, and individual contributors
+  ~ as indicated by the @author tags. See the copyright.txt file in the
+  ~ distribution for a full listing of individual contributors.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software 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 software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+
+<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.exoplatform.portal</groupId>
+      <artifactId>exo.portal.testsuite</artifactId>
+      <version>3.2.0-Beta01-SNAPSHOT</version>
+   </parent>
+
+   <groupId>org.jboss.gatein</groupId>
+   <artifactId>gatein.ui.tests.selenium</artifactId>
+   <version>3.2.0-Beta01-SNAPSHOT</version>
+   <packaging>jar</packaging>
+   <name>Selenium UI Tests for GateIn</name>
+   <description>Selenium UI Tests for GateIn</description>
+
+   <properties>
+      <org.selenium.server.version>1.0.1</org.selenium.server.version>
+      <org.selenium.server.client.version>1.0.1</org.selenium.server.client.version>
+      <selenium.port>6666</selenium.port>
+      <selenium.browser>firefox</selenium.browser>
+      <selenium.timeout>20000</selenium.timeout>
+      <selenium.speed>300</selenium.speed>
+      <selenium.host>localhost</selenium.host>
+      <selenium.host.port>8080</selenium.host.port>
+      <selenium.host2>localhost</selenium.host2>
+      <selenium.host2.port>8080</selenium.host2.port>
+      <wsrp.version>v1</wsrp.version>
+      <org.selenium.maven-plugin.version>1.0.1</org.selenium.maven-plugin.version>
+      <cargo.timeout>240000</cargo.timeout>
+      <cargo.jvmargs.additional/>
+      <portal.path>/portal/public/classic</portal.path>
+      <testng.suite.file>testng.xml</testng.suite.file>
+      <method>*</method>
+      <screenshot>false</screenshot>
+      <html_src>false</html_src>
+      <selenium.test.skip>false</selenium.test.skip>
+      <selenium.server.skip>false</selenium.server.skip>
+
+      <!-- These are used by test specific ant projects to know where to deploy dependency artifacts -->
+      <container.home>../../packaging/pkg/target/jboss</container.home>
+      <container.config.home>${container.home}/server/default</container.config.home>
+      <container.config.deploy>${container.config.home}/deploy</container.config.deploy>
+
+      <!-- Change this to INFO or WARN to reduce ant build logging -->
+      <ant.logging.level>DEBUG</ant.logging.level>
+   </properties>
+
+
+   <repositories>
+      <repository>
+         <id>repository.jboss.org</id>
+         <url>http://repository.jboss.org/maven2</url>
+         <releases>
+            <enabled>true</enabled>
+         </releases>
+         <snapshots>
+            <enabled>false</enabled>
+         </snapshots>
+      </repository>
+      <repository>
+         <id>snapshots.jboss.org</id>
+         <url>http://snapshots.jboss.org/maven2</url>
+         <releases>
+            <enabled>false</enabled>
+         </releases>
+         <snapshots>
+            <enabled>true</enabled>
+         </snapshots>
+      </repository>
+      <repository>
+         <id>jboss-releases</id>
+         <url>https://repository.jboss.org/nexus/content/repositories/releases/</url>
+         <releases>
+            <enabled>true</enabled>
+         </releases>
+         <snapshots>
+            <enabled>false</enabled>
+         </snapshots>
+      </repository>
+      <repository>
+         <id>jboss-public</id>
+         <url>https://repository.jboss.org/nexus/content/groups/public/</url>
+         <releases>
+            <enabled>true</enabled>
+         </releases>
+         <snapshots>
+            <enabled>false</enabled>
+         </snapshots>
+      </repository>
+   </repositories>
+
+   <!-- no tests by default -->
+   <build>
+      <plugins>
+         <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <configuration>
+               <skip>true</skip>
+            </configuration>
+         </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>
+
+   <profiles>
+      <profile>
+         <id>sniff-tests</id>
+         <properties>
+            <testng.suite.file>testng-sniff.xml</testng.suite.file>
+         </properties>
+      </profile>
+      <profile>
+         <id>selenium</id>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-compiler-plugin</artifactId>
+                  <configuration>
+                     <source>1.5</source>
+                     <target>1.5</target>
+                  </configuration>
+               </plugin>
+
+               <plugin>
+                  <artifactId>maven-antrun-plugin</artifactId>
+                  <executions>
+                     <execution>
+                        <id>deploy</id>
+                        <phase>package</phase>
+                        <goals>
+                           <goal>run</goal>
+                        </goals>
+                        <configuration>
+                           <tasks>
+                              <copy file="${basedir}/src/test/java/org/jboss/gatein/selenium/messages.properties"
+                                    todir="${project.build.directory}/test-classes/org/jboss/gatein/selenium"/>
+                           </tasks>
+                        </configuration>
+                     </execution>
+                  </executions>
+               </plugin>
+
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>selenium-maven-plugin</artifactId>
+                  <version>${org.selenium.maven-plugin.version}</version>
+                  <executions>
+                     <execution>
+                        <id>start-selenium-server</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                           <goal>start-server</goal>
+                        </goals>
+                        <configuration>
+                           <background>true</background>
+                           <logFile>${project.build.directory}/server.log</logFile>
+                           <logOutput>true</logOutput>
+                           <userExtensions>${pom.basedir}/src/suite/user-extensions.js</userExtensions>
+                           <port>${selenium.port}</port>
+                           <skip>${selenium.server.skip}</skip>
+                        </configuration>
+                     </execution>
+                     <execution>
+                        <id>stop-selenium-server</id>
+                        <phase>post-integration-test</phase>
+                        <goals>
+                           <goal>stop-server</goal>
+                        </goals>
+                        <configuration>
+                           <background>true</background>
+                           <port>${selenium.port}</port>
+                           <skip>${selenium.server.skip}</skip>
+                        </configuration>
+                     </execution>
+                  </executions>
+               </plugin>
+
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>properties-maven-plugin</artifactId>
+                  <version>1.0-alpha-2</version>
+                  <executions>
+                     <execution>
+                        <id>project-properties</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                           <goal>write-project-properties</goal>
+                        </goals>
+                        <configuration>
+                           <outputFile>
+                              ${project.build.directory}/project.properties
+                           </outputFile>
+                        </configuration>
+                     </execution>
+                     <execution>
+                        <id>active-profile-properties</id>
+                        <phase>generate-resources</phase>
+                        <goals>
+                           <goal>write-active-profile-properties</goal>
+                        </goals>
+                        <configuration>
+                           <outputFile>
+                              ${project.build.directory}/active-profile.properties
+                           </outputFile>
+                        </configuration>
+                     </execution>
+                  </executions>
+               </plugin>
+
+               <plugin>
+                  <groupId>org.apache.maven.plugins</groupId>
+                  <artifactId>maven-surefire-plugin</artifactId>
+                  <executions>
+                     <execution>
+                        <phase>integration-test</phase>
+                        <goals>
+                           <goal>test</goal>
+                        </goals>
+                        <configuration>
+                           <skip>${selenium.test.skip}</skip>
+                           <suiteXmlFiles>
+                              <suiteXmlFile>src/test/resources/${testng.suite.file}</suiteXmlFile>
+                           </suiteXmlFiles>
+                           <systemProperties>
+                              <property>
+                                 <name>selenium.port</name>
+                                 <value>${selenium.port}</value>
+                              </property>
+                              <property>
+                                 <name>selenium.browser</name>
+                                 <value>${selenium.browser}</value>
+                              </property>
+                              <property>
+                                 <name>selenium.speed</name>
+                                 <value>${selenium.speed}</value>
+                              </property>
+                              <property>
+                                 <name>selenium.timeout</name>
+                                 <value>${selenium.timeout}</value>
+                              </property>
+                              <property>
+                                 <name>selenium.host</name>
+                                 <value>${selenium.host}</value>
+                              </property>
+                              <property>
+                                 <name>selenium.host.port</name>
+                                 <value>${selenium.host.port}</value>
+                              </property>
+                              <property>
+                                 <name>selenium.host2</name>
+                                 <value>${selenium.host2}</value>
+                              </property>
+                              <property>
+                                 <name>selenium.host2.port</name>
+                                 <value>${selenium.host2.port}</value>
+                              </property>
+                              <property>
+                                 <name>portal.path</name>
+                                 <value>${portal.path}</value>
+                              </property>
+                              <property>
+                                 <name>wsrp.version</name>
+                                 <value>${wsrp.version}</value>
+                              </property>
+                              <property>
+                                 <name>method</name>
+                                 <value>${method}</value>
+                              </property>
+                              <property>
+                                 <name>screenshot</name>
+                                 <value>${screenshot}</value>
+                              </property>
+                              <property>
+                                 <name>html-src</name>
+                                 <value>${html_src}</value>
+                              </property>
+                              <property>
+                                 <name>output-dir</name>
+                                 <value>${project.build.directory}/screenshots</value>
+                              </property>
+                           </systemProperties>
+                           <properties>
+                              <property>
+                                 <name>listener</name>
+                                 <value>
+                                    org.jboss.test.selenium.listener.ConsoleStatusTestListener,org.jboss.gatein.selenium.TestMethodSelector,org.jboss.gatein.selenium.TestCaseFailListener
+                                 </value>
+                              </property>
+                           </properties>
+                        </configuration>
+                     </execution>
+                  </executions>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+
+      <!--  Container Profile -->
+      <profile>
+         <id>container</id>
+         <activation>
+            <property>
+               <name>containerId</name>
+            </property>
+         </activation>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.cargo</groupId>
+                  <artifactId>cargo-maven2-plugin</artifactId>
+                  <version>1.0.2</version>
+                  <executions>
+                     <execution>
+                        <id>start-container</id>
+                        <phase>pre-integration-test</phase>
+                        <goals>
+                           <goal>start</goal>
+                        </goals>
+                     </execution>
+                     <!--
+                               Stop is done by jboss-maven-plugin <execution>
+                               <id>stop-container</id> <phase>post-integration-test</phase>
+                               <goals> <goal>stop</goal> </goals> </execution>
+                            -->
+                  </executions>
+                  <configuration>
+                     <wait>false</wait>
+                     <container>
+                        <containerId>${containerId}</containerId>
+                        <append>false</append>
+                        <home>${container.home}</home>
+                        <timeout>${cargo.timeout}</timeout>
+                     </container>
+                     <configuration>
+                        <properties>
+                           <cargo.hostname>${selenium.host}</cargo.hostname>
+                           <cargo.jvmargs>-Xms768m -Xmx1024m -XX:MaxPermSize=256m
+                              -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000
+                              -Dsun.rmi.dgc.server.gcInterval=3600000 -Dsun.lang.ClassLoader.allowArraySyntax=true
+                              -Dexo.conf.dir.name=gatein ${cargo.jvmargs.additional}
+                           </cargo.jvmargs>
+                        </properties>
+                     </configuration>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+
+      <!-- Container: JBoss AS 5.X -->
+      <profile>
+         <id>container-jboss5x</id>
+         <activation>
+            <property>
+               <name>containerId</name>
+               <value>jboss5x</value>
+            </property>
+         </activation>
+         <properties>
+            <container.home>../../packaging/pkg/target/jboss</container.home>
+            <container.config.home>${container.home}/server/default</container.config.home>
+            <container.config.deploy>${container.config.home}/deploy</container.config.deploy>
+         </properties>
+         <build>
+            <plugins>
+               <plugin>
+                  <groupId>org.codehaus.cargo</groupId>
+                  <artifactId>cargo-maven2-plugin</artifactId>
+                  <version>1.0.2</version>
+                  <configuration>
+                     <configuration>
+                        <type>existing</type>
+                        <home>${container.config.home}</home>
+                        <properties>
+                           <cargo.jboss.configuration>default</cargo.jboss.configuration>
+                           <cargo.rmi.port>1099</cargo.rmi.port>
+                        </properties>
+                     </configuration>
+                  </configuration>
+               </plugin>
+               <plugin>
+                  <groupId>org.codehaus.mojo</groupId>
+                  <artifactId>jboss-maven-plugin</artifactId>
+                  <version>1.4</version>
+                  <executions>
+                     <execution>
+                        <id>stop-container</id>
+                        <phase>post-integration-test</phase>
+                        <goals>
+                           <goal>stop</goal>
+                        </goals>
+                     </execution>
+                  </executions>
+                  <configuration>
+                     <jbossHome>${container.home}</jbossHome>
+                     <serverName>default</serverName>
+                  </configuration>
+               </plugin>
+            </plugins>
+         </build>
+      </profile>
+   </profiles>
+   <dependencies>
+      <dependency>
+         <groupId>org.testng</groupId>
+         <artifactId>testng</artifactId>
+         <version>5.12.1</version>
+         <scope>test</scope>
+      </dependency>
+      <dependency>
+         <groupId>org.seleniumhq.selenium.client-drivers</groupId>
+         <artifactId>selenium-java-client-driver</artifactId>
+         <version>${org.selenium.server.client.version}</version>
+      </dependency>
+      <dependency>
+         <groupId>org.seleniumhq.selenium.server</groupId>
+         <artifactId>selenium-server</artifactId>
+         <version>${org.selenium.server.version}</version>
+         <classifier>standalone</classifier>
+      </dependency>
+      <dependency>
+         <groupId>commons-io</groupId>
+         <artifactId>commons-io</artifactId>
+         <version>1.4</version>
+      </dependency>
+      <dependency>
+         <groupId>commons-lang</groupId>
+         <artifactId>commons-lang</artifactId>
+         <version>2.4</version>
+      </dependency>
+      <dependency>
+         <groupId>org.jboss.test</groupId>
+         <artifactId>richfaces-selenium</artifactId>
+         <version>1.5.0.Alpha1</version>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.maven</groupId>
+         <artifactId>maven-ant-tasks</artifactId>
+         <version>2.1.1</version>
+      </dependency>
+      <dependency>
+         <groupId>org.apache.ant</groupId>
+         <artifactId>ant</artifactId>
+         <version>1.7.1</version>
+      </dependency>
+   </dependencies>
+</project>

Added: portal/trunk/testsuite/selenium-tests-other/src/suite/user-extensions.js
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/suite/user-extensions.js	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/suite/user-extensions.js	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,59 @@
+/***************************************************************************************************************/
+/** Exo User Extensions ***/
+/***************************************************************************************************************/
+
+Selenium.prototype.doGetExoExtensionVersion = function(){
+	return "1.0";
+};
+
+/**
+  * This function allows to use a specific Contextual menu
+  * Usage:
+  * - Locator : Element to rightclick on
+  *
+  * For more information see the following URL:
+  * - Manually Fire event : http://www.howtocreate.co.uk/tutorials/javascript/domevents#domevld1
+  * - initMouseEvent properties : http://www.quirksmode.org/js/events_properties.html
+  *
+  * store in exo-int/qa/selenium
+  **/ 
+Selenium.prototype.doComponentExoContextMenu = function(locator){
+	
+	var element = this.page().findElement(locator);
+    if (element.fireEvent && element.ownerDocument && element.ownerDocument.createEventObject) { // IE
+        var evt = createEventObject(element, false, false, false, false);
+        evt.button = 2;
+        element.fireEvent('onmousedown', evt);
+    } else {
+    	var evObj = document.createEvent('MouseEvents');
+		evObj.initMouseEvent( 'mousedown', true, true, window, 1, 12, 345, 7, 220, false, false, false, false, 2, null );
+		element.dispatchEvent(evObj);
+    }
+
+};
+
+/**
+  * This function allows to use a specific Contextual menu
+  * Usage:
+  * - Locator : Element to doubleclick on
+	  
+  * For more information see the following URL:
+  * - Manually Fire event : http://www.howtocreate.co.uk/tutorials/javascript/domevents#domevld1
+  * - initMouseEvent properties : http://www.quirksmode.org/js/events_properties.html
+  * 
+  * store in exo-int/qa/selenium
+  **/ 
+Selenium.prototype.doComponentExoDoubleClick = function(locator){
+	
+	var element = this.page().findElement(locator);
+    if (element.fireEvent && element.ownerDocument && element.ownerDocument.createEventObject) { // IE
+        var evt = createEventObject(element, false, false, false, false);
+        evt.button = 0;
+        element.fireEvent('ondblclick', evt);
+    } else {
+    	var evObj = document.createEvent('MouseEvents');
+		evObj.initMouseEvent( 'dblclick', true, true, window, 1, 12, 345, 7, 220, false, false, false, false, 0, null );
+		element.dispatchEvent(evObj);
+    }
+
+};
\ No newline at end of file

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractContextual.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractContextual.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractContextual.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium;
+
+import com.thoughtworks.selenium.Selenium;
+
+public class AbstractContextual
+{
+
+   protected static Selenium selenium;
+   protected static String timeout;
+   protected static int timeoutSecInt;
+   protected static String portalPath;
+   protected static String browser;
+   protected static boolean ieFlag;
+
+   private static boolean inited;
+   private static int savedTimeoutSecInt;
+
+   private static SeleniumContext getSeleniumContext()
+   {
+      return AbstractTestCase.getCurrentSeleniumContext();
+   }
+
+   protected static void setUp()
+   {
+      if (inited)
+      {
+         return;
+      }
+
+      final SeleniumContext seleniumContext = getSeleniumContext();
+      selenium = seleniumContext.getSelenium();
+      timeout = seleniumContext.getTimeout();
+      timeoutSecInt = seleniumContext.getTimeoutSecInt();
+      portalPath = seleniumContext.getPortalPath();
+      browser = seleniumContext.getBrowser();
+      ieFlag = browser.contains("explore");
+      inited = true;
+   }
+
+   public static void setTemporaryTimeoutSecInt(int secs)
+   {
+      setUp();
+
+      savedTimeoutSecInt = timeoutSecInt;
+      if (secs > timeoutSecInt)
+      {
+         timeoutSecInt = secs;
+      }
+   }
+
+   public static void restoreTimeoutSecInt()
+   {
+      timeoutSecInt = savedTimeoutSecInt;
+   }
+}

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractSingleTest.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractSingleTest.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractSingleTest.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,56 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium;
+
+/**
+ * @author <a href="mailto:mstrukel at redhat.com">Marko Strukelj</a>
+ */
+public abstract class AbstractSingleTest extends AbstractTestCase
+{
+
+   protected void performTest() throws Throwable
+   {
+      try
+      {
+         mainTest();
+      }
+      catch (Throwable ex)
+      {
+         exception(ex);
+         throw ex;
+      }
+      finally
+      {
+         cleanup();
+      }
+   }
+
+   protected void mainTest() throws Throwable
+   {}
+
+   protected void cleanup()
+   {}
+
+   protected void exception(Throwable ex)
+   {}
+}

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractSingleTestWithAnt.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractSingleTestWithAnt.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractSingleTestWithAnt.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,201 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium;
+
+import org.apache.tools.ant.DefaultLogger;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.ProjectHelper;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Map;
+import java.util.Properties;
+
+import static org.jboss.gatein.selenium.build.BuildHelper.getMavenHome;
+import static org.jboss.gatein.selenium.common.CommonHelper.copyAndClose;
+
+/**
+ * @author <a href="mailto:mstrukel at redhat.com">Marko Strukelj</a>
+ */
+public class AbstractSingleTestWithAnt extends AbstractSingleTest
+{
+   private String workDirRoot = "target/";
+   private String mavenProps = "project.properties";
+   private String mavenActiveProps = "active-profile.properties";
+
+   private boolean fileInited;
+   private File antBuildFile;
+   private Project project;
+
+   protected String getTestName()
+   {
+      String className = getClass().getName();
+      return className.substring(className.lastIndexOf('.') + 1);
+   }
+
+   protected Properties getActiveMavenProperties() throws IOException
+   {
+      Properties props = new Properties();
+      File propsFile = new File(workDirRoot, mavenProps);
+      if (!propsFile.isFile())
+      {
+         log.warn("File " + propsFile + " not found. Make sure you're using properties-maven-plugin in your pom.xml. Build may not work properly: " + getAntBuildFileName());
+      }
+      else
+      {
+         props.load(new FileInputStream(propsFile));
+      }
+
+      propsFile = new File(workDirRoot, mavenActiveProps);
+      if (!propsFile.isFile())
+      {
+         log.warn("File " + propsFile + " not found. Make sure you're using properties-maven-plugin in your pom.xml. Build may not work properly: " + getAntBuildFileName());
+      }
+      else
+      {
+         props.load(new FileInputStream(propsFile));
+      }
+
+      return props;
+   }
+
+   protected File getTestWorkDir()
+   {
+      return new File(workDirRoot, getTestName());
+   }
+
+   protected String getAntBuildFileName()
+   {
+      return getTestName() + "-build.xml";
+   }
+
+   protected File findAntBuildFileForTest() throws IOException
+   {
+      if (fileInited)
+         return antBuildFile;
+
+      fileInited = true;
+      String fileName = getAntBuildFileName();
+      InputStream is = getClass().getResourceAsStream(fileName);
+
+      if (is == null)
+         return null;
+
+      File outDir = getTestWorkDir();
+      File outFile = new File(outDir, fileName);
+      outDir.mkdirs();
+      copyAndClose(is, new FileOutputStream(outFile));
+
+      antBuildFile = outFile;
+      return outFile;
+   }
+
+   protected boolean expectAntBuildFile() throws IOException
+   {
+      File buildFile = findAntBuildFileForTest();
+
+      if (buildFile == null)
+      {
+         log.warn("Test specific ant build file not found: " + getAntBuildFileName() + ".");
+         return false;
+      }
+      return true;
+   }
+
+   protected Project prepareAntBuild() throws IOException
+   {
+      /*
+       * Example of how to embed ant:
+       * http://svn.apache.org/viewvc/maven/plugins/tags/maven-antrun-plugin-1.6/src/main/java/org/apache/maven/plugin/antrun/AntRunMojo.java?revision=1005612&view=markup
+       *
+       */
+      File mavenHome = getMavenHome();
+      if (mavenHome != null)
+         System.setProperty("maven.home", mavenHome.getAbsolutePath());
+
+      Project project = new Project();
+      File buildFile = findAntBuildFileForTest();
+      project.setUserProperty("ant.file", buildFile.getAbsolutePath());
+
+      Properties props = getActiveMavenProperties();
+      for (Map.Entry ent: props.entrySet())
+      {
+         String key = (String) ent.getKey();
+         // build.xml properties override pom.xml properties
+         if (project.getProperty(key) == null)
+         {
+            project.setInheritedProperty(key, (String) ent.getValue());
+         }
+      }
+
+      project.init();
+      ProjectHelper.configureProject(project, buildFile);
+      
+      DefaultLogger antLogger = new DefaultLogger();
+      antLogger.setOutputPrintStream( System.out );
+      antLogger.setErrorPrintStream( System.err );
+
+      String loggingLevel = project.getProperty("ant.logging.level");
+      antLogger.setMessageOutputLevel(getAntDebugLevel(loggingLevel));
+      project.addBuildListener( antLogger );
+
+      this.project = project;
+      return project;
+   }
+
+   protected int getAntDebugLevel(String loggingLevel)
+   {
+      loggingLevel = loggingLevel.toUpperCase();
+      if ("VERBOSE".equalsIgnoreCase(loggingLevel))
+         return Project.MSG_VERBOSE;
+      else if ("DEBUG".equals(loggingLevel))
+         return Project.MSG_DEBUG;
+      else if ("WARN".equals(loggingLevel))
+         return Project.MSG_WARN;
+      else if ("ERROR".equals(loggingLevel))
+         return Project.MSG_ERR;
+      else
+         return Project.MSG_INFO;
+   }
+
+   protected void executeAntBuild()
+   {
+      if (project == null)
+         throw new RuntimeException("Project not initialized. Call prepareAntBuild() first.");
+
+      String target = project.getDefaultTarget();
+      if (target == null)
+         throw new RuntimeException("No default target specified in ant build file: " + antBuildFile);
+
+      project.executeTarget(target);
+   }
+
+   protected void prepareAndExecuteAntBuild() throws IOException
+   {
+      prepareAntBuild();
+      executeAntBuild();
+   }
+}

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractTestCase.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractTestCase.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/AbstractTestCase.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,165 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+import com.thoughtworks.selenium.Selenium;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.log4testng.Logger;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public abstract class AbstractTestCase
+{
+
+   public Selenium selenium;
+
+   public String speed = "100";
+   public String timeout = "30000";
+   public int timeoutSecInt = 30;
+   public String browser = "firefox";
+   public String host = "localhost";
+   public String hostPort = "8080";
+   public String host2 = "localhost";
+   public String host2Port = "8080";
+   public String seleniumPort = "6666";
+   public String portalPath = "/portal/public/classic";
+   public boolean ieFlag = false;
+   public String wsrpVersion = "v1";
+
+   protected Logger log = Logger.getLogger(getClass());
+
+   protected static Properties propsMes;
+
+   static
+   {
+      try
+      {
+         propsMes = getProperties("org/jboss/gatein/selenium/messages.properties");
+      }
+      catch (Exception e)
+      {
+         e.printStackTrace();
+      }
+   }
+
+   protected static SeleniumContext currentSeleniumContext;
+
+   public static SeleniumContext getCurrentSeleniumContext()
+   {
+      return currentSeleniumContext;
+   }
+
+   public void setInitialTestParameters()
+   {
+      setTimeout();
+      setSpeed();
+   }
+
+   public void setTimeout()
+   {
+      selenium.setTimeout(timeout);
+   }
+
+   public void setSpeed()
+   {
+      selenium.setSpeed(speed);
+   }
+
+   @BeforeClass(alwaysRun = true)
+   public void setUp() throws Exception
+   {
+      initSystemProperties();
+      selenium = new DefaultSelenium("127.0.0.1", Integer.parseInt(seleniumPort), "*" + browser, "http://" + host + ":" + hostPort);
+      TestCaseFailListener.selenium = selenium;
+      selenium.start();
+      currentSeleniumContext = new SeleniumContext(selenium, timeout, portalPath, browser);
+      setInitialTestParameters(); // initialization of speed and timeout
+      selenium.windowMaximize(); // running tests in maximize window
+   }
+
+   @AfterClass(alwaysRun = true)
+   public void tearDown() throws Exception
+   {
+      selenium.stop();
+      currentSeleniumContext = null;
+   }
+
+   public void initSystemProperties()
+   {
+      browser = System.getProperty("selenium.browser", browser);
+      timeout = System.getProperty("selenium.timeout", timeout);
+      timeoutSecInt = Integer.parseInt(timeout) / 1000;
+      speed = System.getProperty("selenium.speed", speed);
+      host = System.getProperty("selenium.host", host);
+      hostPort = System.getProperty("selenium.host.port", hostPort);
+      host2 = System.getProperty("selenium.host2", host2);
+      host2Port = System.getProperty("selenium.host2.port", host2Port);
+      seleniumPort = System.getProperty("selenium.port", seleniumPort);
+      portalPath = System.getProperty("portal.path", portalPath);
+      wsrpVersion = System.getProperty("wsrp.version", wsrpVersion);
+      ieFlag = browser.contains("iexplore");
+   }
+
+   public static String getMessage(String property)
+   {
+      return getProperty(propsMes, property, null);
+   }
+
+   public static String getMessage(String property, String subst)
+   {
+      return getProperty(propsMes, property, subst);
+   }
+
+   private static String getProperty(Properties properties, String property,
+                                     String subst)
+   {
+
+      if (subst == null || "".equals(subst))
+      {
+         subst = "Substitude not set";
+      }
+
+      if (properties == null)
+      {
+         return subst;
+      }
+      else
+      {
+         String message = properties.getProperty(property);
+         return message != null ? message : subst;
+      }
+   }
+
+   private static Properties getProperties(String resource) throws IOException
+   {
+      ClassLoader cl = ClassLoader.getSystemClassLoader();
+      InputStream is = cl.getResourceAsStream(resource);
+      Properties props = new Properties();
+      props.load(is);
+      return props;
+   }
+}

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/SeleniumContext.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/SeleniumContext.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/SeleniumContext.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,69 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium;
+
+import com.thoughtworks.selenium.Selenium;
+
+public class SeleniumContext
+{
+
+   public Selenium getSelenium()
+   {
+      return selenium;
+   }
+
+   public String getTimeout()
+   {
+      return timeout;
+   }
+
+   public int getTimeoutSecInt()
+   {
+      return timeoutSecInt;
+   }
+
+   public String getPortalPath()
+   {
+      return portalPath;
+   }
+
+   public String getBrowser()
+   {
+      return browser;
+   }
+
+   private Selenium selenium;
+   private String timeout;
+   private int timeoutSecInt;
+   private String portalPath;
+   private String browser;
+
+   public SeleniumContext(Selenium selenium, String timeout, String portalPath, String browser)
+   {
+      this.selenium = selenium;
+      this.timeout = timeout;
+      this.timeoutSecInt = Integer.parseInt(timeout) / 1000;
+      this.portalPath = portalPath;
+      this.browser = browser;
+   }
+}

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/TestCaseFailListener.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/TestCaseFailListener.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/TestCaseFailListener.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,168 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium;
+
+import com.thoughtworks.selenium.Selenium;
+import com.thoughtworks.selenium.SeleniumException;
+import org.testng.ITestResult;
+import org.testng.TestListenerAdapter;
+
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+/**
+ * The listener interface for receiving AbstractTestCase events.
+ * The class that is interested in processing a AbstractTestCase
+ * event implements this interface, and the object created
+ * with that class is registered with a component using the
+ * component's <code>addTestCaseFailListener<code> method. When
+ * the AbstractTestCase event occurs, that object's appropriate
+ * method is invoked. <br/>
+ * TestCaseFailListener is responsible for decoding most of the parameters which are passed to selenium tests.
+ * <table>
+ * <thead>
+ * <tr>
+ * <th>parameter name</th>
+ * <th>valid values</th>
+ * <th>default value</th>
+ * <th>description</th>
+ * </tr>
+ * </thead>
+ * <tr>
+ * <td>screenshot</td>
+ * <td>true/false</td>
+ * <td>false</td>
+ * <td>If true, screenshots are taken after the test failure. They are saved into directory specified by the "output-dir" parameter.</td>
+ * </tr><tr>
+ * <td>html-src</td><td>true/false</td><td>false</td><td>If true, html sources are taken after the test failure. They are saved into directory specified by the "output" parameter.</td>
+ * </tr><tr>
+ * <td>output-dir</td><td>&#60;path-to-dir&#62;</td><td>""</td><td>Path to the directory where html sources and screenshots are saved.</td>
+ * </tr>
+ * </table>
+ */
+public class TestCaseFailListener extends TestListenerAdapter
+{
+
+   public static Selenium selenium;
+   protected static int count;
+   protected static boolean screenshot = false;
+   protected static boolean htmlSource = false;
+   protected static String outputDir = "";
+
+   static
+   {
+      String ss = System.getProperty("screenshot");
+      if ("true".equals(ss))
+      {
+         screenshot = true;
+      }
+
+      String sh = System.getProperty("html-src");
+      if ("true".equals(sh))
+      {
+         htmlSource = true;
+      }
+
+      String so = System.getProperty("output-dir");
+      if (so != null)
+      {
+         outputDir = so;
+      }
+   }
+
+   /* (non-Javadoc)
+     * @see org.testng.TestListenerAdapter#onTestFailure(org.testng.ITestResult)
+     */
+
+   @Override
+   public void onTestFailure(ITestResult tr)
+   {
+
+      String name = outputDir + "/" + "F_" + tr.getName() + "-" + count;
+
+      if (screenshot)
+      {
+         try
+         {
+            selenium.windowMaximize();
+            waitFor(5000);
+            selenium.captureScreenshot(name + ".jpg");
+         }
+         catch (SeleniumException e2)
+         {
+            e2.printStackTrace();
+         }
+      }
+
+      if (htmlSource)
+      {
+         try
+         {
+            PrintWriter out = new PrintWriter(new BufferedWriter(new FileWriter(name + ".html")));
+            out.println(selenium.getHtmlSource());
+            out.close();
+         }
+         catch (IOException e1)
+         {
+            e1.printStackTrace();
+         }
+      }
+      count++;
+   }
+
+   /**
+    * Waits for specified time in ms. Used mostly in AJAX based tests.
+    *
+    * @param time the time (in ms) to be waited for.
+    */
+   public void waitFor(long time)
+   {
+      try
+      {
+         Thread.sleep(time);
+      }
+      catch (InterruptedException e)
+      {
+         e.printStackTrace();
+      }
+   }
+
+   public static void captureScreenshot(String testName)
+   {
+      String name = outputDir + "/" + "F_" + testName;
+      if (screenshot)
+      {
+         try
+         {
+            selenium.captureScreenshot(name + ".jpg");
+         }
+         catch (SeleniumException e)
+         {
+            e.printStackTrace();
+         }
+      }
+	}
+
+}

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/TestMethodSelector.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/TestMethodSelector.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/TestMethodSelector.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,62 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium;
+
+
+import org.apache.commons.lang.StringUtils;
+import org.testng.IAnnotationTransformer;
+import org.testng.annotations.ITestAnnotation;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+public class TestMethodSelector implements IAnnotationTransformer
+{
+
+   /**
+    * Disables the test methods which doesn't match the given method name.
+    */
+   @SuppressWarnings("unchecked")
+   public void transform(ITestAnnotation annotation, Class testClass, Constructor testConstructor, Method testMethod)
+   {
+      String[] selectedMethods = System.getProperty("method", "*").split(",");
+
+      String methodName = testMethod.getDeclaringClass().getCanonicalName() + "." + testMethod.getName();
+      boolean match = false;
+
+      for (String selectedMethod : selectedMethods)
+      {
+
+         selectedMethod = StringUtils.replace(selectedMethod, "*", ".*");
+
+         if (methodName.matches(selectedMethod))
+         {
+            match = true;
+            break;
+         }
+      }
+
+      annotation.setEnabled(match);
+
+   }
+}

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/build/BuildHelper.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/build/BuildHelper.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/build/BuildHelper.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,66 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium.build;
+
+import org.apache.tools.ant.taskdefs.Execute;
+
+import java.io.File;
+import java.util.List;
+
+public class BuildHelper
+{
+
+   public static File getMavenHome()
+   {
+
+      String mavenHome = null;
+
+      List<String> env = Execute.getProcEnvironment();
+      for (String var : env)
+      {
+         if (var.startsWith("M2_HOME="))
+         {
+            mavenHome = var.substring("M2_HOME=".length());
+            break;
+         }
+      }
+
+      if (mavenHome != null)
+      {
+         File mFile = new File(mavenHome);
+         if (!mFile.isDirectory())
+         {
+            mavenHome = System.getProperty("maven.home");
+            if (mavenHome != null)
+            {
+               mFile = new File(mavenHome);
+            }
+         }
+         if (mFile.isDirectory())
+         {
+            return mFile;
+         }
+      }
+      return null;
+   }
+}
\ No newline at end of file

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/common/CommonHelper.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/common/CommonHelper.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/common/CommonHelper.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,643 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium.common;
+
+import com.thoughtworks.selenium.SeleniumException;
+import org.jboss.gatein.selenium.AbstractContextual;
+import org.testng.Assert;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+public class CommonHelper extends AbstractContextual
+{
+
+   public static void waitForElementPresent(String element) throws Exception
+   {
+      setUp();
+
+      for (int second = 0; ; second++)
+      {
+         if (second >= timeoutSecInt)
+         {
+            Assert.fail("Timeout at waitForElementPresent: " + element);
+         }
+         try
+         {
+            if (selenium.isElementPresent(element))
+            {
+               break;
+            }
+         }
+         catch (Exception e)
+         {
+         }
+         Thread.sleep(1000);
+      }
+   }
+
+   public static void waitForTextPresent(String text) throws Exception
+   {
+      setUp();
+
+      for (int second = 0; ; second++)
+      {
+         if (second >= timeoutSecInt)
+         {
+            Assert.fail("Timeout at waitForTextPresent: " + text);
+         }
+         try
+         {
+            if (ieFlag)
+            {
+               if (selenium.isElementPresent("//*[contains(text(), '" + text + "')]") && selenium.isVisible("//*[contains(text(), '" + text + "')]"))
+               {
+                  break;
+               }
+            }
+            else
+            {
+               if (selenium.isTextPresent(text))
+               {
+                  break;
+               }
+            }
+         }
+         catch (Exception e)
+         {
+         }
+         Thread.sleep(1000);
+      }
+   }
+
+   public static void waitForTextNotPresent(String text) throws Exception
+   {
+      setUp();
+
+      for (int second = 0; ; second++)
+      {
+         if (second >= timeoutSecInt)
+         {
+            Assert.fail("Timeout at waitForTextNotPresent: " + text);
+         }
+         try
+         {
+            if (ieFlag)
+            {
+               if (!selenium.isElementPresent("//*[contains(text(), '" + text + "')]") || !selenium.isVisible("//*[contains(text(), '" + text + "')]"))
+               {
+                  break;
+               }
+            }
+            else
+            {
+               if (!selenium.isTextPresent(text))
+               {
+                  break;
+               }
+            }
+         }
+         catch (Exception e)
+         {
+         }
+         Thread.sleep(1000);
+      }
+   }
+
+   public static void waitForElementNotPresent(String element) throws Exception
+   {
+      setUp();
+
+      for (int second = 0; ; second++)
+      {
+         if (second >= timeoutSecInt)
+         {
+            Assert.fail("Timeout at waitForElementNotPresent: " + element);
+         }
+         try
+         {
+            if (!selenium.isElementPresent(element))
+            {
+               break;
+            }
+         }
+         catch (Exception e)
+         {
+         }
+         Thread.sleep(1000);
+      }
+   }
+
+   public static void waitForConfirmation(String confirmationText) throws Exception
+   {
+      setUp();
+
+      for (int second = 0; ; second++)
+      {
+         if (second >= timeoutSecInt)
+         {
+            Assert.fail("Timeout at waitForConfirmation: " + confirmationText);
+         }
+         try
+         {
+            if (selenium.getConfirmation().equals(confirmationText))
+            {
+               break;
+            }
+         }
+         catch (Exception e)
+         {
+         }
+         Thread.sleep(1000);
+      }
+   }
+
+   public static String getText(String element) throws Exception
+   {
+      setUp();
+
+      return selenium.getText(element);
+   }
+
+   public static boolean isTextPresent(String text) throws Exception
+   {
+      setUp();
+
+      if (ieFlag)
+      {
+         return selenium.isElementPresent("//*[contains(text(), '" + text + "')]") && selenium.isVisible("//*[contains(text(), '" + text + "')]");
+      }
+      else
+      {
+         return selenium.isTextPresent(text);
+      }
+   }
+
+   public static boolean isTextNotPresent(String text) throws Exception
+   {
+      setUp();
+
+      if (ieFlag)
+      {
+         return !selenium.isElementPresent("//*[contains(text(), '" + text + "')]") || !selenium.isVisible("//*[contains(text(), '" + text + "')]");
+      }
+      else
+      {
+         return !selenium.isTextPresent(text);
+      }
+   }
+
+   public static boolean isElementPresent(String element) throws Exception
+   {
+      setUp();
+
+      return selenium.isElementPresent(element);
+   }
+
+   public static boolean isElementNotPresent(String element) throws Exception
+   {
+      setUp();
+
+      return !selenium.isElementPresent(element);
+   }
+
+   public static boolean isOrdered(String element1, String element2)
+   {
+      setUp();
+
+      return selenium.isOrdered(element1, element2);
+   }
+
+   public static void waitForPageToLoad(String timeout)
+   {
+      setUp();
+
+      selenium.waitForPageToLoad(timeout);
+   }
+
+   public static void dragAndDropToObject(String source, String target)
+   {
+      setUp();
+
+      System.out.println("--Drag and drop to object--");
+      selenium.dragAndDropToObject(source, target);
+   }
+
+   public static void dragAndDrop(String source, String movementString)
+   {
+      setUp();
+
+      System.out.println("--Drag and drop--");
+      selenium.dragAndDrop(source, movementString);
+   }
+
+   public static void contextMenuOnElement(String element)
+   {
+      selenium.getEval("selenium.doComponentExoContextMenu(\"" + element + "\")");
+   }
+
+   public static void doubleClickOnElement(String element)
+   {
+      selenium.getEval("selenium.doComponentExoDoubleClick(\"" + element + "\")");
+   }
+
+   public static void keyPressOnElement(String element, String key)
+   {
+      selenium.keyPress(element, key);
+   }
+
+   public static void open(String location)
+   {
+      setUp();
+
+      System.out.println("--Opening location " + location + "--");
+      long start = System.currentTimeMillis();
+      RuntimeException re = null;
+      do
+      {
+         try
+         {
+            selenium.open(location);
+            return;
+         }
+         catch (SeleniumException ex)
+         {
+            if (!ex.getMessage().startsWith("Timed out"))
+            {
+               throw ex;
+            }
+            re = ex;
+         }
+      }
+      while (System.currentTimeMillis() - start < timeoutSecInt * 1000);
+
+      if (re != null)
+      {
+         throw re;
+      }
+   }
+
+   public static void click(String element)
+   {
+      setUp();
+
+      selenium.click(element);
+   }
+
+   public static void type(String element, String value)
+   {
+      setUp();
+
+      selenium.type(element, value);
+   }
+
+   public static void select(String element, String option)
+   {
+      setUp();
+
+      selenium.select(element, option);
+   }
+
+   public static void check(String element)
+   {
+      setUp();
+
+      selenium.check(element);
+   }
+
+   public static boolean isCheck(String element)
+   {
+      setUp();
+
+      return selenium.isChecked(element);
+   }
+
+   public static void uncheck(String element)
+   {
+      setUp();
+
+      selenium.uncheck(element);
+   }
+
+   public static void fireEvent(String element, String event)
+   {
+      setUp();
+
+      selenium.fireEvent(element, event);
+   }
+
+   public static void mouseOver(String element)
+   {
+      setUp();
+
+      selenium.mouseOver(element);
+   }
+
+   public static void pause(long timeInMillis)
+   {
+      try
+      {
+         Thread.sleep(timeInMillis);
+      }
+      catch (InterruptedException e)
+      {
+         e.printStackTrace();
+      }
+   }
+
+   public static String getValue(String element)
+   {
+      setUp();
+
+      return selenium.getValue(element);
+   }
+
+   public static String getXpathCount(String element)
+   {
+      setUp();
+
+      return selenium.getXpathCount(element).toString();
+   }
+
+   public static boolean isTextAtElementEqual(String element, String text) throws Exception
+   {
+      setUp();
+
+      return getText(element).equals(text);
+   }
+
+
+   public static void openPortal(boolean publicMode)
+   {
+      setUp();
+
+      open(publicMode ? portalPath : portalPath.replace("public", "private"));
+   }
+
+   public static void signInAsRoot() throws Exception
+   {
+      signIn("root", "gtn");
+   }
+
+   public static void signInAsJohn() throws Exception
+   {
+      signIn("john", "gtn");
+   }
+
+   public static void signInAsMary() throws Exception
+   {
+      signIn("mary", "gtn");
+   }
+
+   public static void signInAsDemo() throws Exception
+   {
+      signIn("demo", "gtn");
+   }
+
+   public static void signIn(String username, String password) throws Exception
+   {
+      setUp();
+
+      System.out.println("--Signing  in as " + username + "--");
+      waitForElementPresent("link=Sign in");
+      click("link=Sign in");
+      waitForElementPresent("username");
+      type("username", username);
+      type("password", password);
+      click("//div[@id='UIPortalLoginFormAction']/div/div/div/a");
+      waitForPageToLoad(timeout);
+   }
+
+   public static void signInWithRememberChecked(String username, String password) throws Exception
+   {
+      setUp();
+
+      System.out.println("--Signing  in as " + username + " with checked remember me--");
+      waitForElementPresent("link=Sign in");
+      click("link=Sign in");
+      waitForElementPresent("username");
+      type("username", username);
+      type("password", password);
+      System.out.println("--Check \"remember my login\"");
+      click("rememberme");
+      click("//div[@id='UIPortalLoginFormAction']/div/div/div/a");
+      waitForPageToLoad(timeout);
+   }
+
+   public static void signOut() throws Exception
+   {
+      setUp();
+
+      signOutWithLanguage("Sign out");
+   }
+
+   public static void signOutWithLanguage(String signOutLabel) throws Exception
+   {
+      setUp();
+
+      System.out.println("--Signing out--");
+      waitForElementPresent("link=" + signOutLabel);
+      click("link=" + signOutLabel);
+      waitForPageToLoad(timeout);
+   }
+
+   public static void goToApplicationRegistry() throws Exception
+   {
+      setUp();
+
+      System.out.println("--Go to App.registry--");
+      waitForElementPresent("link=Application Registry");
+      click("link=Application Registry");
+      waitForPageToLoad(timeout);
+   }
+
+   public static void goToPageManagement() throws Exception
+   {
+      setUp();
+
+      System.out.println("--Go to Page Management--");
+      waitForElementPresent("link=Page Management");
+      click("link=Page Management");
+      waitForPageToLoad(timeout);
+   }
+
+   public static void goToUsersManagement() throws Exception
+   {
+      setUp();
+
+      System.out.println("--Go to Users and groups management--");
+      waitForElementPresent("link=Users and groups management");
+      click("link=Users and groups management");
+      waitForPageToLoad(timeout);
+   }
+
+   public static void goToNewStaff() throws Exception
+   {
+      setUp();
+
+      System.out.println("--Go to New Staff--");
+      waitForElementPresent("link=New Staff");
+      click("link=New Staff");
+      waitForPageToLoad(timeout);
+   }
+
+   public static void goToSiteManagement() throws Exception
+   {
+      setUp();
+
+      System.out.println("--Go to Site Management--");
+      waitForElementPresent("link=Site");
+      click("link=Site");
+      waitForPageToLoad(timeout);
+   }
+
+   public static void goToGroupManagement() throws Exception
+   {
+      setUp();
+
+      System.out.println("--Go to Group Management--");
+      waitForElementPresent("link=Group");
+      click("link=Group");
+      waitForPageToLoad(timeout);
+   }
+
+   public static void goToDashboard() throws Exception
+   {
+      setUp();
+
+      System.out.println("--Go to Dashboard--");
+      waitForElementPresent("link=Dashboard");
+      click("link=Dashboard");
+      waitForPageToLoad(timeout);
+   }
+
+   public static void goToClassicPortal() throws Exception
+   {
+      setUp();
+
+      System.out.println("--Go to portal classic--");
+      waitForElementPresent("link=classic");
+      click("link=classic");
+      waitForPageToLoad(timeout);
+   }
+
+   public static void goToPage(String pageLabel) throws Exception
+   {
+      setUp();
+
+      System.out.println("--Go to page: " + pageLabel + "--");
+      waitForElementPresent("link=" + pageLabel);
+      click("link=" + pageLabel);
+      waitForPageToLoad(timeout);
+   }
+
+   public static void closeMessageDialog() throws Exception
+   {
+      System.out.println("--Closing message dialog--");
+      waitForElementPresent("//div[@id='UIPortalApplication']/div[@class='UIPopupWindow UIDragObject']//div[@class='MiddleLeftSideDecorator']//div[@class='UIPopupMessages']/div[@class='MessageActionBar']//a");
+      click("//div[@id='UIPortalApplication']/div[@class='UIPopupWindow UIDragObject']//div[@class='MiddleLeftSideDecorator']//div[@class='UIPopupMessages']/div[@class='MessageActionBar']//a");
+   }
+
+   public static void waitForMessage(String message) throws Exception
+   {
+      System.out.println("--Verify message: " + message);
+      waitForElementPresent("//div[@class='PopupMessage']");
+      waitForTextPresent(message);
+   }
+
+   public static void waitForPopupElementWithMessage(String message) throws Exception
+   {
+      System.out.println("--Verify message: " + message);
+      waitForElementPresent("//div[@class='PopupMessage']");
+      String value = getText("//div[@class='PopupMessage']");
+      if (!value.contains(message))
+      {
+         throw new Exception("Message to verify is not valid, current message value is: " + value);
+      }
+   }
+
+   public static void assertConfirmation(String msg) throws Exception
+   {
+      Assert.assertTrue(selenium.getConfirmation().matches("^" + msg + "$"));
+   }
+
+   public static void verifyTextPresent(String text) throws Exception
+   {
+      Assert.assertTrue(selenium.isTextPresent(text));
+   }
+
+   public static void importApplications() throws Exception
+   {
+      System.out.println("--Import applications--");
+      waitForElementPresent("//div[@id='UIApplicationRegistryPortlet']/div[2]/div[2]/div/div/div[2]");
+      click("//div[@id='UIApplicationRegistryPortlet']/div[2]/div[2]/div/div/div[2]");
+      assertConfirmation("This action will automatically create categories and import all the gadgets and portlets on it.");
+   }
+
+   public static void verifyPortletInstalled(String appName, String portletName) throws Exception
+   {
+      System.out.println("--Verify portlet is installed: " + appName + "/" + portletName + "--");
+      waitForElementPresent("link=" + appName);
+      click("link=" + appName);
+      waitForTextPresent(portletName);
+      verifyTextPresent(portletName);
+   }
+
+   public static void echo(String msg)
+   {
+      System.out.println(msg);
+   }
+
+   /**
+    * Copy input to output.
+    *
+    * @param in  the input
+    * @param out the output
+    * @throws IOException for any I/O error
+    */
+   public static void copyAndClose(InputStream in, OutputStream out) throws IOException
+   {
+      try
+      {
+         byte[] buf = new byte[20000];
+         int rc;
+         while ((rc = in.read(buf)) != -1)
+         {
+            out.write(buf, 0, rc);
+         }
+         out.flush();
+         out.close();
+      }
+      finally
+      {
+         try
+         {
+            in.close();
+         }
+         catch (Exception ignored)
+         {
+         }
+      }
+   }
+}

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/jira/Test_GTNPORTAL_1257_SeamSessionOutlivesTheGateInSession.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/jira/Test_GTNPORTAL_1257_SeamSessionOutlivesTheGateInSession.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/jira/Test_GTNPORTAL_1257_SeamSessionOutlivesTheGateInSession.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,208 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium.jira;
+
+import static org.jboss.gatein.selenium.common.CommonHelper.*;
+import static org.jboss.gatein.selenium.navigation.NavigationHelper.*;
+import static org.jboss.gatein.selenium.page.PageHelper.*;
+
+import org.jboss.gatein.selenium.AbstractContextual;
+import org.jboss.gatein.selenium.AbstractSingleTestWithAnt;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+/**
+ * @author <a href="mailto:mstrukel at redhat.com">Marko Strukelj</a>
+ */
+public class Test_GTNPORTAL_1257_SeamSessionOutlivesTheGateInSession extends AbstractSingleTestWithAnt
+{
+
+   @BeforeTest(alwaysRun = true)
+   public void deploySeamBooking() throws Exception
+   {
+
+      if (!expectAntBuildFile())
+      {
+         log.warn("JBoss Portlet Bridge Seam Booking example may not be available");
+         return;
+      }
+
+      prepareAndExecuteAntBuild();
+   }
+
+   @Test(groups = {"GateIn", "jira"})
+   public void testGTNPORTAL_1257_SeamSessionOutlivesTheGateInSession() throws Throwable
+   {
+      performTest();
+   }
+
+   @Override
+   protected void mainTest() throws Throwable
+   {
+      try
+      {
+         AbstractContextual.setTemporaryTimeoutSecInt(60);        // give it at least one minute
+         openPortal(true);
+      }
+      finally
+      {
+         AbstractContextual.restoreTimeoutSecInt();
+      }
+
+      signInAsRoot();
+
+      goToApplicationRegistry();
+
+      installPortlet();
+
+      goToPage("Home");
+
+      try
+      {
+         AbstractContextual.setTemporaryTimeoutSecInt(60);        // give it at least one minute
+         addNewPageWithEditor(null, "TestPage", "TestPage", "portalBookingDemo", "seamBookingPortlet",
+               "//div[@id='portalBookingDemo/seamBookingPortlet']");
+      }
+      catch (Throwable th)
+      {
+         try
+         {
+            leavePageEdit();
+         }
+         catch (Exception ex)
+         {
+            log.warn("IGNORED: ", ex);
+         }
+         throw th;
+      }
+      finally
+      {
+         AbstractContextual.restoreTimeoutSecInt();
+      }
+
+      waitForTextPresent("Search Hotels");
+
+      verifyTextPresent("Welcome, root");
+
+      signOut();
+
+      signInAsMary();
+
+      goToPage("TestPage");
+
+      waitForTextPresent("Search Hotels");
+      verifyTextPresent("Welcome, mary");
+
+   }
+
+   private void leavePageEdit()
+   {
+      // we could have an error window popped up
+      String closeButton = "//div[@class='ExoMessageDecorator' and //div[@class='TabsContainer']//div[@class='SelectedTab']]//div[@class='CloseButton']";
+      click(closeButton);
+
+      // also we may have to abort
+      String abortButton = "//table[@class='ActionContainer']//div[contains(@onclick, 'action=Abort')]//a[text()='Abort']";
+      click(abortButton);
+   }
+
+   private void installPortlet() throws Throwable
+   {
+      // try several times - to give dependency deployment some time
+      Throwable ex = null;
+      for (int i = 0; i < 3; i++)
+      {
+         importApplications();
+         try
+         {
+            verifyPortletInstalled("portalBookingDemo", "seamBookingPortlet");
+            return;
+         }
+         catch (Throwable th)
+         {
+            ex = th;
+         }
+      }
+      throw ex;
+   }
+
+   @Override
+   protected void exception(Throwable ex)
+   {
+      log.error("Exception during test: ", ex);
+   }
+
+   @Override
+   protected void cleanup()
+   {
+      System.out.println("\n== Cleanup ==");
+
+      try
+      {
+         signOut();
+      }
+      catch (Throwable e)
+      {
+         log.warn("IGNORED: Failed to sign out: ", e);
+      }
+
+      try
+      {
+         signInAsRoot();
+      }
+      catch (Throwable e)
+      {
+         log.warn("IGNORED: Failed to sign in as root: ", e);
+      }
+
+      try
+      {
+         goToPageManagement();
+         searchAndDeletePage("TestPage");
+      }
+      catch (Throwable e)
+      {
+         log.warn("IGNORED: Failed to delete testPage: ", e);
+      }
+
+      try
+      {
+         goToSiteManagement();
+         editNavigation("classic");
+         deleteNode("TestPage");
+      }
+      catch (Throwable e)
+      {
+         log.warn("IGNORED: Failed to remove TestPage from navigation: ", e);
+      }
+
+      try
+      {
+         signOut();
+      }
+      catch (Throwable e)
+      {
+         log.warn("IGNORED: Failed to sign out: ", e);
+      }
+   }
+}
\ No newline at end of file

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/messages.properties
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/messages.properties	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/messages.properties	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,49 @@
+#
+# JBoss, Home of Professional Open Source.
+# Copyright 2010, Red Hat Middleware LLC, and individual contributors
+# as indicated by the @author tags. See the copyright.txt file in the
+# distribution for a full listing of individual contributors.
+#
+# This is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as
+# published by the Free Software Foundation; either version 2.1 of
+# the License, or (at your option) any later version.
+#
+# This software 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 software; if not, write to the Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+# 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+#
+
+language.signout.label.vietnamese=\u0110\u0103ng xu\u1EA5t
+language.home.label.vietnamese=Trang ch\u1EE7
+language.label.english.vietnamese=Ti\u1EBFng Anh
+language.changelanguage.label.vietnamese=Thay \u0111\u1ED5i ng\u00F4n ng\u1EEF
+language.apply.button.label.vietnamese=\u00C1p d\u1EE5ng
+language.home.label.french=Accueil
+language.signout.label.french=D\u00E9connexion
+language.label.english.french=Anglais
+language.changelanguage.label.french=Changer la langue
+language.apply.button.label.french=Appliquer
+language.signout.label.german=Abmelden
+language.home.label.german=Startseite
+language.label.english.german=Englisch
+language.changelanguage.label.german=Sprache wechseln
+language.apply.button.label.german=Anwenden
+language.signout.label.italian=Uscita
+language.sitemap.label.italian=Mappa del Sito
+language.label.english.italian=Inglese
+language.changelanguage.label.italian=Cambia Lingua
+language.apply.button.label.italian=Applica
+language.home.label.russian=\u0413\u043B\u0430\u0432\u043D\u0430\u044F
+language.signout.label.russian=\u0412\u044B\u0439\u0442\u0438
+language.signout.label.dutch=Uitloggen
+language.signout.label.spanish=Desconectar
+language.home.label.spanish=Inicio
+passwordconfirm.copiedvalue=\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF\u25CF
+

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/navigation/NavigationHelper.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/navigation/NavigationHelper.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/navigation/NavigationHelper.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,204 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium.navigation;
+
+import org.jboss.gatein.selenium.AbstractContextual;
+import org.testng.Assert;
+
+import static org.jboss.gatein.selenium.common.CommonHelper.*;
+
+public class NavigationHelper extends AbstractContextual
+{
+
+   public static enum CopyType
+   {
+      COPY, CUT, CLONE;
+   }
+
+   public static void addNewNode(String nodeName, String nodeLabel, boolean useLink, String elementToAddWithRightClick, String pageName, String pageTitle, boolean verifyPage, boolean verifyNode) throws Exception
+   {
+      System.out.println("--Adding new node at navigation--");
+      editNavigation();
+      if (useLink)
+      {
+         waitForElementPresent("link=Add Node");
+         click("link=Add Node");
+      }
+      else
+      {
+         waitForElementPresent(elementToAddWithRightClick);
+         click(elementToAddWithRightClick);
+         pause(2000);
+         contextMenuOnElement(elementToAddWithRightClick);
+         pause(3000);
+         waitForElementPresent("//div[@id='UINavigationManagement']/div[2]/div[3]/div/div/div/div/div/div/div/div[2]/div/div/div//a");
+         click("//div[@id='UINavigationManagement']/div[2]/div[3]/div/div/div/div/div/div/div/div[2]/div/div/div//a");
+      }
+      waitForTextPresent("Page Node Setting");
+      waitForElementPresent("name");
+      type("name", nodeName);
+      type("label", nodeLabel);
+      waitForElementPresent("//div[text() = 'Page Selector']");
+      click("//div[text() = 'Page Selector']");
+      pause(3000);
+      if (pageName != null & pageTitle != null)
+      {
+         System.out.println("--Create new page");
+         waitForElementPresent("pageName");
+         type("pageName", pageName);
+         type("pageTitle", pageTitle);
+         waitForElementPresent("link=Create Page");
+         click("link=Create Page");
+         if (verifyPage)
+         {
+            waitForElementNotPresent("link=Create Page");
+         }
+         else
+         {
+            return;
+         }
+      }
+      else
+      {
+         System.out.println("--Select Page");
+         waitForElementPresent("link=Search and Select Page");
+         click("link=Search and Select Page");
+         waitForElementPresent("//div[@id='UIRepeater']//table//tbody/tr/td[5]/div[@class='ActionContainer']/img");
+         click("//div[@id='UIRepeater']//table//tbody/tr/td[5]/div[@class='ActionContainer']/img");
+      }
+      System.out.println("--Save");
+      waitForElementPresent("link=Save");
+      click("link=Save");
+      if (verifyNode)
+      {
+         waitForTextNotPresent("Page Node Setting");
+         if (elementToAddWithRightClick != null)
+         {
+            waitForElementPresent(elementToAddWithRightClick);
+            click(elementToAddWithRightClick);
+         }
+         waitForElementPresent("//a[@title='" + nodeLabel + "']");
+         waitForElementPresent("link=Save");
+         click("link=Save");
+         waitForTextNotPresent("Navigation Management");
+         waitForElementPresent("link=" + nodeLabel);
+      }
+   }
+
+   public static void deleteNode(String nodeLabel, String navigation) throws Exception
+   {
+      System.out.println("--Deleting node from navigation--");
+      editNavigation();
+      if (navigation != null)
+      {
+         String[] nav = navigation.split("/");
+         for (String navig : nav)
+         {
+            waitForElementPresent("//a[@title='" + navig + "']");
+            click("//a[@title='" + navig + "']");
+         }
+      }
+      deleteNode(nodeLabel);
+   }
+
+   public static void deleteNode(String nodeLabel) throws Exception
+   {
+      System.out.println("--Deleting node from navigation--");
+      waitForElementPresent("//a[@title='" + nodeLabel + "']");
+      pause(2000);
+      contextMenuOnElement("//a[@title='" + nodeLabel + "']");
+      pause(3000);
+      waitForElementPresent("//div[@id='UINavigationNodeSelector']//div[@id='NavigationNodePopupMenu']//a[@class='ItemIcon DeleteNode16x16Icon']");
+      click("//div[@id='UINavigationNodeSelector']//div[@id='NavigationNodePopupMenu']//a[@class='ItemIcon DeleteNode16x16Icon']");
+      waitForConfirmation("Are you sure you want to delete this node?");
+      waitForElementNotPresent("//a[@title='" + nodeLabel + "']");
+      waitForElementPresent("link=Save");
+      click("link=Save");
+      waitForTextNotPresent("Navigation Management");
+      waitForTextNotPresent(nodeLabel);
+   }
+
+   public static void editNavigation() throws Exception
+   {
+      waitForElementPresent("link=Edit Navigation");
+      click("link=Edit Navigation");
+      waitForTextPresent("Navigation Management");
+   }
+
+   public static void editNavigation(String site) throws Exception
+   {
+      System.out.println("--Edit Navigation : " + site + "--");
+      String navLink = "//table[@class='ManagementBlock' and //tr/td/div/text() = '"
+            + site + "']//a[text() = 'Edit Navigation']";
+      waitForElementPresent(navLink);
+      click(navLink);
+      waitForElementPresent("link=Add Node");
+   }
+
+   public static void copyNode(CopyType type, String navigation, String nodeLabel, String pasteToElement, String verifyElement) throws Exception
+   {
+      System.out.println("--" + ("COPY".equals(type.name()) ? "Copy" : "Cut") + " a node--");
+      if (navigation != null)
+      {
+         String[] nav = navigation.split("/");
+         for (String navig : nav)
+         {
+            waitForElementPresent("//a[@title='" + navig + "']");
+            click("//a[@title='" + navig + "']");
+         }
+      }
+      waitForElementPresent("//a[@title='" + nodeLabel + "']");
+      pause(2000);
+      contextMenuOnElement("//div[@id='UINavigationNodeSelector']//a[@class='NodeIcon DefaultPageIcon' and @title='" + nodeLabel + "']");
+      pause(3000);
+      switch (type)
+      {
+         case COPY:
+            waitForElementPresent("link=Copy Node");
+            click("link=Copy Node");
+            break;
+         case CUT:
+            waitForElementPresent("link=Cut Node");
+            click("link=Cut Node");
+            break;
+         case CLONE:
+            waitForElementPresent("link=Clone Node");
+            click("link=Clone Node");
+            break;
+         default:
+            break;
+      }
+      System.out.println("--Paste a node--");
+      waitForElementPresent(pasteToElement);
+      pause(2000);
+      contextMenuOnElement(pasteToElement);
+      pause(3000);
+      waitForElementPresent("//div[@id='UINavigationNodeSelector']//div[@id='NavigationNodePopupMenu']//a[@class='ItemIcon PasteNode16x16Icon']");
+      click("//div[@id='UINavigationNodeSelector']//div[@id='NavigationNodePopupMenu']//a[@class='ItemIcon PasteNode16x16Icon']");
+      if (verifyElement != null)
+      {
+         waitForElementPresent(verifyElement);
+         Assert.assertTrue(isElementPresent(verifyElement));
+      }
+   }
+}

Added: portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/page/PageHelper.java
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/page/PageHelper.java	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/java/org/jboss/gatein/selenium/page/PageHelper.java	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,249 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.gatein.selenium.page;
+
+import org.jboss.gatein.selenium.AbstractContextual;
+
+import static org.jboss.gatein.selenium.common.CommonHelper.*;
+
+public class PageHelper extends AbstractContextual
+{
+
+   public static enum PageType
+   {
+      USER, PORTAL, GROUP;
+   }
+
+   public static void editPage() throws Exception
+   {
+      waitForElementPresent("link=Edit Page");
+      click("link=Edit Page");
+      waitForTextPresent("Page Editor");
+   }
+
+   public static void finishPageEdit() throws Exception
+   {
+      waitForElementPresent("//div[@id='UIPageEditor']/div[1]/div/div/div/a[2]");
+      click("//div[@id='UIPageEditor']/div[1]/div/div/div/a[2]");
+      waitForTextNotPresent("Page Editor");
+   }
+
+   public static void addNewPageWithEditorAtFirstLevel(String pageName, String displayName, String categoryTitle, String portletName, String portletElementToDnD) throws Exception
+   {
+      System.out.println("-- Add new page with editor at first level--");
+      waitForElementPresent("link=Add New Page");
+      click("link=Add New Page");
+      waitForElementPresent("//a[@class='LevelUpArrowIcon' and @title='Up Level']");
+      click("//a[@class='LevelUpArrowIcon' and @title='Up Level']");
+      pause(3000);
+      fillPageEditor(pageName, displayName, categoryTitle, portletName, portletElementToDnD);
+   }
+
+   public static void addNewPageWithEditorAtFirstLevelWithMorePortlets(String pageName, String displayName, String categoryTitle, String portletNameSWithPortletElements) throws Exception
+   {
+      System.out.println("-- Add new page with editor at first level with more portlets--");
+      waitForElementPresent("link=Add New Page");
+      click("link=Add New Page");
+      waitForElementPresent("//a[@class='LevelUpArrowIcon' and @title='Up Level']");
+      click("//a[@class='LevelUpArrowIcon' and @title='Up Level']");
+      pause(3000);
+      waitForElementPresent("pageName");
+      type("pageName", pageName);
+      type("pageDisplayName", displayName);
+      click("//table[@class='ActionContainer']/tbody/tr/td/div[2]");
+      waitForTextPresent("Empty Layout");
+      click("//table[@class='ActionContainer']/tbody/tr/td/div[2]");
+      if (categoryTitle != null & portletNameSWithPortletElements != null)
+      {
+         waitForElementPresent("//div[contains(@class, 'Tab')]/a[@title='" + categoryTitle + "']");
+         click("//div[contains(@class, 'Tab')]/a[@title='" + categoryTitle + "']");
+         String[] portlets = portletNameSWithPortletElements.split(";");
+         for (String portlet : portlets)
+         {
+            String[] portletAttributes = portlet.split("---");
+            waitForTextPresent(portletAttributes[0]);
+            pause(3000);
+            dragAndDropToObject(portletAttributes[1], "//div[@class='UIComponentBlock']");
+            pause(3000);
+         }
+      }
+      finishPageEdit();
+      waitForElementPresent("link=classic");
+   }
+
+   public static void addNewPageWithEditor(String navigation, String pageName, String displayName, String categoryTitle, String portletName, String portletElementToDnD) throws Exception
+   {
+      System.out.println("--Add new page with editor--");
+      waitForElementPresent("link=Add New Page");
+      click("link=Add New Page");
+      if (navigation != null)
+      {
+         String[] navig = navigation.split("/");
+         for (String nav : navig)
+         {
+            waitForElementPresent("//a[@title='" + nav + "']");
+            click("//a[@title='" + nav + "']");
+         }
+      }
+      pause(3000);
+      fillPageEditor(pageName, displayName, categoryTitle, portletName, portletElementToDnD);
+   }
+
+   private static void fillPageEditor(String pageName, String displayName, String categoryTitle, String portletName, String portletElementToDnD) throws Exception
+   {
+      waitForElementPresent("pageName");
+      type("pageName", pageName);
+      type("pageDisplayName", displayName);
+      click("//table[@class='ActionContainer']/tbody/tr/td/div[2]");
+      waitForTextPresent("Empty Layout");
+      click("//table[@class='ActionContainer']/tbody/tr/td/div[2]");
+      if (categoryTitle != null & portletName != null & portletElementToDnD != null)
+      {
+         waitForElementPresent("//div[contains(@class, 'Tab')]/a[@title='" + categoryTitle + "']");
+         click("//div[contains(@class, 'Tab')]/a[@title='" + categoryTitle + "']");
+         waitForTextPresent(portletName);
+         pause(3000);
+         dragAndDropToObject(portletElementToDnD, "//div[@class='UIComponentBlock']");
+         pause(3000);
+      }
+      finishPageEdit();
+      waitForElementPresent("link=classic");
+   }
+
+   public static void addNewPageAtPageManagement(String name, String title, PageType type, String groupId, String verifyText) throws Exception
+   {
+      System.out.println("-- Add new " + type.name() + " page at page management--");
+      waitForElementPresent("xpath=//div[@id='UIPageBrowser']/div[2]/table/tbody/tr/td/div/div/div/div/a");
+      click("xpath=//div[@id='UIPageBrowser']/div[2]/table/tbody/tr/td/div/div/div/div/a");
+      waitForTextPresent("Page Setting");
+      waitForElementPresent("name");
+      type("name", name);
+      type("title", title);
+
+      switch (type)
+      {
+         case USER:
+            break;
+         case PORTAL:
+            waitForElementPresent("ownerType");
+            select("ownerType", "label=portal");
+            waitForElementPresent("//option[@value='portal']");
+            waitForElementPresent("//div[@onclick=\"eXo.webui.UIHorizontalTabs.changeTabForUIFormTabpane(this, 'UIPageForm', 'PermissionSetting');javascript:eXo.webui.UIForm.submitEvent('UIPageForm','SelectTab','&objectId=PermissionSetting')\"]");
+            click("//div[@onclick=\"eXo.webui.UIHorizontalTabs.changeTabForUIFormTabpane(this, 'UIPageForm', 'PermissionSetting');javascript:eXo.webui.UIForm.submitEvent('UIPageForm','SelectTab','&objectId=PermissionSetting')\"]");
+            waitForElementPresent("link=Access Permission Setting");
+            click("link=Access Permission Setting");
+            waitForElementPresent("link=Edit Permission Setting");
+            click("link=Edit Permission Setting");
+            break;
+         case GROUP:
+            waitForElementPresent("ownerType");
+            select("ownerType", "label=group");
+            waitForElementPresent("xpath=//option[@value='group']");
+            pause(5000);
+            waitForElementPresent("ownerId");
+            if (groupId != null)
+            {
+               select("ownerId", "label=" + groupId);
+               waitForElementPresent("//option[@value='" + groupId + "']");
+            }
+            waitForElementPresent("//div[@onclick=\"eXo.webui.UIHorizontalTabs.changeTabForUIFormTabpane(this, 'UIPageForm', 'PermissionSetting');javascript:eXo.webui.UIForm.submitEvent('UIPageForm','SelectTab','&objectId=PermissionSetting')\"]");
+            click("//div[@onclick=\"eXo.webui.UIHorizontalTabs.changeTabForUIFormTabpane(this, 'UIPageForm', 'PermissionSetting');javascript:eXo.webui.UIForm.submitEvent('UIPageForm','SelectTab','&objectId=PermissionSetting')\"]");
+            waitForElementPresent("link=Access Permission Setting");
+            click("link=Access Permission Setting");
+            waitForElementPresent("link=Edit Permission Setting");
+            click("link=Edit Permission Setting");
+            break;
+         default:
+            break;
+      }
+      waitForElementPresent("//div[@onclick=\"eXo.webui.UIHorizontalTabs.changeTabForUIFormTabpane(this, 'UIPageForm', 'UIPageTemplateOptions');javascript:eXo.webui.UIForm.submitEvent('UIPageForm','SelectTab','&objectId=UIPageTemplateOptions')\"]");
+      click("//div[@onclick=\"eXo.webui.UIHorizontalTabs.changeTabForUIFormTabpane(this, 'UIPageForm', 'UIPageTemplateOptions');javascript:eXo.webui.UIForm.submitEvent('UIPageForm','SelectTab','&objectId=UIPageTemplateOptions')\"]");
+      waitForElementPresent("link=Save");
+      click("link=Save");
+      if (verifyText != null)
+      {
+         waitForTextNotPresent("Page Setting");
+         waitForTextPresent(verifyText);
+      }
+   }
+
+   public static void searchPageByTitle(String title, String verifyText) throws Exception
+   {
+      System.out.println("--Searching page: " + title + "--");
+      waitForElementPresent("searchTerm");
+      type("searchTerm", title);
+      select("searchOption", "label=Title");
+      waitForElementPresent("xpath=//form[@id='UIPageSearch']/div[2]/a");
+      click("xpath=//form[@id='UIPageSearch']/div[2]/a");
+      pause(3000);
+      if (verifyText != null)
+      {
+         waitForTextPresent(verifyText);
+      }
+   }
+
+   private static void deletePage(String title, boolean closeDialog, String verifyText) throws Exception
+   {
+      System.out.println("--Delete page: " + title + "--");
+      String delButton = "//tbody[@class='FeedBox']//tr[*/div[@title='" + title + "']]//img[@title='Delete Page' and contains(@onclick, 'op=Delete')]";
+      waitForElementPresent(delButton);
+      click(delButton);
+      waitForConfirmation("Do you want to delete this page?");
+      if (verifyText != null)
+      {
+         waitForTextNotPresent(verifyText);
+      }
+      if (closeDialog)
+      {
+         closeMessageDialog();
+      }
+   }
+
+   public static void deletePage(String name, String title, boolean closeDialog, String verifyText) throws Exception
+   {
+      System.out.println("--Delete page: " + title + "--");
+      waitForElementPresent("xpath=//img[@title='Delete Page' and contains(@onclick, 'op=Delete') and contains(@onclick, '" + name + "')]");
+      click("xpath=//img[@title='Delete Page' and contains(@onclick, 'op=Delete') and contains(@onclick, '" + name + "')]");
+      waitForConfirmation("Do you want to delete this page?");
+      if (verifyText != null)
+      {
+         waitForTextNotPresent(verifyText);
+      }
+      if (closeDialog)
+      {
+         closeMessageDialog();
+      }
+   }
+
+   public static void searchAndDeletePage(String name, String title, boolean closeDialog, String verifyText) throws Exception
+   {
+      searchPageByTitle(title, verifyText);
+      deletePage(name, title, closeDialog, verifyText);
+   }
+
+   public static void searchAndDeletePage(String title) throws Exception
+   {
+      searchPageByTitle(title, null);
+      deletePage(title, false, null);
+   }
+}

Added: portal/trunk/testsuite/selenium-tests-other/src/test/resources/org/jboss/gatein/selenium/jira/Test_GTNPORTAL_1257_SeamSessionOutlivesTheGateInSession-build.xml
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/resources/org/jboss/gatein/selenium/jira/Test_GTNPORTAL_1257_SeamSessionOutlivesTheGateInSession-build.xml	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/resources/org/jboss/gatein/selenium/jira/Test_GTNPORTAL_1257_SeamSessionOutlivesTheGateInSession-build.xml	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,121 @@
+<!--
+  ~ JBoss, Home of Professional Open Source.
+  ~ Copyright 2010, Red Hat Middleware LLC, and individual contributors
+  ~ as indicated by the @author tags. See the copyright.txt file in the
+  ~ distribution for a full listing of individual contributors.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software 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 software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+
+<project default="deploy" basedir="." xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+
+   <path id="maven-ant-tasks.classpath"
+         path="${localRepository}/org/apache/maven/maven-ant-tasks/2.1.1/maven-ant-tasks-2.1.1.jar"/>
+   <typedef resource="org/apache/maven/artifact/ant/antlib.xml"
+            uri="antlib:org.apache.maven.artifact.ant"
+            classpathref="maven-ant-tasks.classpath"/>
+
+   <property name="scm.url" value="scm:svn:http://anonsvn.jboss.org/repos/portletbridge/tags/2.1.0.CR1/examples" />
+
+   <property name="deploy.dir" value="${container.config.deploy}" />
+   <dirname property="antfile.dir" file="${ant.file}"/>
+   <property name="testRoot.dir" value="${antfile.dir}" />
+   <property name="checkout.dir" value="${testRoot.dir}/checkout" />
+
+   <property name="bookingEar.dir" value="${testRoot.dir}/bookingEar" />
+   <property name="bookingEar.name" value="seamEAR.ear" />
+
+   <property name="bookingEar.location" value="${bookingEar.dir}/${bookingEar.name}" />
+   <property name="bookingEar.deploy.location" value="${deploy.dir}/${bookingEar.name}" />
+
+   <property name="bookingEar.groupId" value="org.jboss.portletbridge.examples.seam.booking" />
+   <property name="bookingEar.artifactId" value="seamBooking-ear" />
+   <property name="bookingEar.version" value="2.1.0.CR1" />
+   <property name="bookingEar.artifact" value="${bookingEar.artifactId}-${bookingEar.version}.ear" />
+
+   <property name="bookingEar.repo.group.path" value="org/jboss/portletbridge/examples/seam/booking" />
+   <property name="bookingEar.repo.path" value="${bookingEar.repo.group.path}/${bookingEar.artifactId}/${bookingEar.version}/${bookingEar.artifact}" />
+
+
+   <macrodef name="check-ear-available">
+      <attribute name="property" />
+      <sequential>
+         <!-- check if ear artifact exists in local repository -->
+         <copy tofile="${bookingEar.location}" file="${localRepository}/${bookingEar.repo.path}"
+               preservelastmodified="true" failonerror="false" />
+         <available file="${bookingEar.location}" property="@{property}"/>
+      </sequential>
+   </macrodef>
+
+   <macrodef name="check-uptodate">
+      <attribute name="property" />
+      <sequential>
+         <!-- if ear artifact exists in deploy, check if it’s up-to-date -->
+         <uptodate srcfile="${bookingEar.location}"
+             targetfile="${bookingEar.deploy.location}" property="@{property}"/>
+      </sequential>
+   </macrodef>
+
+   <target name="init">
+      <mkdir dir="${bookingEar.dir}"/>
+      <available file="${bookingEar.deploy.location}" property="build.not.required"/>
+   </target>
+
+   <target name="check-ear-exists-before" unless="build.not.required" depends="init">
+      <check-ear-available property="bookingEar.present"/>
+   </target>
+
+   <target name="check-uptodate-before" if="bookingEar.present" depends="check-ear-exists-before">
+      <check-uptodate property="bookingEar.uptodate"/>
+   </target>
+
+   <target name="check-ear-exists-after">
+      <check-ear-available property="bookingEar.present"/>
+   </target>
+
+   <target name="check-uptodate-after" if="bookingEar.present" depends="check-ear-exists-after">
+      <check-uptodate property="bookingEar.uptodate"/>
+   </target>
+
+   <target name="check-build-required" depends="check-uptodate-before">
+      <condition property="build.not.required">
+         <and>
+            <not>
+               <isset property="build.not.required"/>
+            </not>
+            <isset property="bookingEar.present"/>
+         </and>
+      </condition>
+   </target>
+
+   <target name="ensure-ear" unless="build.not.required" depends="check-build-required">
+      <!-- if ear artifact doesn’t exist or is not up-to-date - download and build/install the examples -->
+      <artifact:mvn mavenHome="${maven.home}">
+         <arg value="scm:bootstrap"/>
+         <arg value="-DconnectionUrl=${scm.url}"/>
+         <arg value="-Dbasedir=${testRoot.dir}"/>
+         <arg value="-DcheckoutDirectory=${checkout.dir}"/>
+         <arg value="-Dgoals=install"/>
+      </artifact:mvn>
+   </target>
+
+   <target name="deploy" if="bookingEar.present" unless="bookingEar.uptodate"
+           depends="ensure-ear,check-uptodate-after">
+
+      <copy file="${bookingEar.location}" tofile="${bookingEar.deploy.location}" preservelastmodified="true"/>
+   </target>
+
+</project>

Added: portal/trunk/testsuite/selenium-tests-other/src/test/resources/testng.xml
===================================================================
--- portal/trunk/testsuite/selenium-tests-other/src/test/resources/testng.xml	                        (rev 0)
+++ portal/trunk/testsuite/selenium-tests-other/src/test/resources/testng.xml	2010-11-09 13:45:48 UTC (rev 4988)
@@ -0,0 +1,43 @@
+<!--
+  ~ JBoss, Home of Professional Open Source.
+  ~ Copyright 2010, Red Hat Middleware LLC, and individual contributors
+  ~ as indicated by the @author tags. See the copyright.txt file in the
+  ~ distribution for a full listing of individual contributors.
+  ~
+  ~ This is free software; you can redistribute it and/or modify it
+  ~ under the terms of the GNU Lesser General Public License as
+  ~ published by the Free Software Foundation; either version 2.1 of
+  ~ the License, or (at your option) any later version.
+  ~
+  ~ This software 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 software; if not, write to the Free
+  ~ Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+  ~ 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+  -->
+
+<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
+<suite name="GateIn_Selenium_tests">
+
+	<listeners>
+		<listener class-name="org.jboss.gatein.selenium.TestCaseFailListener" />
+	</listeners>
+
+	<test name="JiraTests">
+		<groups>
+			<run>
+				<include name="jira" />
+				<exclude name="broken" />
+			</run>
+		</groups>
+		<packages>
+			<package name="org.jboss.gatein.selenium.jira.*" />
+		</packages>
+	</test>
+
+	
+</suite>
\ No newline at end of file



More information about the gatein-commits mailing list