Author: ppitonak(a)redhat.com
Date: 2010-09-23 10:37:35 -0400 (Thu, 23 Sep 2010)
New Revision: 19324
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectMany.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectOne.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectBooleanCheckbox.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyCheckbox.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyListbox.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyMenu.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneListbox.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneMenu.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneRadio.java
Log:
https://jira.jboss.org/browse/RFPL-817
* added new Selenium tests for a4j:ajax with various components
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectMany.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectMany.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectMany.java 2010-09-23
14:37:35 UTC (rev 19324)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * 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.jboss.test.selenium.locator.option.OptionLocatorFactory.optionValue;
+import static org.testng.Assert.assertEquals;
+
+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;
+
+/**
+ * Abstract test case for testing h:selectManyMenu and h:selectManyListbox with
a4j:ajax.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public abstract class AbstractTestSelectMany extends AbstractMetamerTest {
+
+ private JQueryLocator output1 = pjq("span[id$=output1]");
+ private JQueryLocator output2 = pjq("span[id$=output2]");
+
+ public void testClick(JQueryLocator input) {
+ guardXhr(selenium).addSelection(input, optionValue("Audi"));
+
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("[Ferrari, Lexus]",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "[Audi, Ferrari, Lexus]", "Wrong
output1");
+ assertEquals(selenium.getText(output2), "[Audi, Ferrari, Lexus]",
"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();
+
+ guardXhr(selenium).addSelection(input, optionValue("Audi"));
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "[Ferrari, Lexus]",
"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);
+
+ guardXhr(selenium).addSelection(input, optionValue("Audi"));
+ 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();
+
+ guardXhr(selenium).addSelection(input, optionValue("Audi"));
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "[Audi, Ferrari, Lexus]",
"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();
+
+ guardXhr(selenium).addSelection(input, optionValue("Audi"));
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "[Ferrari, Lexus]",
"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);
+
+ guardXhr(selenium).addSelection(input, optionValue("Audi"));
+ 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 =
\"\";"));
+
+ guardXhr(selenium).addSelection(input, optionValue("Audi"));
+ 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();
+
+ guardXhr(selenium).addSelection(input, optionValue("Audi"));
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "[Audi, Ferrari, Lexus]", "Wrong
output1");
+ assertEquals(selenium.getText(output2), "[Ferrari, Lexus]", "Wrong
output2");
+ }
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectMany.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectOne.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectOne.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectOne.java 2010-09-23
14:37:35 UTC (rev 19324)
@@ -0,0 +1,163 @@
+/*******************************************************************************
+ * 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.jboss.test.selenium.locator.option.OptionLocatorFactory.optionValue;
+import static org.testng.Assert.assertEquals;
+
+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;
+
+/**
+ * Abstract test case for testing h:selectOneMenu and h:selectOneListbox with a4j:ajax.
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public abstract class AbstractTestSelectOne extends AbstractMetamerTest {
+
+ private JQueryLocator output1 = pjq("span[id$=output1]");
+ private JQueryLocator output2 = pjq("span[id$=output2]");
+
+ public void testClick(JQueryLocator input) {
+ guardXhr(selenium).select(input, optionValue("Audi"));
+
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("[Ferrari, Lexus]",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "Audi", "Wrong output1");
+ assertEquals(selenium.getText(output2), "Audi", "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();
+
+ guardXhr(selenium).select(input, optionValue("Audi"));
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "Ferrari", "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);
+
+ guardXhr(selenium).select(input, optionValue("Audi"));
+ 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();
+
+ guardXhr(selenium).select(input, optionValue("Audi"));
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "Audi", "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();
+
+ guardXhr(selenium).select(input, optionValue("Audi"));
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "Ferrari", "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);
+
+ guardXhr(selenium).select(input, optionValue("Audi"));
+ 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 =
\"\";"));
+
+ guardXhr(selenium).select(input, optionValue("Audi"));
+ 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();
+
+ guardXhr(selenium).select(input, optionValue("Audi"));
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "Audi", "Wrong output1");
+ assertEquals(selenium.getText(output2), "Ferrari", "Wrong
output2");
+ }
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/AbstractTestSelectOne.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectBooleanCheckbox.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectBooleanCheckbox.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectBooleanCheckbox.java 2010-09-23
14:37:35 UTC (rev 19324)
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * 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 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 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;
+
+/**
+ * Test case for page /faces/components/a4jAjax/hSelectBooleanCheckbox.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHSelectBooleanCheckbox extends AbstractMetamerTest {
+
+ private JQueryLocator input =
pjq("input[type=checkbox][id$=selectBooleanCheckbox]");
+ private JQueryLocator output1 = pjq("div[id$=output1]");
+ private JQueryLocator output2 = pjq("div[id$=output2]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/a4jAjax/hSelectBooleanCheckbox.xhtml");
+ }
+
+ @Test
+ public void testSimpleClick() {
+ guardXhr(selenium).click(input);
+
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("false",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "true", "Wrong output1");
+ assertEquals(selenium.getText(output2), "true", "Wrong
output2");
+ }
+
+ @Test
+ public void testBypassUpdates() {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=bypassUpdatesInput]"));
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "false", "Output should
not change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
+ public void testData() {
+ 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);
+
+ guardXhr(selenium).click(input);
+ 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");
+ }
+
+ @Test
+ public void testImmediate() {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=immediateInput]"));
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "true", "Output should
change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
+ public void testImmediateBypassUpdates() {
+ 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();
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "false", "Output should
not change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
+ public void testLimitRender() {
+ selenium.click(pjq("input[type=checkbox][id$=limitRenderInput]"));
+ selenium.waitForPageToLoad();
+
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange("",
retrieveText.locator(output1));
+
+ assertEquals(selenium.getText(time), timeValue, "Ajax-rendered
a4j:outputPanel shouldn't change");
+ }
+
+ @Test
+ public void testEvents() {
+ 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 =
\"\";"));
+
+ guardXhr(selenium).click(input);
+ 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");
+ }
+
+ @Test
+ public void testRender() {
+ selenium.type(pjq("input[type=text][id$=renderInput]"),
"output1");
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(input);
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("false",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "true", "Wrong output1");
+ assertEquals(selenium.getText(output2), "false", "Wrong
output2");
+ }
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectBooleanCheckbox.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyCheckbox.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyCheckbox.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyCheckbox.java 2010-09-23
14:37:35 UTC (rev 19324)
@@ -0,0 +1,180 @@
+/*******************************************************************************
+ * 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 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 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;
+
+/**
+ * Test case for page /faces/components/a4jAjax/hSelectManyCheckbox.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHSelectManyCheckbox extends AbstractMetamerTest {
+
+ private JQueryLocator input = pjq("table[id$=selectManyCheckbox]
input[value=Audi]");
+ private JQueryLocator output1 = pjq("span[id$=output1]");
+ private JQueryLocator output2 = pjq("span[id$=output2]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/a4jAjax/hSelectManyCheckbox.xhtml");
+ }
+
+ @Test
+ public void testSimpleClick() {
+ guardXhr(selenium).click(input);
+
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("[Ferrari, Lexus]",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "[Audi, Ferrari, Lexus]", "Wrong
output1");
+ assertEquals(selenium.getText(output2), "[Audi, Ferrari, Lexus]",
"Wrong output2");
+ }
+
+ @Test
+ public void testBypassUpdates() {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=bypassUpdatesInput]"));
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "[Ferrari, Lexus]",
"Output should not change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
+ public void testData() {
+ 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);
+
+ guardXhr(selenium).click(input);
+ 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");
+ }
+
+ @Test
+ public void testImmediate() {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=immediateInput]"));
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "[Audi, Ferrari, Lexus]",
"Output should change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
+ public void testImmediateBypassUpdates() {
+ 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();
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "[Ferrari, Lexus]",
"Output should not change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
+ public void testLimitRender() {
+ selenium.click(pjq("input[type=checkbox][id$=limitRenderInput]"));
+ selenium.waitForPageToLoad();
+
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange("",
retrieveText.locator(output1));
+
+ assertEquals(selenium.getText(time), timeValue, "Ajax-rendered
a4j:outputPanel shouldn't change");
+ }
+
+ @Test
+ public void testEvents() {
+ 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 =
\"\";"));
+
+ guardXhr(selenium).click(input);
+ 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");
+ }
+
+ @Test
+ public void testRender() {
+ selenium.type(pjq("input[type=text][id$=renderInput]"),
"output1");
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(input);
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "[Audi, Ferrari, Lexus]", "Wrong
output1");
+ assertEquals(selenium.getText(output2), "[Ferrari, Lexus]", "Wrong
output2");
+ }
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyCheckbox.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyListbox.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyListbox.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyListbox.java 2010-09-23
14:37:35 UTC (rev 19324)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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/hSelectManyListbox.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHSelectManyListbox extends AbstractTestSelectMany {
+
+ private JQueryLocator input = pjq("select[id$=selectManyListbox]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/a4jAjax/hSelectManyListbox.xhtml");
+ }
+
+ @Test
+ public void testSimpleClick() {
+ super.testClick(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/TestHSelectManyListbox.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyMenu.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyMenu.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectManyMenu.java 2010-09-23
14:37:35 UTC (rev 19324)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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/hSelectManyMenu.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHSelectManyMenu extends AbstractTestSelectMany {
+
+ private JQueryLocator input = pjq("select[id$=selectManyMenu]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/a4jAjax/hSelectManyMenu.xhtml");
+ }
+
+ @Test
+ public void testSimpleClick() {
+ super.testClick(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/TestHSelectManyMenu.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneListbox.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneListbox.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneListbox.java 2010-09-23
14:37:35 UTC (rev 19324)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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/hSelectOneListbox.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHSelectOneListbox extends AbstractTestSelectOne {
+
+ private JQueryLocator input = pjq("select[id$=selectOneListbox]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/a4jAjax/hSelectOneListbox.xhtml");
+ }
+
+ @Test
+ public void testSimpleClick() {
+ super.testClick(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/TestHSelectOneListbox.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneMenu.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneMenu.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneMenu.java 2010-09-23
14:37:35 UTC (rev 19324)
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * 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/hSelectOneMenu.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHSelectOneMenu extends AbstractTestSelectOne {
+
+ private JQueryLocator input = pjq("select[id$=selectOneMenu]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/a4jAjax/hSelectOneMenu.xhtml");
+ }
+
+ @Test
+ public void testSimpleClick() {
+ super.testClick(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/TestHSelectOneMenu.java
___________________________________________________________________
Name: svn:keywords
+ Revision
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneRadio.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneRadio.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneRadio.java 2010-09-23
14:37:35 UTC (rev 19324)
@@ -0,0 +1,178 @@
+/*******************************************************************************
+ * 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.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;
+
+/**
+ * Test case for page /faces/components/a4jAjax/hSelectOneRadio.xhtml
+ *
+ * @author <a href="mailto:ppitonak@redhat.com">Pavol Pitonak</a>
+ * @version $Revision$
+ */
+public class TestHSelectOneRadio extends AbstractMetamerTest {
+
+ private JQueryLocator input = pjq("table[id$=selectOneRadio]
input[type=radio][value=Audi]");
+ private JQueryLocator output1 = pjq("span[id$=output1]");
+ private JQueryLocator output2 = pjq("span[id$=output2]");
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/a4jAjax/hSelectOneRadio.xhtml");
+ }
+
+ @Test
+ public void testSimpleClick() {
+ guardXhr(selenium).click(input);
+
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("[Ferrari, Lexus]",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "Audi", "Wrong output1");
+ assertEquals(selenium.getText(output2), "Audi", "Wrong
output2");
+ }
+
+ @Test
+ public void testBypassUpdates() {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=bypassUpdatesInput]"));
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "Ferrari", "Output should
not change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
+ public void testData() {
+ 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);
+
+ guardXhr(selenium).click(input);
+ 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");
+ }
+
+ @Test
+ public void testImmediate() {
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ selenium.click(pjq("input[type=checkbox][id$=immediateInput]"));
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "Audi", "Output should
change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
+ public void testImmediateBypassUpdates() {
+ 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();
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ assertEquals(selenium.getText(output1), "Ferrari", "Output should
not change");
+ assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.RENDER_RESPONSE);
+ }
+
+ @Test
+ public void testLimitRender() {
+ selenium.click(pjq("input[type=checkbox][id$=limitRenderInput]"));
+ selenium.waitForPageToLoad();
+
+ JQueryLocator time = jq("span[id$=requestTime]");
+ String timeValue = selenium.getText(time);
+
+ guardXhr(selenium).click(input);
+ waitGui.failWith("Page was not updated").waitForChange("",
retrieveText.locator(output1));
+
+ assertEquals(selenium.getText(time), timeValue, "Ajax-rendered
a4j:outputPanel shouldn't change");
+ }
+
+ @Test
+ public void testEvents() {
+ 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 =
\"\";"));
+
+ guardXhr(selenium).click(input);
+ 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");
+ }
+
+ @Test
+ public void testRender() {
+ selenium.type(pjq("input[type=text][id$=renderInput]"),
"output1");
+ selenium.waitForPageToLoad();
+
+ guardXhr(selenium).click(input);
+ String outputValue = waitGui.failWith("Page was not
updated").waitForChangeAndReturn("",
+ retrieveText.locator(output1));
+
+ assertEquals(outputValue, "Audi", "Wrong output1");
+ assertEquals(selenium.getText(output2), "Ferrari", "Wrong
output2");
+ }
+}
Property changes on:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/a4jAjax/TestHSelectOneRadio.java
___________________________________________________________________
Name: svn:keywords
+ Revision