JBoss Rich Faces SVN: r17891 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:01:56 -0400 (Sat, 10 Jul 2010)
New Revision: 17891
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
misused activeByDefault, replaced by property activation
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:01:43 UTC (rev 17890)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:01:56 UTC (rev 17891)
@@ -176,7 +176,9 @@
<profile>
<id>unpack-test-source</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>!eclipse</name>
+ </property>
</activation>
<build>
<plugins>
@@ -209,6 +211,11 @@
resolution
-->
<id>copy-test-source</id>
+ <activation>
+ <property>
+ <name>eclipse</name>
+ </property>
+ </activation>
<build>
<plugins>
<plugin>
14 years, 6 months
JBoss Rich Faces SVN: r17890 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:01:43 -0400 (Sat, 10 Jul 2010)
New Revision: 17890
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
automatic preparation of apache tomcat 6.0.26 with EL 2.2 dependencies
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:01:29 UTC (rev 17889)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:01:43 UTC (rev 17890)
@@ -20,10 +20,24 @@
<properties>
<context.path>/testapp/</context.path>
<deployable.version>4.0.0-SNAPSHOT</deployable.version>
- <tomcat6x.installer.url.unix>file:/qa/home/lfryc/apache-tomcat-6.0.26--jsf2.zip</tomcat6x.installer.url.unix>
- <container.dir.deflatted>apache-tomcat-6.0.26--jsf2</container.dir.deflatted>
</properties>
+ <pluginRepositories>
+ <pluginRepository>
+ <id>ossrh</id>
+ <name>Sonatype OSS Repository</name>
+ <url>http://oss.sonatype.org/content/groups/public</url>
+ <layout>default</layout>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <repositories>
+ <repository>
+ <id>download-java-net-glassfish</id>
+ <url>http://download.java.net/maven/glassfish</url>
+ </repository>
+ </repositories>
+
<dependencies>
<dependency>
<groupId>org.richfaces.examples</groupId>
@@ -43,7 +57,9 @@
<profile>
<id>container-deploy-artifact</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>containerId</name>
+ </property>
</activation>
<build>
<plugins>
@@ -70,6 +86,94 @@
</build>
</profile>
<profile>
+ <id>container-tomcat6x-deploy-el2.2-libs</id>
+ <activation>
+ <property>
+ <name>containerId</name>
+ <value>tomcat6x</value>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>com.savage7.maven.plugins</groupId>
+ <artifactId>maven-external-dependency-plugin</artifactId>
+ <version>0.2-SNAPSHOT</version>
+ <inherited>false</inherited>
+ <configuration>
+ <stagingDirectory>${project.build.directory}/dependencies/</stagingDirectory>
+ <createChecksum>true</createChecksum>
+ <skipChecksumVerification>false</skipChecksumVerification>
+ <force>false</force>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jasper</artifactId>
+ <version>6.0.26</version>
+ <classifier>el-2.2</classifier>
+ <packaging>jar</packaging>
+ <downloadUrl>http://www.fryc.eu/dependencies/jasper.jar</downloadUrl>
+ <checksum>762a42f8d269d128a9262c0654bacc062439c415</checksum>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ <executions>
+ <execution>
+ <id>resolve-install-external-dependencies</id>
+ <phase>generate-sources</phase>
+ <goals>
+ <goal>resolve-external</goal>
+ <goal>install-external</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>deploy-el-2.2-libs</id>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <phase>process-test-resources</phase>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>org.apache.tomcat</groupId>
+ <artifactId>jasper</artifactId>
+ <version>6.0.26</version>
+ <classifier>el-2.2</classifier>
+ <overWrite>true</overWrite>
+ <outputDirectory>${container.home}/lib</outputDirectory>
+ <destFileName>jasper.jar</destFileName>
+ </artifactItem>
+ <artifactItem>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${container.home}/lib</outputDirectory>
+ <destFileName>el-api.jar</destFileName>
+ </artifactItem>
+ <artifactItem>
+ <groupId>org.glassfish.web</groupId>
+ <artifactId>el-impl</artifactId>
+ <version>2.2.0-SNAPSHOT</version>
+ <overWrite>true</overWrite>
+ <outputDirectory>${container.home}/lib</outputDirectory>
+ <destFileName>el-impl.jar</destFileName>
+ </artifactItem>
+ </artifactItems>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ <profile>
<id>unpack-test-source</id>
<activation>
<activeByDefault>true</activeByDefault>
@@ -160,6 +264,13 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-enforcer-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
</plugins>
</build>
</project>
14 years, 6 months
JBoss Rich Faces SVN: r17889 - root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:01:29 -0400 (Sat, 10 Jul 2010)
New Revision: 17889
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java
Log:
added group annotation to ScrollerTestCase methods
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java 2010-07-10 21:00:53 UTC (rev 17888)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java 2010-07-10 21:01:29 UTC (rev 17889)
@@ -54,7 +54,7 @@
final static int TOTAL_ROW_COUNT = 50;
- @Test(dataProvider = "templates")
+ @Test(dataProvider = "templates", groups = "client-side-perf")
public void testInternalDataScrollerRowCount(String templates) {
testRowCount(dataScroller2);
}
14 years, 6 months
JBoss Rich Faces SVN: r17888 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:00:53 -0400 (Sat, 10 Jul 2010)
New Revision: 17888
Added:
root/tests/metamer/trunk/ftest/vncsession.sh
Log:
shortcut shell script for running VNC session
Added: root/tests/metamer/trunk/ftest/vncsession.sh
===================================================================
--- root/tests/metamer/trunk/ftest/vncsession.sh (rev 0)
+++ root/tests/metamer/trunk/ftest/vncsession.sh 2010-07-10 21:00:53 UTC (rev 17888)
@@ -0,0 +1,4 @@
+#!/bin/bash
+vncserver :1
+nohup vncviewer :1 &>/dev/null &
+export DISPLAY=:1
14 years, 6 months
JBoss Rich Faces SVN: r17887 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:00:41 -0400 (Sat, 10 Jul 2010)
New Revision: 17887
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
follow richfaces-selenium library changes: configuration of test cases by TestNG parameters (via argLine) replaced by SystemProperties configuration
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:00:30 UTC (rev 17886)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 21:00:41 UTC (rev 17887)
@@ -149,7 +149,7 @@
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
</suiteXmlFiles>
- <argLine>${surefire.argline} -Dtemplates='${templates}'</argLine>
+ <argLine>-Dtemplates='${templates}'</argLine>
<properties>
<property>
<name>listener</name>
14 years, 6 months
JBoss Rich Faces SVN: r17886 - root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:00:30 -0400 (Sat, 10 Jul 2010)
New Revision: 17886
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java
Log:
fixed locators bound to elements id for tests inside containers
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java 2010-07-10 21:00:03 UTC (rev 17885)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java 2010-07-10 21:00:30 UTC (rev 17886)
@@ -23,14 +23,14 @@
package org.richfaces.tests.testapp.richExtendedDataTable;
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.locator.LocatorFactory.*;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import static org.testng.Assert.assertEquals;
import java.net.URL;
import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.JQueryLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
import org.richfaces.tests.testapp.AbstractTestappTestCase;
import org.testng.annotations.Test;
@@ -42,10 +42,10 @@
*/
public class ScrollerTestCase extends AbstractTestappTestCase {
- DataScroller dataScroller1 = new DataScroller(jq("#form\\:richEDT\\:scroller2"));
- DataScroller dataScroller2 = new DataScroller(jq("#form\\:scroller1"));
- DataTable table = new DataTable(jq("#form\\:richEDT"));
- JQueryLocator attributeRowsInput = jq("#form\\:attributes\\:rowsInput");
+ DataScroller dataScroller1 = new DataScroller(pjq("span.rf-ds[id$=scroller1]"));
+ DataScroller dataScroller2 = new DataScroller(pjq("span.rf-ds[id$=scroller2]"));
+ DataTable table = new DataTable(pjq("table.rf-dt[id$=richEDT]"));
+ ElementLocator attributeRowsInput = id("form:attributes:rowsInput");
@Override
public URL getTestUrl() {
@@ -55,17 +55,18 @@
final static int TOTAL_ROW_COUNT = 50;
@Test(dataProvider = "templates")
- public void testDefaultDataScrollerRowCount(String templates) {
- testRowCount(dataScroller1);
+ public void testInternalDataScrollerRowCount(String templates) {
+ testRowCount(dataScroller2);
}
@Test(dataProvider = "templates")
public void testExternalDataScrollerRowCount(String templates) {
- testRowCount(dataScroller2);
+ testRowCount(dataScroller1);
}
private void testRowCount(DataScroller dataScroller) {
- for (Integer rowsPerPage : new Integer[]{null, 10, 1, TOTAL_ROW_COUNT, 13, 9, 17, TOTAL_ROW_COUNT + 1, 2 * TOTAL_ROW_COUNT}) {
+ for (Integer rowsPerPage : new Integer[]{null, 10, 1, TOTAL_ROW_COUNT, 13, 9, 17, TOTAL_ROW_COUNT + 1,
+ 2 * TOTAL_ROW_COUNT}) {
if (rowsPerPage != null) {
selenium.type(attributeRowsInput, String.valueOf(rowsPerPage));
guardHttp(selenium).fireEvent(attributeRowsInput, Event.BLUR);
14 years, 6 months
JBoss Rich Faces SVN: r17885 - in root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp: a4jCommandButton and 3 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 17:00:03 -0400 (Sat, 10 Jul 2010)
New Revision: 17885
Added:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/hCommandButton/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/hCommandButton/HCommandButtonTestCase.java
Removed:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
Log:
* added tests for h:commandButton, a4j:commandButton and a4j:commandLink
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 20:56:23 UTC (rev 17884)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 21:00:03 UTC (rev 17885)
@@ -23,10 +23,13 @@
package org.richfaces.tests.testapp;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
import java.net.URL;
import org.jboss.test.selenium.AbstractTestCase;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.ElementLocator;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
@@ -119,7 +122,7 @@
selenium.click(invalidateButton);
selenium.waitForPageToLoad(TIMEOUT);
}
-
+
/**
* Forces the current thread sleep for given time.
*
@@ -149,4 +152,27 @@
return new JQueryLocator("div.content " + jquerySelector);
}
+ /**
+ * A helper method for testing javascripts events. It sets alert('testedevent') to the input field for given event
+ * and fires the event. Then it checks the message in the alert dialog.
+ *
+ * @param event
+ * JavaScript event to be tested
+ * @param element
+ * locator of tested element
+ */
+ protected void testFireEvent(Event event, ElementLocator element) {
+ ElementLocator eventInput = pjq("input[id$=on" + event.getEventName() + "Input]");
+ final String value = "alert('" + event.getEventName() + "')";
+
+ selenium.type(eventInput, value);
+ selenium.fireEvent(eventInput, Event.BLUR);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.fireEvent(element, event);
+
+ assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
+ + " attribute did not change correctly");
+ }
+
}
Copied: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java (from rev 17884, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandButton/A4JCommandButtonTestCase.java 2010-07-10 21:00:03 UTC (rev 17885)
@@ -0,0 +1,324 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.tests.testapp.a4jCommandButton;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.testapp.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jCommandButton/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class A4JCommandButtonTestCase extends AbstractTestappTestCase {
+
+ private ElementLocator input = pjq("input[id$=input]");
+ private ElementLocator button = pjq("input[id$=a4jCommandButton]");
+ private ElementLocator output1 = pjq("span[id$=output1]");
+ private ElementLocator output2 = pjq("span[id$=output2]");
+ private ElementLocator output3 = pjq("span[id$=output3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jCommandButton/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ // @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testSimpleClick(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSimpleClickUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéňô");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAction(String templates) {
+ ElementLocator doubleStringAction = pjq("input[value=doubleStringAction]");
+ ElementLocator first6CharsAction = pjq("input[value=first6CharsAction]");
+ ElementLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
+
+ selenium.click(doubleStringAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output2);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+
+ selenium.click(first6CharsAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+
+ selenium.click(toUpperCaseAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testActionListener(String templates) {
+ ElementLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
+ ElementLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
+ ElementLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
+
+ selenium.click(doubleStringActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output3);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
+
+ selenium.click(first6CharsActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+
+ selenium.click(toUpperCaseActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4Ě",
+ "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDisabled(String templates) {
+ ElementLocator disabledChecbox = pjq("input[id$=disabledInput]");
+ AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
+
+ selenium.click(disabledChecbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String isDisabled = selenium.getAttribute(disabledAttribute);
+ assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnclick(String templates) {
+ testFireEvent(Event.CLICK, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOndblclick(String templates) {
+ testFireEvent(Event.DBLCLICK, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeydown(String templates) {
+ testFireEvent(Event.KEYDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeypress(String templates) {
+ testFireEvent(Event.KEYPRESS, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOneyup(String templates) {
+ testFireEvent(Event.KEYUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousedown(String templates) {
+ testFireEvent(Event.MOUSEDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousemove(String templates) {
+ testFireEvent(Event.MOUSEMOVE, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseout(String templates) {
+ testFireEvent(Event.MOUSEOUT, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseover(String templates) {
+ testFireEvent(Event.MOUSEOVER, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseup(String templates) {
+ testFireEvent(Event.MOUSEUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRender(String templates) {
+ ElementLocator renderInput = pjq("input[name$=renderInput]");
+
+ selenium.type(renderInput, "output1");
+ selenium.fireEvent(renderInput, Event.BLUR);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "aaa");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("aaa"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "", "output2 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
+
+ selenium.type(renderInput, "output2 output3");
+ selenium.fireEvent(renderInput, Event.BLUR);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "bbb");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output2).text("bbb"));
+
+ output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "bbb", "output2 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedCheckbox = pjq("input[name$=renderedInput]");
+
+ selenium.click(renderedCheckbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(button), "Button should not be displayed");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+ ElementLocator wide = pjq("input[name$=styleClassInput][value=wide]");
+ ElementLocator big = pjq("input[name$=styleClassInput][value=big]");
+ ElementLocator none = pjq("input[name$=styleClassInput][value=]");
+
+ final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
+
+ selenium.click(wide);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
+
+ selenium.click(big);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
+
+ selenium.click(none);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ ElementLocator styleInput = pjq("input[id$=styleInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
+ final String value = "font-size: 20px;";
+
+ selenium.type(styleInput, value);
+ selenium.fireEvent(styleInput, Event.BLUR);
+
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testValue(String templates) {
+ ElementLocator valueInput = pjq("input[id$=valueInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
+ final String value = "new label";
+
+ selenium.type(valueInput, value);
+ selenium.fireEvent(valueInput, Event.BLUR);
+
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
+ }
+
+}
Copied: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java (from rev 17884, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jCommandLink/A4JCommandLinkTestCase.java 2010-07-10 21:00:03 UTC (rev 17885)
@@ -0,0 +1,340 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.tests.testapp.a4jCommandLink;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.richfaces.tests.testapp.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jCommandLink/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class A4JCommandLinkTestCase extends AbstractTestappTestCase {
+
+ private ElementLocator input = pjq("input[id$=input]");
+ private ElementLocator link = pjq("a[id$=a4jCommandLink]");
+ private ElementLocator output1 = pjq("span[id$=output1]");
+ private ElementLocator output2 = pjq("span[id$=output2]");
+ private ElementLocator output3 = pjq("span[id$=output3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jCommandLink/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ // @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testSimpleClick(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSimpleClickUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéňô");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAction(String templates) {
+ ElementLocator doubleStringAction = pjq("input[value=doubleStringAction]");
+ ElementLocator first6CharsAction = pjq("input[value=first6CharsAction]");
+ ElementLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
+
+ selenium.click(doubleStringAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output2);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+
+ selenium.click(first6CharsAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+
+ selenium.click(toUpperCaseAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testActionListener(String templates) {
+ ElementLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
+ ElementLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
+ ElementLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
+
+ selenium.click(doubleStringActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output3);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
+
+ selenium.click(first6CharsActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+
+ selenium.click(toUpperCaseActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(link);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4Ě",
+ "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDisabled(String templates) {
+ ElementLocator disabledChecbox = pjq("input[id$=disabledInput]");
+ ElementLocator newLink = pjq("span[id$=a4jCommandLink]");
+
+ selenium.click(disabledChecbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ assertFalse(selenium.isElementPresent(link), link.getAsString()
+ + " should not be on page when the link is disabled");
+ assertTrue(selenium.isElementPresent(newLink), newLink.getAsString()
+ + " should be on page when the link is disabled");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnclick(String templates) {
+ testFireEvent(Event.CLICK, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOndblclick(String templates) {
+ testFireEvent(Event.DBLCLICK, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeydown(String templates) {
+ testFireEvent(Event.KEYDOWN, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeypress(String templates) {
+ testFireEvent(Event.KEYPRESS, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOneyup(String templates) {
+ testFireEvent(Event.KEYUP, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousedown(String templates) {
+ testFireEvent(Event.MOUSEDOWN, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousemove(String templates) {
+ testFireEvent(Event.MOUSEMOVE, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseout(String templates) {
+ testFireEvent(Event.MOUSEOUT, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseover(String templates) {
+ testFireEvent(Event.MOUSEOVER, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseup(String templates) {
+ testFireEvent(Event.MOUSEUP, link);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRender(String templates) {
+ ElementLocator renderInput = pjq("input[name$=renderInput]");
+
+ selenium.type(renderInput, "output1");
+ selenium.fireEvent(renderInput, Event.BLUR);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "aaa");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output1).text("aaa"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "", "output2 when 'aaa' in input and 'output1' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "", "output3 when 'aaa' in input and 'output1' set to be rerendered");
+
+ selenium.type(renderInput, "output2 output3");
+ selenium.fireEvent(renderInput, Event.BLUR);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.typeKeys(input, "bbb");
+ selenium.click(link);
+
+ waitGui.until(textEquals.locator(output2).text("bbb"));
+
+ output = selenium.getText(output1);
+ assertEquals(output, "aaa", "output1 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "bbb", "output2 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "BBB", "output3 when 'bbb' in input and 'output2 output3' set to be rerendered");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testRendered(String templates) {
+ ElementLocator renderedCheckbox = pjq("input[name$=renderedInput]");
+
+ selenium.click(renderedCheckbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isElementPresent(link), "Button should not be displayed");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+ ElementLocator bold = pjq("input[name$=styleClassInput][value=bold]");
+ ElementLocator strike = pjq("input[name$=styleClassInput][value=strike]");
+ ElementLocator none = pjq("input[name$=styleClassInput][value=]");
+
+ final AttributeLocator classAttribute = link.getAttribute(new Attribute("class"));
+
+ selenium.click(bold);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(link, "bold"), "Button's class was not changed to 'bold'");
+
+ selenium.click(strike);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(link, "strike"), "Button's class was not changed to 'strike'");
+
+ selenium.click(none);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ ElementLocator styleInput = pjq("input[id$=styleInput]");
+ final AttributeLocator attribute = link.getAttribute(new Attribute("style"));
+ final String value = "font-size: 20px;";
+
+ selenium.type(styleInput, value);
+ selenium.fireEvent(styleInput, Event.BLUR);
+
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testValue(String templates) {
+ ElementLocator valueInput = pjq("input[id$=valueInput]");
+ final String value = "new label";
+
+ selenium.type(valueInput, value);
+ selenium.fireEvent(valueInput, Event.BLUR);
+
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertEquals(selenium.getText(link), value, "Value of the button did not change");
+ }
+
+ private void testFireEvent(Event event) {
+ ElementLocator eventInput = pjq("input[id$=on" + event.getEventName() + "Input]");
+ final String value = "alert('" + event.getEventName() + "')";
+
+ selenium.type(eventInput, value);
+ selenium.fireEvent(eventInput, Event.BLUR);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.fireEvent(link, event);
+
+ assertEquals(selenium.getAlert(), event.getEventName(), event.getEventName()
+ + " attribute did not change correctly");
+ }
+
+}
Deleted: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java 2010-07-10 20:56:23 UTC (rev 17884)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java 2010-07-10 21:00:03 UTC (rev 17885)
@@ -1,246 +0,0 @@
-/*******************************************************************************
- * JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
- * by the @authors tag. See the copyright.txt 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.richfaces.tests.testapp.commandButton;
-
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.dom.Event;
-import org.jboss.test.selenium.locator.Attribute;
-import org.jboss.test.selenium.locator.AttributeLocator;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.Test;
-
-/**
- * Test case for page /faces/components/commandButton/simple.xhtml
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public class CommandButtonTestCase extends AbstractTestappTestCase {
-
- private JQueryLocator input = pjq("input[id$=input]");
- private JQueryLocator button = pjq("input[id$=commandButton]");
- private JQueryLocator output1 = pjq("span[id$=output1]");
- private JQueryLocator output2 = pjq("span[id$=output2]");
- private JQueryLocator output3 = pjq("span[id$=output3]");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/commandButton/simple.xhtml");
- }
-
- @Override
- @AfterMethod(alwaysRun=true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
- @Test(dataProvider = "templates", groups = "client-side-perf")
- public void testSimpleClick(String templates) {
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testSimpleClickUnicode(String templates) {
- selenium.typeKeys(input, "ľščťžýáíéňô");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
-
- String output = selenium.getText(output1);
- assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output2);
- assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
-
- output = selenium.getText(output3);
- assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
- }
-
- @Test(dataProvider = "templates")
- public void testAction(String templates) {
- JQueryLocator doubleStringAction = pjq("input[value=doubleStringAction]");
- JQueryLocator first6CharsAction = pjq("input[value=first6CharsAction]");
- JQueryLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
-
- selenium.click(doubleStringAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output2);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringAction selected");
-
- selenium.click(first6CharsAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output2);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
-
- selenium.click(toUpperCaseAction);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output2);
- assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
- }
-
- @Test(dataProvider = "templates")
- public void testActionListener(String templates) {
- JQueryLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
- JQueryLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
- JQueryLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
-
- selenium.click(doubleStringActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
- String output = selenium.getText(output3);
- assertEquals(output, "RichFaces 4RichFaces 4",
- "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
-
- selenium.click(first6CharsActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ň");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
- output = selenium.getText(output3);
- assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
-
- selenium.click(toUpperCaseActionListener);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "RichFaces 4ě");
- selenium.click(button);
- waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
- output = selenium.getText(output3);
- assertEquals(output, "RICHFACES 4Ě",
- "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
- }
-
- @Test(dataProvider = "templates")
- public void testDisabled(String templates) {
- JQueryLocator disabledChecbox = pjq("input[id$=disabledInput]");
- AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
-
- selenium.click(disabledChecbox);
- selenium.waitForPageToLoad(TIMEOUT);
-
- String isDisabled = selenium.getAttribute(disabledAttribute);
- assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
- }
-
- @Test(dataProvider = "templates")
- public void testOnclick(String templates) {
- JQueryLocator onclickInput = pjq("input[id$=onclickInput]");
- final AttributeLocator onclickAttribute = button.getAttribute(new Attribute("onclick"));
- final String value = "alert('onclick')";
-
- selenium.type(onclickInput, value);
- selenium.fireEvent(onclickInput, Event.BLUR);
-
- selenium.waitForPageToLoad(TIMEOUT);
- assertEquals(selenium.getAttribute(onclickAttribute), value, "onclick attribute did not change correctly");
- }
-
- @Test(dataProvider = "templates")
- public void testStyleClass(String templates) {
- JQueryLocator blue = pjq("input[name$=styleClassInput][value=blue]");
- JQueryLocator red = pjq("input[name$=styleClassInput][value=red]");
- JQueryLocator wide = pjq("input[name$=styleClassInput][value=wide]");
- JQueryLocator big = pjq("input[name$=styleClassInput][value=big]");
- JQueryLocator none = pjq("input[name$=styleClassInput][value=]");
-
- final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
-
- selenium.click(blue);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "blue"), "Button's class was not changed to 'blue'");
-
- selenium.click(red);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "red"), "Button's class was not changed to 'red'");
-
- selenium.click(wide);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
-
- selenium.click(big);
- selenium.waitForPageToLoad(TIMEOUT);
- assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
-
- selenium.click(none);
- selenium.waitForPageToLoad(TIMEOUT);
- assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
- }
-
- @Test(dataProvider = "templates")
- public void testStyle(String templates) {
- JQueryLocator styleInput = pjq("input[id$=styleInput]");
- final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
- final String value = "font-size: 20px;";
-
- selenium.type(styleInput, value);
- selenium.fireEvent(styleInput, Event.BLUR);
-
- selenium.waitForPageToLoad(TIMEOUT);
- assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
- }
-
- @Test(dataProvider = "templates")
- public void testValue(String templates) {
- JQueryLocator valueInput = pjq("input[id$=valueInput]");
- final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
- final String value = "new label";
-
- selenium.type(valueInput, value);
- selenium.fireEvent(valueInput, Event.BLUR);
-
- selenium.waitForPageToLoad(TIMEOUT);
- assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
- }
-
-}
Copied: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/hCommandButton/HCommandButtonTestCase.java (from rev 17884, root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/hCommandButton/HCommandButtonTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/hCommandButton/HCommandButtonTestCase.java 2010-07-10 21:00:03 UTC (rev 17885)
@@ -0,0 +1,292 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.tests.testapp.hCommandButton;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.Attribute;
+import org.jboss.test.selenium.locator.AttributeLocator;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.testapp.AbstractTestappTestCase;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/commandButton/simple.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class HCommandButtonTestCase extends AbstractTestappTestCase {
+
+ private JQueryLocator input = pjq("input[id$=input]");
+ private JQueryLocator button = pjq("input[id$=commandButton]");
+ private JQueryLocator output1 = pjq("span[id$=output1]");
+ private JQueryLocator output2 = pjq("span[id$=output2]");
+ private JQueryLocator output3 = pjq("span[id$=output3]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/commandButton/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates", groups = "client-side-perf")
+ public void testSimpleClick(String templates) {
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "RichFaces 4", "output1 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4", "output3 when 'RichFaces 4' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testSimpleClickUnicode(String templates) {
+ selenium.typeKeys(input, "ľščťžýáíéňô");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("ľščťžýáíéňô"));
+
+ String output = selenium.getText(output1);
+ assertEquals(output, "ľščťžýáíéňô", "output1 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output2);
+ assertEquals(output, "ľščťžý", "output2 when 'ľščťžýáíéňô' in input");
+
+ output = selenium.getText(output3);
+ assertEquals(output, "ĽŠČŤŽÝÁÍÉŇÔ", "output3 when 'ľščťžýáíéňô' in input");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testAction(String templates) {
+ JQueryLocator doubleStringAction = pjq("input[value=doubleStringAction]");
+ JQueryLocator first6CharsAction = pjq("input[value=first6CharsAction]");
+ JQueryLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
+
+ selenium.click(doubleStringAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output2);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringAction selected");
+
+ selenium.click(first6CharsAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsAction selected");
+
+ selenium.click(toUpperCaseAction);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output2);
+ assertEquals(output, "RICHFACES 4Ě", "output2 when 'RichFaces 4ě' in input and toUpperCaseAction selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testActionListener(String templates) {
+ JQueryLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
+ JQueryLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
+ JQueryLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
+
+ selenium.click(doubleStringActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4"));
+ String output = selenium.getText(output3);
+ assertEquals(output, "RichFaces 4RichFaces 4",
+ "output2 when 'RichFaces 4' in input and doubleStringActionListener selected");
+
+ selenium.click(first6CharsActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ň");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ň"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RichFa", "output2 when 'RichFaces 4ň' in input and first6CharsActionListener selected");
+
+ selenium.click(toUpperCaseActionListener);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "RichFaces 4ě");
+ selenium.click(button);
+ waitGui.until(textEquals.locator(output1).text("RichFaces 4ě"));
+ output = selenium.getText(output3);
+ assertEquals(output, "RICHFACES 4Ě",
+ "output2 when 'RichFaces 4ě' in input and toUpperCaseActionListener selected");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testDisabled(String templates) {
+ JQueryLocator disabledChecbox = pjq("input[id$=disabledInput]");
+ AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
+
+ selenium.click(disabledChecbox);
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ String isDisabled = selenium.getAttribute(disabledAttribute);
+ assertEquals(isDisabled.toLowerCase(), "disabled", "The value of attribute disabled");
+ }
+
+ // not implemented in Mojarra
+ // @Test(dataProvider = "templates")
+ public void testOnblur(String templates) {
+ testFireEvent(Event.BLUR, button);
+ }
+
+ // not implemented in Mojarra
+ // @Test(dataProvider = "templates")
+ public void testOnchange(String templates) {
+ testFireEvent(Event.CHANGE, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnclick(String templates) {
+ testFireEvent(Event.CLICK, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOndblclick(String templates) {
+ testFireEvent(Event.DBLCLICK, button);
+ }
+
+ // not implemented in Mojarra
+ // @Test(dataProvider = "templates")
+ public void testOnfocus(String templates) {
+ testFireEvent(Event.FOCUS, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeydown(String templates) {
+ testFireEvent(Event.KEYDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeypress(String templates) {
+ testFireEvent(Event.KEYPRESS, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnkeyup(String templates) {
+ testFireEvent(Event.KEYUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousedown(String templates) {
+ testFireEvent(Event.MOUSEDOWN, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmousemove(String templates) {
+ testFireEvent(Event.MOUSEMOVE, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseout(String templates) {
+ testFireEvent(Event.MOUSEOUT, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseover(String templates) {
+ testFireEvent(Event.MOUSEOVER, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testOnmouseup(String templates) {
+ testFireEvent(Event.MOUSEUP, button);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyleClass(String templates) {
+
+ JQueryLocator wide = pjq("input[name$=styleClassInput][value=wide]");
+ JQueryLocator big = pjq("input[name$=styleClassInput][value=big]");
+ JQueryLocator none = pjq("input[name$=styleClassInput][value=]");
+
+ final AttributeLocator classAttribute = button.getAttribute(new Attribute("class"));
+
+ selenium.click(wide);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "wide"), "Button's class was not changed to 'wide'");
+
+ selenium.click(big);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertTrue(selenium.belongsClass(button, "big"), "Button's class was not changed to 'big'");
+
+ selenium.click(none);
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertFalse(selenium.isAttributePresent(classAttribute), "Button's class was not removed.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testStyle(String templates) {
+ JQueryLocator styleInput = pjq("input[id$=styleInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
+ final String value = "font-size: 20px;";
+
+ selenium.type(styleInput, value);
+ selenium.fireEvent(styleInput, Event.BLUR);
+
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertEquals(selenium.getAttribute(attribute), value, "Style of the button did not change");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testValue(String templates) {
+ JQueryLocator valueInput = pjq("input[id$=valueInput]");
+ final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
+ final String value = "new label";
+
+ selenium.type(valueInput, value);
+ selenium.fireEvent(valueInput, Event.BLUR);
+
+ selenium.waitForPageToLoad(TIMEOUT);
+ assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
+ }
+
+}
14 years, 6 months
JBoss Rich Faces SVN: r17884 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:56:23 -0400 (Sat, 10 Jul 2010)
New Revision: 17884
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
activated TestMethodSelector for testapp-tests
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 20:56:09 UTC (rev 17883)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 20:56:23 UTC (rev 17884)
@@ -153,7 +153,7 @@
<properties>
<property>
<name>listener</name>
- <value>org.jboss.test.selenium.listener.ConsoleStatusTestListener</value>
+ <value>org.jboss.test.selenium.listener.ConsoleStatusTestListener,org.jboss.test.selenium.listener.TestMethodSelector</value>
</property>
</properties>
</configuration>
14 years, 6 months
JBoss Rich Faces SVN: r17883 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:56:09 -0400 (Sat, 10 Jul 2010)
New Revision: 17883
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
profile for debugging from IDE
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 20:55:54 UTC (rev 17882)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 20:56:09 UTC (rev 17883)
@@ -1,133 +1,165 @@
<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>
- <groupId>org.richfaces.tests</groupId>
- <artifactId>testapp-tests</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <name>RichFaces 4.0 TestApp: Functional Test</name>
- <packaging>pom</packaging>
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.richfaces.tests</groupId>
+ <artifactId>testapp-tests</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>RichFaces 4.0 TestApp: Functional Test</name>
+ <packaging>pom</packaging>
- <parent>
- <artifactId>functional-test-jboss-ci-template</artifactId>
- <groupId>org.jboss.test.richfaces-selenium</groupId>
- <version>1.5.0-SNAPSHOT</version>
- </parent>
+ <parent>
+ <artifactId>functional-test-jboss-ci-template</artifactId>
+ <groupId>org.jboss.test.richfaces-selenium</groupId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
- <modules>
- <module>test-source</module>
- </modules>
+ <modules>
+ <module>test-source</module>
+ </modules>
- <properties>
- <context.path>/testapp/</context.path>
- <deployable.version>4.0.0-SNAPSHOT</deployable.version>
- <tomcat6x.installer.url.unix>file:/qa/home/lfryc/apache-tomcat-6.0.26--jsf2.zip</tomcat6x.installer.url.unix>
- <container.dir.deflatted>apache-tomcat-6.0.26--jsf2</container.dir.deflatted>
- </properties>
+ <properties>
+ <context.path>/testapp/</context.path>
+ <deployable.version>4.0.0-SNAPSHOT</deployable.version>
+ <tomcat6x.installer.url.unix>file:/qa/home/lfryc/apache-tomcat-6.0.26--jsf2.zip</tomcat6x.installer.url.unix>
+ <container.dir.deflatted>apache-tomcat-6.0.26--jsf2</container.dir.deflatted>
+ </properties>
- <dependencies>
- <dependency>
- <groupId>org.richfaces.examples</groupId>
- <artifactId>testapp</artifactId>
- <type>${deployable.type}</type>
- <version>${deployable.version}</version>
- </dependency>
- <dependency>
- <groupId>org.richfaces.tests.testapp</groupId>
- <artifactId>test-source</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
+ <dependencies>
+ <dependency>
+ <groupId>org.richfaces.examples</groupId>
+ <artifactId>testapp</artifactId>
+ <type>${deployable.type}</type>
+ <version>${deployable.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.richfaces.tests.testapp</groupId>
+ <artifactId>test-source</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
- <profiles>
- <profile>
- <id>container-deploy-artifact</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.cargo</groupId>
- <artifactId>cargo-maven2-plugin</artifactId>
- <configuration>
- <deployer>
- <type>installed</type>
- <deployables>
- <deployable>
- <groupId>org.richfaces.examples</groupId>
- <artifactId>testapp</artifactId>
- <type>${deployable.type}</type>
- <properties>
- <context>${context.deploy.path}</context>
- </properties>
- </deployable>
- </deployables>
- </deployer>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
- <profile>
- <id>unpack-test-source</id>
- <activation>
- <activeByDefault>true</activeByDefault>
- </activation>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>unpack-test-source</id>
- <phase>process-test-classes</phase>
- <goals>
- <goal>unpack-dependencies</goal>
- </goals>
- <configuration>
- <includeGroupIds>org.richfaces.tests.testapp</includeGroupIds>
- <includeArtifactIds>test-source</includeArtifactIds>
- <includes>**</includes>
- <outputDirectory>target/test-classes</outputDirectory>
- <overWriteReleases>true</overWriteReleases>
- <overWriteSnapshots>true</overWriteSnapshots>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
- </profiles>
+ <profiles>
+ <profile>
+ <id>container-deploy-artifact</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.cargo</groupId>
+ <artifactId>cargo-maven2-plugin</artifactId>
+ <configuration>
+ <deployer>
+ <type>installed</type>
+ <deployables>
+ <deployable>
+ <groupId>org.richfaces.examples</groupId>
+ <artifactId>testapp</artifactId>
+ <type>${deployable.type}</type>
+ <properties>
+ <context>${context.deploy.path}</context>
+ </properties>
+ </deployable>
+ </deployables>
+ </deployer>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <id>unpack-test-source</id>
+ <activation>
+ <activeByDefault>true</activeByDefault>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>unpack-test-source</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>unpack-dependencies</goal>
+ </goals>
+ <configuration>
+ <includeGroupIds>org.richfaces.tests.testapp</includeGroupIds>
+ <includeArtifactIds>test-source</includeArtifactIds>
+ <includes>**</includes>
+ <outputDirectory>target/test-classes</outputDirectory>
+ <overWriteReleases>true</overWriteReleases>
+ <overWriteSnapshots>true</overWriteSnapshots>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ <profile>
+ <!--
+ activate when debugging in Eclipse and use internal dependencies
+ resolution
+ -->
+ <id>copy-test-source</id>
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-test-classes</id>
+ <phase>process-test-classes</phase>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ <configuration>
+ <tasks>
+ <copy todir="target/test-classes/">
+ <fileset dir="../testapp-tests/test-source/target/classes/">
+ <include name="**/*.*" />
+ </fileset>
+ </copy>
+ </tasks>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- <executions>
- <execution>
- <id>functional-test</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <suiteXmlFiles>
- <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
- </suiteXmlFiles>
- <argLine>${surefire.argline} -Dtemplates='${templates}'</argLine>
- <properties>
- <property>
- <name>listener</name>
- <value>org.jboss.test.selenium.listener.ConsoleStatusTestListener</value>
- </property>
- </properties>
- </configuration>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>functional-test</id>
+ <phase>integration-test</phase>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <suiteXmlFiles>
+ <suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
+ </suiteXmlFiles>
+ <argLine>${surefire.argline} -Dtemplates='${templates}'</argLine>
+ <properties>
+ <property>
+ <name>listener</name>
+ <value>org.jboss.test.selenium.listener.ConsoleStatusTestListener</value>
+ </property>
+ </properties>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
</project>
14 years, 6 months
JBoss Rich Faces SVN: r17882 - root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:55:54 -0400 (Sat, 10 Jul 2010)
New Revision: 17882
Added:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java
Log:
ScrollerTestCase for internal and external dataTable's dataScroller
Added: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataScroller.java 2010-07-10 20:55:54 UTC (rev 17882)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.tests.testapp.richExtendedDataTable;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.*;
+import static org.jboss.test.selenium.framework.AjaxSelenium.getCurrentSelenium;
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.*;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class DataScroller {
+ JQueryLocator scrollerRoot;
+ JQueryLocator pageNumbers = jq(".rf-ds-dtl");
+ JQueryLocator firstPageButton = jq(".rf-ds-l[id$=ds_f]");
+ JQueryLocator lastPageButton = jq(".rf-ds-r:eq(1)");
+ JQueryLocator lastVisiblePage = jq(".rf-ds-dtl:last");
+ JQueryLocator currentPage = jq(".rf-ds-cur");
+
+ public DataScroller(JQueryLocator scrollerRoot) {
+ this.scrollerRoot = scrollerRoot;
+ }
+
+ public JQueryLocator getRoot() {
+ return scrollerRoot;
+ }
+
+ public void gotoFirstPage() {
+ if (!isFirstPage()) {
+ clickFirstPageButton();
+ }
+ }
+
+ public void gotoLastPage() {
+ if (!isLastPage()) {
+ clickLastPageButton();
+ }
+ }
+
+ public void clickLastPageButton() {
+ JQueryLocator locator = scrollerRoot.getDescendant(lastPageButton);
+ guardXhr(getCurrentSelenium()).click(locator);
+ }
+
+ public void clickFirstPageButton() {
+ JQueryLocator locator = scrollerRoot.getDescendant(firstPageButton);
+ guardXhr(getCurrentSelenium()).click(locator);
+ }
+
+ public int getCountOfVisiblePages() {
+ JQueryLocator locator = scrollerRoot.getDescendant(pageNumbers);
+ return getCurrentSelenium().getCount(locator);
+ }
+
+ public boolean hasPages() {
+ JQueryLocator locator = scrollerRoot.getDescendant(lastVisiblePage);
+ return getCurrentSelenium().isElementPresent(locator);
+ }
+
+ public Integer getLastVisiblePage() {
+ JQueryLocator locator = scrollerRoot.getDescendant(lastVisiblePage);
+ if (!hasPages()) {
+ return null;
+ }
+ return integer(getCurrentSelenium().getText(locator));
+ }
+
+ public int getCurrentPage() {
+ JQueryLocator locator = scrollerRoot.getDescendant(currentPage);
+ if (!hasPages()) {
+ return 1;
+ }
+ return integer(getCurrentSelenium().getText(locator));
+ }
+
+ public boolean isFirstPage() {
+ return getCurrentPage() == 1;
+ }
+
+ public boolean isLastPage() {
+ return getCurrentPage() == getLastVisiblePage();
+ }
+
+ public static int integer(String string) {
+ return Integer.valueOf(string);
+ }
+}
Added: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/DataTable.java 2010-07-10 20:55:54 UTC (rev 17882)
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, Red Hat, Inc. and individual contributors
+ * by the @authors tag. See the copyright.txt 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.richfaces.tests.testapp.richExtendedDataTable;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.*;
+import static org.jboss.test.selenium.framework.AjaxSelenium.getCurrentSelenium;
+
+/**
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class DataTable {
+ JQueryLocator tableRoot;
+ JQueryLocator tableRows = jq(".rf-dt-c:nth-child(1)");
+
+ public DataTable(JQueryLocator tableRoot) {
+ super();
+ this.tableRoot = tableRoot;
+ }
+
+ public int getCountOfTableRows() {
+ JQueryLocator locator = tableRoot.getDescendant(tableRows);
+ return getCurrentSelenium().getCount(locator);
+
+ }
+
+ public static int integer(String string) {
+ return Integer.valueOf(string);
+ }
+}
Modified: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java 2010-07-10 20:55:17 UTC (rev 17881)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java 2010-07-10 20:55:54 UTC (rev 17882)
@@ -32,7 +32,6 @@
import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.testapp.AbstractTestappTestCase;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -55,12 +54,6 @@
final static int TOTAL_ROW_COUNT = 50;
- @Override
- @BeforeMethod(alwaysRun = true)
- public void invalidateSession() {
- super.invalidateSession();
- }
-
@Test(dataProvider = "templates")
public void testDefaultDataScrollerRowCount(String templates) {
testRowCount(dataScroller1);
@@ -71,27 +64,21 @@
testRowCount(dataScroller2);
}
- // @Test(dataProvider = "templates")
- // public void testBothDataScrollerRowCount(String templates) {
- // testRowCount(dataScroller1);
- // invalidateSession();
- // testRowCount(dataScroller2);
- // }
-
- public void testRowCount(DataScroller dataScroller) {
- for (Integer rowsPerPage : new Integer[]{null, 10, 1, TOTAL_ROW_COUNT, TOTAL_ROW_COUNT + 1, 2 * TOTAL_ROW_COUNT}) {
+ private void testRowCount(DataScroller dataScroller) {
+ for (Integer rowsPerPage : new Integer[]{null, 10, 1, TOTAL_ROW_COUNT, 13, 9, 17, TOTAL_ROW_COUNT + 1, 2 * TOTAL_ROW_COUNT}) {
if (rowsPerPage != null) {
selenium.type(attributeRowsInput, String.valueOf(rowsPerPage));
guardHttp(selenium).fireEvent(attributeRowsInput, Event.BLUR);
}
+ dataScroller.gotoFirstPage();
int rowCountPreset = Integer.valueOf(selenium.getValue(attributeRowsInput));
int rowCountActual = table.getCountOfTableRows();
- assertEquals(table.getCountOfTableRows(), Math.min(TOTAL_ROW_COUNT, rowCountPreset));
+ assertEquals(rowCountActual, Math.min(TOTAL_ROW_COUNT, rowCountPreset));
assertEquals(dataScroller.hasPages(), rowCountActual < TOTAL_ROW_COUNT);
if (dataScroller.hasPages()) {
- dataScroller.clickLastPage();
+ dataScroller.gotoLastPage();
int pagesExpected = pageCountActual(rowCountActual);
int countOfVisiblePages = dataScroller.getCountOfVisiblePages();
14 years, 6 months