Author: ppitonak(a)redhat.com
Date: 2010-09-22 10:57:41 -0400 (Wed, 22 Sep 2010)
New Revision: 19317
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestTextInput.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputSecret.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputText.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputTextarea.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java
Log:
https://jira.jboss.org/browse/RFPL-817
* added tests for h:inputText, h:inputSecret and h:inputTextarea with a4j:ajax
* removed unnecessary imports in TestHInputText
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java 2010-09-22
14:52:51 UTC (rev 19316)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestCommand.java 2010-09-22
14:57:41 UTC (rev 19317)
@@ -23,17 +23,13 @@
import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
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 javax.faces.event.PhaseId;
import org.jboss.test.selenium.encapsulated.JavaScript;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
-import org.testng.annotations.Test;
/**
* Abstract test case for testing h:commandButton and h:commandLink with a4j:ajax.
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestTextInput.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestTextInput.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestTextInput.java 2010-09-22
14:57:41 UTC (rev 19317)
@@ -0,0 +1,169 @@
+/*******************************************************************************
+ * 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.metamer.ftest.a4jAjax;
+
+import static org.jboss.test.selenium.guard.request.RequestTypeGuardFactory.guardXhr;
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+import static org.testng.Assert.assertEquals;
+
+import javax.faces.event.PhaseId;
+import org.jboss.test.selenium.dom.Event;
+
+import org.jboss.test.selenium.encapsulated.JavaScript;
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+
+/**
+ * Abstract test case for testing h:inputText, h:inputSecret and h:inputTextarea with
a4j:ajax.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public abstract class AbstractTestTextInput extends AbstractMetamerTest {
+
+ private JQueryLocator output1 = pjq("div[id$=output1]");
+ private JQueryLocator output2 = pjq("div[id$=output2]");
+
+ private void typeToInput(JQueryLocator input, String text) {
+ for (char c : text.toCharArray()) {
+ selenium.keyPress(input, String.valueOf(c));
+ guardXhr(selenium).fireEvent(input, Event.KEYUP);
+ }
+ }
+
+ public void testType(JQueryLocator input, String text) {
+ typeToInput(input, text);
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, text, "Wrong output1");
+ assertEquals(selenium.getText(output2), text, "Wrong output2");
+ }
+
+ public void testBypassUpdates(JQueryLocator input) {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=bypassUpdatesInput]"));
+ selenium.waitForPageToLoad();
+
+ typeToInput(input, "RichFaces 4");
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "", "Output should not
change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
+ }
+
+ public void testData(JQueryLocator input) {
+ selenium.type(pjq("input[type=text][id$=dataInput]"), "RichFaces 4
data");
+ selenium.waitForPageToLoad();
+
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"), "data
= event.data");
+ selenium.waitForPageToLoad();
+
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ typeToInput(input, "RichFaces 4");
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ String data = selenium.getEval(new JavaScript("window.data"));
+ assertEquals(data, "RichFaces 4 data", "Data sent with ajax
request");
+ }
+
+ public void testImmediate(JQueryLocator input) {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=immediateInput]"));
+ selenium.waitForPageToLoad();
+
+ typeToInput(input, "RichFaces 4");
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "RichFaces 4", "Output
should change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
+ }
+
+ public void testImmediateBypassUpdates(JQueryLocator input) {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=bypassUpdatesInput]"));
+ selenium.waitForPageToLoad();
+ selenium.click(pjq("input[type=checkbox][id$=immediateInput]"));
+ selenium.waitForPageToLoad();
+
+ typeToInput(input, "RichFaces 4");
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "", "Output should not
change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.RENDER_RESPONSE);
+ }
+
+ public void testLimitRender(JQueryLocator input) {
+ selenium.click(pjq("input[type=checkbox][id$=limitRenderInput]"));
+ selenium.waitForPageToLoad();
+
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ typeToInput(input, "RichFaces 4");
+ waitGui.failWith("Page was not updated").waitForChange("",
retrieveText.locator(output1));
+
+ assertEquals(selenium.getText(time), timeValue, "Ajax-rendered
a4j:outputPanel shouldn't change");
+ }
+
+ public void testEvents(JQueryLocator input) {
+ selenium.type(pjq("input[type=text][id$=onbeginInput]"),
"metamerEvents += \"begin \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=onbeforedomupdateInput]"),
"metamerEvents += \"beforedomupdate \"");
+ selenium.waitForPageToLoad();
+ selenium.type(pjq("input[type=text][id$=oncompleteInput]"),
"metamerEvents += \"complete \"");
+ selenium.waitForPageToLoad();
+
+ selenium.getEval(new JavaScript("window.metamerEvents =
\"\";"));
+
+ typeToInput(input, "RichFaces 4");
+ waitGui.failWith("Page was not updated").waitForChange("",
retrieveText.locator(output1));
+
+ String[] events = selenium.getEval(new
JavaScript("window.metamerEvents")).split(" ");
+
+ assertEquals(events[0], "begin", "Attribute onbegin doesn't
work");
+ assertEquals(events[1], "beforedomupdate", "Attribute
onbeforedomupdate doesn't work");
+ assertEquals(events[2], "complete", "Attribute oncomplete
doesn't work");
+ }
+
+ public void testRender(JQueryLocator input) {
+ selenium.type(pjq("input[type=text][id$=renderInput]"),
"output1");
+ selenium.waitForPageToLoad();
+
+ typeToInput(input, "RichFaces 4");
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "RichFaces 4", "Wrong output1");
+ assertEquals(selenium.getText(output2), "", "Wrong
output2");
+ }
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestTextInput.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputSecret.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputSecret.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputSecret.java 2010-09-22
14:57:41 UTC (rev 19317)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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.metamer.ftest.a4jAjax;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jAjax/hInputSecret.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHInputSecret extends AbstractTestTextInput {
+
+ private JQueryLocator input = pjq("input[type=password][id$=input]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/a4jAjax/hInputSecret.xhtml");
+ }
+
+ @Test
+ public void testSimpleType() {
+ super.testType(input, "RichFaces 4");
+ }
+
+ @Test
+ public void testSimpleTypeUnicode() {
+ super.testType(input, "ľščťžýáíéúôň фывацукйешгщь");
+ }
+
+ @Test
+ public void testBypassUpdates() {
+ super.testBypassUpdates(input);
+ }
+
+ @Test
+ public void testData() {
+ super.testData(input);
+ }
+
+ @Test
+ public void testImmediate() {
+ super.testImmediate(input);
+ }
+
+ @Test
+ public void testImmediateBypassUpdates() {
+ super.testImmediateBypassUpdates(input);
+ }
+
+ @Test
+ public void testLimitRender() {
+ super.testLimitRender(input);
+ }
+
+ @Test
+ public void testEvents() {
+ super.testEvents(input);
+ }
+
+ @Test
+ public void testRender() {
+ super.testRender(input);
+ }
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputSecret.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputText.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputText.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputText.java 2010-09-22
14:57:41 UTC (rev 19317)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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.metamer.ftest.a4jAjax;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jAjax/hInputText.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHInputText extends AbstractTestTextInput {
+
+ private JQueryLocator input = pjq("input[type=text][id$=input]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/a4jAjax/hInputText.xhtml");
+ }
+
+ @Test
+ public void testSimpleType() {
+ super.testType(input, "RichFaces 4");
+ }
+
+ @Test
+ public void testSimpleTypeUnicode() {
+ super.testType(input, "ľščťžýáíéúôň фывацукйешгщь");
+ }
+
+ @Test
+ public void testBypassUpdates() {
+ super.testBypassUpdates(input);
+ }
+
+ @Test
+ public void testData() {
+ super.testData(input);
+ }
+
+ @Test
+ public void testImmediate() {
+ super.testImmediate(input);
+ }
+
+ @Test
+ public void testImmediateBypassUpdates() {
+ super.testImmediateBypassUpdates(input);
+ }
+
+ @Test
+ public void testLimitRender() {
+ super.testLimitRender(input);
+ }
+
+ @Test
+ public void testEvents() {
+ super.testEvents(input);
+ }
+
+ @Test
+ public void testRender() {
+ super.testRender(input);
+ }
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputText.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputTextarea.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputTextarea.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputTextarea.java 2010-09-22
14:57:41 UTC (rev 19317)
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * 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.metamer.ftest.a4jAjax;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+import org.testng.annotations.Test;
+
+/**
+ * Test case for page /faces/components/a4jAjax/hInputTextarea.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHInputTextarea extends AbstractTestTextInput {
+
+ private JQueryLocator input = pjq("textarea[id$=input]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/a4jAjax/hInputTextarea.xhtml");
+ }
+
+ @Test
+ public void testSimpleType() {
+ super.testType(input, "RichFaces 4");
+ }
+
+ @Test
+ public void testSimpleTypeUnicode() {
+ super.testType(input, "ľščťžýáíéúôň фывацукйешгщь");
+ }
+
+ @Test
+ public void testBypassUpdates() {
+ super.testBypassUpdates(input);
+ }
+
+ @Test
+ public void testData() {
+ super.testData(input);
+ }
+
+ @Test
+ public void testImmediate() {
+ super.testImmediate(input);
+ }
+
+ @Test
+ public void testImmediateBypassUpdates() {
+ super.testImmediateBypassUpdates(input);
+ }
+
+ @Test
+ public void testLimitRender() {
+ super.testLimitRender(input);
+ }
+
+ @Test
+ public void testEvents() {
+ super.testEvents(input);
+ }
+
+ @Test
+ public void testRender() {
+ super.testRender(input);
+ }
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHInputTextarea.java
___________________________________________________________________
Name: svn:keywords
+ Revision