Author: lfryc(a)redhat.com
Date: 2010-09-24 02:38:53 -0400 (Fri, 24 Sep 2010)
New Revision: 19330
Added:
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/.gitignore
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/pom.xml
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/release.sh
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/java/
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/java/org/
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/java/org/richfaces/
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/java/org/richfaces/tests/
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/java/org/richfaces/tests/archetypes/
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/java/org/richfaces/tests/archetypes/simpleapp/
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/java/org/richfaces/tests/archetypes/simpleapp/TestInput.java
Log:
import of functional test (RF-8949)
Added: modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/.gitignore
===================================================================
--- modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/.gitignore
(rev 0)
+++ modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/.gitignore 2010-09-24
06:38:53 UTC (rev 19330)
@@ -0,0 +1,6 @@
+/.classpath
+/.project
+/.settings
+/target
+/test-output
+/profiles.xml
Added: modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/pom.xml
===================================================================
--- modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/pom.xml
(rev 0)
+++ modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/pom.xml 2010-09-24 06:38:53
UTC (rev 19330)
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+ <!--
+ 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.
+ -->
+
+<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/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>functional-test-jboss-ci-template</artifactId>
+ <groupId>org.jboss.test.richfaces-selenium</groupId>
+ <version>1.5.2-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.tests.archetypes</groupId>
+ <artifactId>richfaces-simpleapp-ftest</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>richfaces-simpleapp-ftest</name>
+ <description>Functional Test for
richfaces-archetype-simpleapp</description>
+
+ <scm>
+ <
connection>scm:svn:http://anonsvn.jboss.org/repos/richfaces/modules/te...
+ <
developerConnection>scm:svn:https://svn.jboss.org/repos/richfaces/modu...
+ <
url>http://fisheye.jboss.org/browse/RichFaces/modules/tests/archetypes...
+ </scm>
+
+ <licenses>
+ <license>
+ <name>GNU Lesser General Public License, Version 2.1</name>
+ <distribution>repo</distribution>
+ <
url>http://www.gnu.org/licenses/lgpl-2.1.txt</url>
+ </license>
+ </licenses>
+
+ <developers>
+ <developer>
+ <name>Lukas Fryc</name>
+ <email>lfryc(a)redhat.com</email>
+ </developer>
+ </developers>
+
+ <issueManagement>
+ <system>jira</system>
+ <
url>https://jira.jboss.org/jira/browse/RFPL</url>
+ </issueManagement>
+
+ <distributionManagement>
+ <snapshotRepository>
+ <id>jboss-qa-snapshots</id>
+ <name>JBoss QA snapshot repository</name>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/snapshots</url>
+ </snapshotRepository>
+ <repository>
+ <id>jboss-qa-releases</id>
+ <name>JBoss QA selease repository</name>
+ <url>http://nexus.qa.jboss.com:8081/nexus/content/repositories/releases</url>
+ </repository>
+ </distributionManagement>
+
+ <properties>
+ <context.path>/richfaces-simpleapp/</context.path>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <test>*</test>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-release-plugin</artifactId>
+ <configuration>
+ <arguments>-Dselenium.test.skip=true
-Dselenium.server.skip=true</arguments>
+
<
tagBase>https://svn.jboss.org/repos/richfaces/modules/tests/archetypes...
+
<
branchBase>https://svn.jboss.org/repos/richfaces/modules/tests/archety...
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
Added: modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/release.sh
===================================================================
--- modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/release.sh
(rev 0)
+++ modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/release.sh 2010-09-24
06:38:53 UTC (rev 19330)
@@ -0,0 +1,24 @@
+#!/bin/bash
+read -p 'Enter release version: ' RELEASE
+read -p 'Enter new development version: ' DEVELOPMENT
+read -p 'Enter path to the settings.xml: ' MVN_SETTINGS
+
+CONF="--batch-mode -Dtag=metamer-${RELEASE} -DreleaseVersion=${RELEASE}
-DdevelopmentVersion=${DEVELOPMENT}"
+
+if [ -n "$MVN_SETTINGS" ]; then
+ echo "**** NIE JE PRAZDNE $MVN_SETTINGS"
+ CONF="$CONF -s $MVN_SETTINGS";
+fi
+
+echo "Configuration: ${CONF}"
+
+read -p 'Press ENTER to clean...'
+mvn release:clean clean ${CONF}
+read -p 'Press ENTER to dry run...'
+mvn release:prepare -DdryRun=true ${CONF} || exit 1
+read -p 'Press ENTER to clean...'
+mvn release:clean ${CONF}
+read -p 'Press ENTER to prepare...'
+mvn clean release:prepare ${CONF} || exit 1
+read -p 'Press ENTER to perform...'
+mvn release:perform ${CONF} || exit 1
Added:
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/java/org/richfaces/tests/archetypes/simpleapp/TestInput.java
===================================================================
---
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/java/org/richfaces/tests/archetypes/simpleapp/TestInput.java
(rev 0)
+++
modules/tests/archetypes/richfaces-simpleapp-ftest/trunk/src/test/java/org/richfaces/tests/archetypes/simpleapp/TestInput.java 2010-09-24
06:38:53 UTC (rev 19330)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * 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.archetypes.simpleapp;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.waitXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.id;
+import static org.jboss.test.selenium.utils.text.SimplifiedFormat.format;
+import static org.testng.Assert.assertEquals;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.jboss.test.selenium.AbstractTestCase;
+import org.jboss.test.selenium.dom.Event;
+import org.jboss.test.selenium.locator.ElementLocator;
+import org.testng.annotations.Test;
+
+/**
+ * <p>
+ * Tests that input reacts to keyup events by sending XHR request and rerendering output
as greeting to given name.
+ * </p>
+ *
+ * <p>
+ * If input has empty value, output is also empty.
+ * </p>
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+public class TestInput extends AbstractTestCase {
+
+ final String inputName = "RichFaces Fan";
+ Pattern pattern = Pattern.compile("Hello ([\\w ]+)!");
+
+ ElementLocator<?> input = id("nameInput");
+ ElementLocator<?> output = id("output");
+
+ @Test
+ public void test() {
+ selenium.open(contextPath);
+ selenium.waitForPageToLoad();
+
+ for (int i = 0; i <= inputName.length(); i++) {
+ String nameToType = inputName.substring(0, i);
+ typeName(nameToType);
+ assertEquals(parseNameFromOutput(), nameToType);
+ }
+
+ typeName("");
+ assertEquals(parseNameFromOutput(), "");
+ }
+
+ private void typeName(String name) {
+ selenium.type(input, name);
+ waitXhr(selenium).fireEvent(input, Event.KEYUP);
+ }
+
+ private String parseNameFromOutput() {
+ String outputText = selenium.getText(output);
+
+ Matcher matcher = pattern.matcher(outputText);
+ if (!matcher.find()) {
+ if ("".equals(outputText)) {
+ return "";
+ }
+ throw new IllegalStateException(format("Output text '{0}'
doesn't match pattern '{1}'", outputText,
+ pattern.toString()));
+ }
+
+ return matcher.group(1);
+ }
+}