JBoss Rich Faces SVN: r17881 - in root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp: richExtendedDataTable and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:55:17 -0400 (Sat, 10 Jul 2010)
New Revision: 17881
Added:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/richExtendedDataTable/ScrollerTestCase.java
Log:
initial commit of ScrollerTestCase
Added: 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 (rev 0)
+++ 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)
@@ -0,0 +1,121 @@
+/*******************************************************************************
+ * 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 static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardHttp;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+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.richfaces.tests.testapp.AbstractTestappTestCase;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/commandButton/simple.xhtml
+ *
+ * @author <a href="mailto:lfryc@redhat.com">Lukas Fryc</a>
+ * @version $Revision$
+ */
+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");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/richExtendedDataTable/scroller.xhtml");
+ }
+
+ 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);
+ }
+
+ @Test(dataProvider = "templates")
+ public void testExternalDataScrollerRowCount(String templates) {
+ 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}) {
+ if (rowsPerPage != null) {
+ selenium.type(attributeRowsInput, String.valueOf(rowsPerPage));
+ guardHttp(selenium).fireEvent(attributeRowsInput, Event.BLUR);
+ }
+
+ int rowCountPreset = Integer.valueOf(selenium.getValue(attributeRowsInput));
+ int rowCountActual = table.getCountOfTableRows();
+ assertEquals(table.getCountOfTableRows(), Math.min(TOTAL_ROW_COUNT, rowCountPreset));
+
+ assertEquals(dataScroller.hasPages(), rowCountActual < TOTAL_ROW_COUNT);
+ if (dataScroller.hasPages()) {
+ dataScroller.clickLastPage();
+
+ int pagesExpected = pageCountActual(rowCountActual);
+ int countOfVisiblePages = dataScroller.getCountOfVisiblePages();
+
+ if (countOfVisiblePages < pagesExpected) {
+ int lastVisiblePage = dataScroller.getLastVisiblePage();
+ assertEquals(lastVisiblePage, pageCountActual(rowCountActual));
+ } else {
+ assertEquals(countOfVisiblePages, pagesExpected);
+ }
+
+ rowCountActual = table.getCountOfTableRows();
+ assertEquals(rowCountActual, rowCountLastPage(rowCountPreset));
+ }
+ }
+ }
+
+ int pageCountActual(int rowCountActual) {
+ return Double.valueOf(Math.ceil((double) TOTAL_ROW_COUNT / rowCountActual)).intValue();
+ }
+
+ int rowCountLastPage(int rowCountPreset) {
+ int result = TOTAL_ROW_COUNT % rowCountPreset;
+ return (result == 0) ? rowCountPreset : result;
+ }
+
+}
14 years, 6 months
JBoss Rich Faces SVN: r17880 - in root/tests/metamer/trunk/ftest: test-source/src/main/java/org/richfaces/tests/testapp and 2 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:54:34 -0400 (Sat, 10 Jul 2010)
New Revision: 17880
Added:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jActionListener/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jActionListener/A4JActionListenerTestCase.java
Modified:
root/tests/metamer/trunk/ftest/src/test/resources/testng.xml
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/commandButton/CommandButtonTestCase.java
Log:
* added new test case for a4j:actionListener * test case for command button refactored * added factory method for jQuery selectors
Modified: root/tests/metamer/trunk/ftest/src/test/resources/testng.xml
===================================================================
--- root/tests/metamer/trunk/ftest/src/test/resources/testng.xml 2010-07-10 20:53:48 UTC (rev 17879)
+++ root/tests/metamer/trunk/ftest/src/test/resources/testng.xml 2010-07-10 20:54:34 UTC (rev 17880)
@@ -1,10 +1,10 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="seleniumTest">
- <test name="SimpleComponents">
- <parameter name="templates" value="plain redDiv redDiv,blueDiv "/>
+ <test name="Component Tests">
+ <parameter name="templates" value="plain richDataTable1,redDiv richDataTable2,redDiv a4jRepeat1 a4jRepeat2 hDataTable1 hDataTable2 uiRepeat1 uiRepeat2"/>
<packages>
- <package name="org.richfaces.tests.testapp.commandButton" />
+ <package name="org.richfaces.tests.testapp" />
</packages>
</test>
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:53:48 UTC (rev 17879)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 20:54:34 UTC (rev 17880)
@@ -22,7 +22,6 @@
package org.richfaces.tests.testapp;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
@@ -109,17 +108,18 @@
urlParams = "?templates=" + templates[0];
}
selenium.open(buildUrl(getTestUrl() + urlParams));
+ selenium.waitForPageToLoad(TIMEOUT);
}
/**
* Invalidates session by clicking on a button on tested page.
*/
public void invalidateSession() {
- JQueryLocator invalidateButton = jq("#form input[value=Invalidate Session]");
+ JQueryLocator invalidateButton = new JQueryLocator("input[value=Invalidate Session]");
selenium.click(invalidateButton);
selenium.waitForPageToLoad(TIMEOUT);
}
-
+
/**
* Forces the current thread sleep for given time.
*
@@ -134,4 +134,19 @@
e.printStackTrace();
}
}
+
+ /**
+ * Factory method for creating instances of class JQueryLocator which locates the element using <a
+ * href="http://api.jquery.com/category/selectors/">JQuery Selector</a> syntax. It adds "div.content " in front of
+ * each selector.
+ *
+ * @param jquerySelector
+ * the jquery selector
+ * @return the j query locator
+ * @see JQueryLocator
+ */
+ public static JQueryLocator pjq(String jquerySelector) {
+ return new JQueryLocator("div.content " + jquerySelector);
+ }
+
}
Added: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jActionListener/A4JActionListenerTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jActionListener/A4JActionListenerTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/a4jActionListener/A4JActionListenerTestCase.java 2010-07-10 20:54:34 UTC (rev 17880)
@@ -0,0 +1,136 @@
+/*******************************************************************************
+ * 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.a4jActionListener;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.ElementLocator;
+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/a4jActionListener/all.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class A4JActionListenerTestCase extends AbstractTestappTestCase {
+
+ private ElementLocator invokeButtonType = pjq("input[id$=invokeByTypeButton]");
+ private ElementLocator invokeButtonBinding = pjq("input[id$=invokeByBindingButton]");
+ private ElementLocator invokeButtonMethod = pjq("input[id$=invokeMethodButton]");
+ private ElementLocator invokeButtonCC = pjq("input[id$=invokeFromCCButton:button]");
+ private JQueryLocator message = pjq("ul[id$=messages] li");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/a4jActionListener/all.xhtml");
+ }
+
+ @Override
+ @AfterMethod(alwaysRun = true)
+ public void invalidateSession() {
+ super.invalidateSession();
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerByType(String templates) {
+ final String hashCodeRegExp = "@[0-9a-fA-F]{1,}$";
+ final String msg = "Implementation of ActionListener created and called: "
+ + "org.richfaces.testapp.bean.A4JActionListenerBean$ActionListenerImpl";
+
+ selenium.click(invokeButtonType);
+ waitGui.until(elementPresent.locator(message));
+ String output1 = selenium.getText(message);
+
+ assertEquals(output1.replaceAll(hashCodeRegExp, ""), msg, "Message after first invocation of listener by type.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+
+ // do the same once again
+
+ selenium.click(invokeButtonType);
+ waitGui.until(elementPresent.locator(message));
+ String output2 = selenium.getText(message);
+
+ assertEquals(output2.replaceAll(hashCodeRegExp, ""), msg, "Message after second invocation of listener by type");
+
+ // check that a new object of ActionListenerImpl was created
+ String hashcode1 = output1.replace(msg, "");
+ String hashcode2 = output2.replace(msg, "");
+ assertFalse(hashcode1.equals(hashcode2), "New object of class ActionListenerImpl should be instantiated.");
+
+ count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerByBinding(String templates) {
+ final String msg = "Bound listener called";
+
+ selenium.click(invokeButtonBinding);
+ waitGui.until(elementPresent.locator(message));
+ String output = selenium.getText(message);
+
+ assertEquals(output, msg, "Message after first invocation of listener by binding.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerMethod(String templates) {
+ final String msg = "Method expression listener called";
+
+ selenium.click(invokeButtonMethod);
+ waitGui.until(elementPresent.locator(message));
+ String output = selenium.getText(message);
+
+ assertEquals(output, msg, "Message after first invocation of listener method.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+ }
+
+ @Test(dataProvider = "templates")
+ public void testInvokeListenerMethodCC(String templates) {
+ final String msg = "Method expression listener called from composite component";
+
+ selenium.click(invokeButtonCC);
+ waitGui.until(elementPresent.locator(message));
+ String output = selenium.getText(message);
+
+ assertEquals(output, msg, "Message after first invocation of listener method from composite component.");
+
+ int count = selenium.getCount(message);
+ assertEquals(count, 1, "Only one message should be displayed on the page.");
+ }
+}
Modified: 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:53:48 UTC (rev 17879)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java 2010-07-10 20:54:34 UTC (rev 17880)
@@ -22,11 +22,10 @@
package org.richfaces.tests.testapp.commandButton;
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+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 static org.jboss.test.selenium.utils.URLUtils.buildUrl;
import java.net.URL;
@@ -36,7 +35,6 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.testapp.AbstractTestappTestCase;
import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -47,11 +45,11 @@
*/
public class CommandButtonTestCase extends AbstractTestappTestCase {
- private JQueryLocator input = jq("#form\\:input");
- private JQueryLocator button = jq("#form\\:commandButton");
- private JQueryLocator output1 = jq("#form\\:output1");
- private JQueryLocator output2 = jq("#form\\:output2");
- private JQueryLocator output3 = jq("#form\\:output3");
+ 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() {
@@ -59,7 +57,7 @@
}
@Override
- @BeforeMethod(alwaysRun=true)
+ @AfterMethod(alwaysRun=true)
public void invalidateSession() {
super.invalidateSession();
}
@@ -100,9 +98,9 @@
@Test(dataProvider = "templates")
public void testAction(String templates) {
- JQueryLocator doubleStringAction = jq("#form\\:attributes\\:actionInput\\:0");
- JQueryLocator first6CharsAction = jq("#form\\:attributes\\:actionInput\\:1");
- JQueryLocator toUpperCaseAction = jq("#form\\:attributes\\:actionInput\\:2");
+ JQueryLocator doubleStringAction = pjq("input[value=doubleStringAction]");
+ JQueryLocator first6CharsAction = pjq("input[value=first6CharsAction]");
+ JQueryLocator toUpperCaseAction = pjq("input[value=toUpperCaseAction]");
selenium.click(doubleStringAction);
selenium.waitForPageToLoad(TIMEOUT);
@@ -132,9 +130,9 @@
@Test(dataProvider = "templates")
public void testActionListener(String templates) {
- JQueryLocator doubleStringActionListener = jq("input[value=doubleStringActionListener]");
- JQueryLocator first6CharsActionListener = jq("input[value=first6CharsActionListener]");
- JQueryLocator toUpperCaseActionListener = jq("input[value=toUpperCaseActionListener]");
+ JQueryLocator doubleStringActionListener = pjq("input[value=doubleStringActionListener]");
+ JQueryLocator first6CharsActionListener = pjq("input[value=first6CharsActionListener]");
+ JQueryLocator toUpperCaseActionListener = pjq("input[value=toUpperCaseActionListener]");
selenium.click(doubleStringActionListener);
selenium.waitForPageToLoad(TIMEOUT);
@@ -165,7 +163,7 @@
@Test(dataProvider = "templates")
public void testDisabled(String templates) {
- JQueryLocator disabledChecbox = jq("#form\\:attributes\\:disabledInput");
+ JQueryLocator disabledChecbox = pjq("input[id$=disabledInput]");
AttributeLocator disabledAttribute = button.getAttribute(new Attribute("disabled"));
selenium.click(disabledChecbox);
@@ -177,7 +175,7 @@
@Test(dataProvider = "templates")
public void testOnclick(String templates) {
- JQueryLocator onclickInput = jq("#form\\:attributes\\:onclickInput");
+ JQueryLocator onclickInput = pjq("input[id$=onclickInput]");
final AttributeLocator onclickAttribute = button.getAttribute(new Attribute("onclick"));
final String value = "alert('onclick')";
@@ -190,11 +188,11 @@
@Test(dataProvider = "templates")
public void testStyleClass(String templates) {
- JQueryLocator blue = jq("table#form\\:attributes\\:styleClassInput input[value=blue]");
- JQueryLocator red = jq("table#form\\:attributes\\:styleClassInput input[value=red]");
- JQueryLocator wide = jq("table#form\\:attributes\\:styleClassInput input[value=wide]");
- JQueryLocator big = jq("table#form\\:attributes\\:styleClassInput input[value=big]");
- JQueryLocator none = jq("table#form\\:attributes\\:styleClassInput input[value=]");
+ 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"));
@@ -221,7 +219,7 @@
@Test(dataProvider = "templates")
public void testStyle(String templates) {
- JQueryLocator styleInput = jq("#form\\:attributes\\:styleInput");
+ JQueryLocator styleInput = pjq("input[id$=styleInput]");
final AttributeLocator attribute = button.getAttribute(new Attribute("style"));
final String value = "font-size: 20px;";
@@ -234,7 +232,7 @@
@Test(dataProvider = "templates")
public void testValue(String templates) {
- JQueryLocator valueInput = jq("#form\\:attributes\\:valueInput");
+ JQueryLocator valueInput = pjq("input[id$=valueInput]");
final AttributeLocator attribute = button.getAttribute(new Attribute("value"));
final String value = "new label";
@@ -245,22 +243,4 @@
assertEquals(selenium.getAttribute(attribute), value, "Value of the button did not change");
}
- // functionality probably not implemented yet
- // @Test(dataProvider = "templates")
- public void testRender(String templates) {
- JQueryLocator renderInput = jq("#form\\:attributes\\:renderInput");
-
- selenium.typeKeys(renderInput, "output1");
- selenium.fireEvent(renderInput, Event.BLUR);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "aaa");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("aaa"));
-
- assertTrue(selenium.isElementPresent(output1), "output1 should be visible");
- assertFalse(selenium.isElementPresent(output2), "output2 should not be visible");
- assertFalse(selenium.isElementPresent(output3), "output3 should not be visible");
- }
-
}
14 years, 6 months
JBoss Rich Faces SVN: r17879 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:53:48 -0400 (Sat, 10 Jul 2010)
New Revision: 17879
Modified:
root/tests/metamer/trunk/ftest/cli.sh
Log:
able to parametrize cli.sh
Modified: root/tests/metamer/trunk/ftest/cli.sh
===================================================================
--- root/tests/metamer/trunk/ftest/cli.sh 2010-07-10 20:53:35 UTC (rev 17878)
+++ root/tests/metamer/trunk/ftest/cli.sh 2010-07-10 20:53:48 UTC (rev 17879)
@@ -1,2 +1,2 @@
#!/bin/bash
-mvn cli:execute-phase
+mvn cli:execute-phase $*
14 years, 6 months
JBoss Rich Faces SVN: r17878 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:53:35 -0400 (Sat, 10 Jul 2010)
New Revision: 17878
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
* added argLine attribute to surefire plugin
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 20:53:21 UTC (rev 17877)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 20:53:35 UTC (rev 17878)
@@ -1,132 +1,133 @@
<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>
+ </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>
- <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: r17877 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:53:21 -0400 (Sat, 10 Jul 2010)
New Revision: 17877
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
removed testapp classifier (deployed snapshots must be without classifier)
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 20:53:00 UTC (rev 17876)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 20:53:21 UTC (rev 17877)
@@ -20,7 +20,6 @@
<properties>
<context.path>/testapp/</context.path>
<deployable.version>4.0.0-SNAPSHOT</deployable.version>
- <deployable.classifier>tomcat6</deployable.classifier>
<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>
@@ -31,7 +30,6 @@
<artifactId>testapp</artifactId>
<type>${deployable.type}</type>
<version>${deployable.version}</version>
- <classifier>${deployable.classifier}</classifier>
</dependency>
<dependency>
<groupId>org.richfaces.tests.testapp</groupId>
@@ -59,7 +57,6 @@
<deployable>
<groupId>org.richfaces.examples</groupId>
<artifactId>testapp</artifactId>
- <classifier>${deployable.classifier}</classifier>
<type>${deployable.type}</type>
<properties>
<context>${context.deploy.path}</context>
14 years, 6 months
JBoss Rich Faces SVN: r17876 - root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:53:00 -0400 (Sat, 10 Jul 2010)
New Revision: 17876
Modified:
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java
Log:
invalidating session before each method
Modified: 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:52:34 UTC (rev 17875)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java 2010-07-10 20:53:00 UTC (rev 17876)
@@ -36,6 +36,7 @@
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.testapp.AbstractTestappTestCase;
import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
/**
@@ -58,7 +59,7 @@
}
@Override
- @AfterMethod
+ @BeforeMethod(alwaysRun=true)
public void invalidateSession() {
super.invalidateSession();
}
14 years, 6 months
JBoss Rich Faces SVN: r17875 - root/tests/metamer/trunk/ftest.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:52:34 -0400 (Sat, 10 Jul 2010)
New Revision: 17875
Modified:
root/tests/metamer/trunk/ftest/pom.xml
Log:
added module test-source; unpacking of test sources from test-source module
Modified: root/tests/metamer/trunk/ftest/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 20:52:23 UTC (rev 17874)
+++ root/tests/metamer/trunk/ftest/pom.xml 2010-07-10 20:52:34 UTC (rev 17875)
@@ -13,6 +13,10 @@
<version>1.5.0-SNAPSHOT</version>
</parent>
+ <modules>
+ <module>test-source</module>
+ </modules>
+
<properties>
<context.path>/testapp/</context.path>
<deployable.version>4.0.0-SNAPSHOT</deployable.version>
@@ -29,6 +33,12 @@
<version>${deployable.version}</version>
<classifier>${deployable.classifier}</classifier>
</dependency>
+ <dependency>
+ <groupId>org.richfaces.tests.testapp</groupId>
+ <artifactId>test-source</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<profiles>
@@ -62,24 +72,42 @@
</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>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <executions>
- <execution>
- <id>test-jar</id>
- <goals>
- <goal>test-jar</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
14 years, 6 months
JBoss Rich Faces SVN: r17874 - in root/tests/metamer/trunk/ftest: src/test/java/org/richfaces/tests/testapp/commandButton and 9 other directories.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:52:23 -0400 (Sat, 10 Jul 2010)
New Revision: 17874
Added:
root/tests/metamer/trunk/ftest/test-source/src/
root/tests/metamer/trunk/ftest/test-source/src/main/
root/tests/metamer/trunk/ftest/test-source/src/main/java/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/
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/commandButton/
root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java
Removed:
root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java
Log:
moved test sources to test-source module as main sources
Deleted: root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 20:51:14 UTC (rev 17873)
+++ root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 20:52:23 UTC (rev 17874)
@@ -1,137 +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;
-
-import static org.jboss.test.selenium.locator.LocatorFactory.jq;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-
-import java.net.URL;
-
-import org.jboss.test.selenium.AbstractTestCase;
-import org.jboss.test.selenium.locator.JQueryLocator;
-import org.testng.SkipException;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Optional;
-import org.testng.annotations.Parameters;
-
-/**
- * Abstract test case used as a basis for majority of test cases.
- *
- * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
- * @version $Revision$
- */
-public abstract class AbstractTestappTestCase extends AbstractTestCase {
-
- /**
- * timeout in miliseconds
- */
- public static final long TIMEOUT = 5000;
- private String[][] templates;
-
- /**
- * Returns the url to test page to be opened by Selenium
- *
- * @return absolute url to the test page to be opened by Selenium
- */
- public abstract URL getTestUrl();
-
- /**
- * Data provider for templates.
- *
- * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
- * plain template) if nothing is defined
- */
- @DataProvider(name = "templates")
- protected Object[][] getTemplates() {
- if (templates != null && templates.length > 0) {
- return templates;
- }
-
- return new Object[][]{{"plain"}};
- }
-
- /**
- * Loads and parses attribute "templates" from testng.xml.
- *
- * @param urlParams
- */
- @BeforeClass(alwaysRun = true)
- @Parameters({"templates"})
- public void initTemplates(@Optional String urlParams) {
- if (urlParams == null) {
- return;
- }
-
- String[] array = urlParams.split(" ");
- templates = new String[array.length][];
-
- for (int i = 0; i < array.length; i++) {
- templates[i] = new String[1];
- templates[i][0] = array[i];
- }
- }
-
- /**
- * Opens the tested page. If templates is not empty nor null, it appends url parameter with templates.
- *
- * @param templates
- * templates that will be used for test, e.g. "red_div"
- */
- @BeforeMethod(alwaysRun = true)
- public void loadPage(Object[] templates) {
- if (selenium == null) {
- new SkipException("selenium isn't initialized");
- }
- String urlParams = "";
- if (templates != null && templates.length != 0) {
- urlParams = "?templates=" + templates[0];
- }
- selenium.open(buildUrl(getTestUrl() + urlParams));
- }
-
- /**
- * Invalidates session by clicking on a button on tested page.
- */
- public void invalidateSession() {
- JQueryLocator invalidateButton = jq("#form input[value=Invalidate Session]");
- selenium.click(invalidateButton);
- selenium.waitForPageToLoad(TIMEOUT);
- }
-
- /**
- * Forces the current thread sleep for given time.
- *
- * @param millis
- * number of miliseconds for which the thread will sleep
- */
- @Deprecated
- protected void waitFor(long millis) {
- try {
- Thread.sleep(millis);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
-}
Deleted: root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java 2010-07-10 20:51:14 UTC (rev 17873)
+++ root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java 2010-07-10 20:52:23 UTC (rev 17874)
@@ -1,265 +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.locator.LocatorFactory.jq;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
-
-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 = jq("#form\\:input");
- private JQueryLocator button = jq("#form\\:commandButton");
- private JQueryLocator output1 = jq("#form\\:output1");
- private JQueryLocator output2 = jq("#form\\:output2");
- private JQueryLocator output3 = jq("#form\\:output3");
-
- @Override
- public URL getTestUrl() {
- return buildUrl(contextPath, "faces/components/commandButton/simple.xhtml");
- }
-
- @Override
- @AfterMethod
- 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 = jq("#form\\:attributes\\:actionInput\\:0");
- JQueryLocator first6CharsAction = jq("#form\\:attributes\\:actionInput\\:1");
- JQueryLocator toUpperCaseAction = jq("#form\\:attributes\\:actionInput\\:2");
-
- 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 = jq("input[value=doubleStringActionListener]");
- JQueryLocator first6CharsActionListener = jq("input[value=first6CharsActionListener]");
- JQueryLocator toUpperCaseActionListener = jq("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 = jq("#form\\:attributes\\: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 = jq("#form\\:attributes\\: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 = jq("table#form\\:attributes\\:styleClassInput input[value=blue]");
- JQueryLocator red = jq("table#form\\:attributes\\:styleClassInput input[value=red]");
- JQueryLocator wide = jq("table#form\\:attributes\\:styleClassInput input[value=wide]");
- JQueryLocator big = jq("table#form\\:attributes\\:styleClassInput input[value=big]");
- JQueryLocator none = jq("table#form\\:attributes\\:styleClassInput input[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 = jq("#form\\:attributes\\: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 = jq("#form\\:attributes\\: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");
- }
-
- // functionality probably not implemented yet
- // @Test(dataProvider = "templates")
- public void testRender(String templates) {
- JQueryLocator renderInput = jq("#form\\:attributes\\:renderInput");
-
- selenium.typeKeys(renderInput, "output1");
- selenium.fireEvent(renderInput, Event.BLUR);
- selenium.waitForPageToLoad(TIMEOUT);
- selenium.typeKeys(input, "aaa");
- selenium.click(button);
-
- waitGui.until(textEquals.locator(output1).text("aaa"));
-
- assertTrue(selenium.isElementPresent(output1), "output1 should be visible");
- assertFalse(selenium.isElementPresent(output2), "output2 should not be visible");
- assertFalse(selenium.isElementPresent(output3), "output3 should not be visible");
- }
-
-}
Copied: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java (from rev 17873, root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java)
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 20:52:23 UTC (rev 17874)
@@ -0,0 +1,137 @@
+/*******************************************************************************
+ * 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;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.AbstractTestCase;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.SkipException;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Optional;
+import org.testng.annotations.Parameters;
+
+/**
+ * Abstract test case used as a basis for majority of test cases.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public abstract class AbstractTestappTestCase extends AbstractTestCase {
+
+ /**
+ * timeout in miliseconds
+ */
+ public static final long TIMEOUT = 5000;
+ private String[][] templates;
+
+ /**
+ * Returns the url to test page to be opened by Selenium
+ *
+ * @return absolute url to the test page to be opened by Selenium
+ */
+ public abstract URL getTestUrl();
+
+ /**
+ * Data provider for templates.
+ *
+ * @return array containing templates that should be used (defined in testng.xml) or default array (containing only
+ * plain template) if nothing is defined
+ */
+ @DataProvider(name = "templates")
+ protected Object[][] getTemplates() {
+ if (templates != null && templates.length > 0) {
+ return templates;
+ }
+
+ return new Object[][]{{"plain"}};
+ }
+
+ /**
+ * Loads and parses attribute "templates" from testng.xml.
+ *
+ * @param urlParams
+ */
+ @BeforeClass(alwaysRun = true)
+ @Parameters({"templates"})
+ public void initTemplates(@Optional String urlParams) {
+ if (urlParams == null) {
+ return;
+ }
+
+ String[] array = urlParams.split(" ");
+ templates = new String[array.length][];
+
+ for (int i = 0; i < array.length; i++) {
+ templates[i] = new String[1];
+ templates[i][0] = array[i];
+ }
+ }
+
+ /**
+ * Opens the tested page. If templates is not empty nor null, it appends url parameter with templates.
+ *
+ * @param templates
+ * templates that will be used for test, e.g. "red_div"
+ */
+ @BeforeMethod(alwaysRun = true)
+ public void loadPage(Object[] templates) {
+ if (selenium == null) {
+ new SkipException("selenium isn't initialized");
+ }
+ String urlParams = "";
+ if (templates != null && templates.length != 0) {
+ urlParams = "?templates=" + templates[0];
+ }
+ selenium.open(buildUrl(getTestUrl() + urlParams));
+ }
+
+ /**
+ * Invalidates session by clicking on a button on tested page.
+ */
+ public void invalidateSession() {
+ JQueryLocator invalidateButton = jq("#form input[value=Invalidate Session]");
+ selenium.click(invalidateButton);
+ selenium.waitForPageToLoad(TIMEOUT);
+ }
+
+ /**
+ * Forces the current thread sleep for given time.
+ *
+ * @param millis
+ * number of miliseconds for which the thread will sleep
+ */
+ @Deprecated
+ protected void waitFor(long millis) {
+ try {
+ Thread.sleep(millis);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+}
Copied: root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java (from rev 17873, root/tests/metamer/trunk/ftest/src/test/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 (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/src/main/java/org/richfaces/tests/testapp/commandButton/CommandButtonTestCase.java 2010-07-10 20:52:23 UTC (rev 17874)
@@ -0,0 +1,265 @@
+/*******************************************************************************
+ * 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.locator.LocatorFactory.jq;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+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 = jq("#form\\:input");
+ private JQueryLocator button = jq("#form\\:commandButton");
+ private JQueryLocator output1 = jq("#form\\:output1");
+ private JQueryLocator output2 = jq("#form\\:output2");
+ private JQueryLocator output3 = jq("#form\\:output3");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath, "faces/components/commandButton/simple.xhtml");
+ }
+
+ @Override
+ @AfterMethod
+ 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 = jq("#form\\:attributes\\:actionInput\\:0");
+ JQueryLocator first6CharsAction = jq("#form\\:attributes\\:actionInput\\:1");
+ JQueryLocator toUpperCaseAction = jq("#form\\:attributes\\:actionInput\\:2");
+
+ 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 = jq("input[value=doubleStringActionListener]");
+ JQueryLocator first6CharsActionListener = jq("input[value=first6CharsActionListener]");
+ JQueryLocator toUpperCaseActionListener = jq("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 = jq("#form\\:attributes\\: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 = jq("#form\\:attributes\\: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 = jq("table#form\\:attributes\\:styleClassInput input[value=blue]");
+ JQueryLocator red = jq("table#form\\:attributes\\:styleClassInput input[value=red]");
+ JQueryLocator wide = jq("table#form\\:attributes\\:styleClassInput input[value=wide]");
+ JQueryLocator big = jq("table#form\\:attributes\\:styleClassInput input[value=big]");
+ JQueryLocator none = jq("table#form\\:attributes\\:styleClassInput input[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 = jq("#form\\:attributes\\: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 = jq("#form\\:attributes\\: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");
+ }
+
+ // functionality probably not implemented yet
+ // @Test(dataProvider = "templates")
+ public void testRender(String templates) {
+ JQueryLocator renderInput = jq("#form\\:attributes\\:renderInput");
+
+ selenium.typeKeys(renderInput, "output1");
+ selenium.fireEvent(renderInput, Event.BLUR);
+ selenium.waitForPageToLoad(TIMEOUT);
+ selenium.typeKeys(input, "aaa");
+ selenium.click(button);
+
+ waitGui.until(textEquals.locator(output1).text("aaa"));
+
+ assertTrue(selenium.isElementPresent(output1), "output1 should be visible");
+ assertFalse(selenium.isElementPresent(output2), "output2 should not be visible");
+ assertFalse(selenium.isElementPresent(output3), "output3 should not be visible");
+ }
+
+}
14 years, 6 months
JBoss Rich Faces SVN: r17873 - in root/tests/metamer/trunk/ftest: test-source and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:51:14 -0400 (Sat, 10 Jul 2010)
New Revision: 17873
Added:
root/tests/metamer/trunk/ftest/test-source/
root/tests/metamer/trunk/ftest/test-source/pom.xml
Log:
initial structure for test-source module (separation of test-source and test-control)
Added: root/tests/metamer/trunk/ftest/test-source/pom.xml
===================================================================
--- root/tests/metamer/trunk/ftest/test-source/pom.xml (rev 0)
+++ root/tests/metamer/trunk/ftest/test-source/pom.xml 2010-07-10 20:51:14 UTC (rev 17873)
@@ -0,0 +1,34 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <artifactId>root</artifactId>
+ <groupId>org.jboss.test.richfaces-selenium</groupId>
+ <version>1.5.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.richfaces.tests.testapp</groupId>
+ <artifactId>test-source</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <name>RichFaces 4.0 TestApp: Functional Test Source</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.test</groupId>
+ <artifactId>richfaces-selenium</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
14 years, 6 months
JBoss Rich Faces SVN: r17872 - root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp.
by richfaces-svn-commits@lists.jboss.org
Author: lfryc(a)redhat.com
Date: 2010-07-10 16:50:54 -0400 (Sat, 10 Jul 2010)
New Revision: 17872
Modified:
root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
Log:
configuration methods with alwaysRun=true
Modified: root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java
===================================================================
--- root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 20:50:32 UTC (rev 17871)
+++ root/tests/metamer/trunk/ftest/src/test/java/org/richfaces/tests/testapp/AbstractTestappTestCase.java 2010-07-10 20:50:54 UTC (rev 17872)
@@ -29,6 +29,7 @@
import org.jboss.test.selenium.AbstractTestCase;
import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.SkipException;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
@@ -76,7 +77,7 @@
*
* @param urlParams
*/
- @BeforeClass
+ @BeforeClass(alwaysRun = true)
@Parameters({"templates"})
public void initTemplates(@Optional String urlParams) {
if (urlParams == null) {
@@ -98,8 +99,11 @@
* @param templates
* templates that will be used for test, e.g. "red_div"
*/
- @BeforeMethod
+ @BeforeMethod(alwaysRun = true)
public void loadPage(Object[] templates) {
+ if (selenium == null) {
+ new SkipException("selenium isn't initialized");
+ }
String urlParams = "";
if (templates != null && templates.length != 0) {
urlParams = "?templates=" + templates[0];
14 years, 6 months