Author: ppitonak(a)redhat.com
Date: 2010-12-17 09:34:19 -0500 (Fri, 17 Dec 2010)
New Revision: 20648
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java
Log:
* tests for inplace input fixed
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java
===================================================================
---
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java 2010-12-17
14:33:46 UTC (rev 20647)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java 2010-12-17
14:34:19 UTC (rev 20648)
@@ -59,6 +59,7 @@
attributes.setAttribute("defaultLabel", "Click here to
edit");
attributes.setAttribute("editEvent", "click");
attributes.setAttribute("rendered", true);
+ attributes.setAttribute("saveOnBlur", true);
attributes.setAttribute("value", "RichFaces 4");
// TODO has to be tested in another way
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java 2010-12-17
14:33:46 UTC (rev 20647)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java 2010-12-17
14:34:19 UTC (rev 20648)
@@ -35,7 +35,6 @@
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.jboss.test.selenium.waiting.EventFiredCondition;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
@@ -88,6 +87,9 @@
assertEquals(selenium.getText(label), "new value", "Label should
contain selected value.");
assertEquals(selenium.getText(output), "new value", "Output did
not change.");
+
+ String listenerText = selenium.getText(jq("div#phasesPanel
li:eq(3)"));
+ assertEquals(listenerText, "* value changed: RichFaces 4 -> new
value", "Value change listener was not invoked.");
}
@Test
@@ -139,7 +141,7 @@
}
@Test
-
@IssueTracking("https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1805")
+ @IssueTracking("http://java.net/jira/browse/JAVASERVERFACES-1805")
public void testInputWidth() {
selenium.type(pjq("input[type=text][id$=inputWidthInput]"),
"300px");
selenium.waitForPageToLoad();
@@ -168,10 +170,32 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9868")
public void testOnblur() {
- testFireEvent(Event.BLUR, inplaceInput);
+ selenium.type(pjq("input[id$=onblurInput]"), "metamerEvents +=
\"blur \"");
+ selenium.waitForPageToLoad(TIMEOUT);
+
+ selenium.click(inplaceInput);
+ selenium.fireEvent(input, Event.BLUR);
+
+ waitGui.failWith("Attribute onblur does not work correctly").until(new
EventFiredCondition(Event.BLUR));
}
@Test
+ public void testOnchange() {
+ selenium.type(pjq("input[type=text][id$=onchangeInput]"),
"metamerEvents += \"change \"");
+ selenium.waitForPageToLoad();
+
+ String timeValue = selenium.getText(time);
+ selenium.click(inplaceInput);
+ selenium.type(input, "new value");
+ selenium.fireEvent(input, Event.BLUR);
+ waitFor(5000);
+ waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
+
+ waitGui.failWith("Attribute onchange does not work correctly").until(
+ new EventFiredCondition(new Event("change")));
+ }
+
+ @Test
public void testOnclick() {
testFireEvent(Event.CLICK, inplaceInput);
}
@@ -184,28 +208,12 @@
@Test
@IssueTracking("https://jira.jboss.org/browse/RF-9868")
public void testOnfocus() {
- testFireEvent(Event.FOCUS, inplaceInput);
- }
+ selenium.type(pjq("input[id$=onfocusInput]"), "metamerEvents +=
\"focus \"");
+ selenium.waitForPageToLoad(TIMEOUT);
- @Test
- public void testOninputblur() {
- testFireEvent(Event.BLUR, input, "inputblur");
- }
-
- @Test
- @IssueTracking("https://jira.jboss.org/browse/RF-9571")
- public void testOninputchange() {
- selenium.type(pjq("input[type=text][id$=oninputchangeInput]"),
"metamerEvents += \"inputchange \"");
- selenium.waitForPageToLoad();
-
- String timeValue = selenium.getText(time);
selenium.click(inplaceInput);
- selenium.type(input, "new value");
- selenium.fireEvent(input, Event.BLUR);
- waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
- waitGui.failWith("Attribute oninputchange does not work
correctly").until(
- new EventFiredCondition(new Event("inputchange")));
+ waitGui.failWith("Attribute onfocus does not work correctly").until(new
EventFiredCondition(Event.FOCUS));
}
@Test
@@ -219,11 +227,6 @@
}
@Test
- public void testOninputfocus() {
- testFireEvent(Event.FOCUS, input, "inputfocus");
- }
-
- @Test
public void testOninputkeydown() {
testFireEvent(Event.KEYDOWN, input, "inputkeydown");
}
@@ -330,7 +333,7 @@
public void testClickOkButton() {
selenium.click(pjq("input[type=radio][name$=showControlsInput][value=true]"));
selenium.waitForPageToLoad();
-
+
String timeValue = selenium.getText(time);
selenium.click(inplaceInput);
guardNoRequest(selenium).keyPress(input, "x");
@@ -347,11 +350,11 @@
public void testClickCancelButton() {
selenium.click(pjq("input[type=radio][name$=showControlsInput][value=true]"));
selenium.waitForPageToLoad();
-
+
selenium.click(inplaceInput);
guardNoRequest(selenium).keyPress(input, "x");
guardNoRequest(selenium).mouseDown(cancelButton);
-
+
assertEquals(selenium.getText(label), "RichFaces 4",
"Label");
assertEquals(selenium.getValue(input), "RichFaces 4", "Value of
inplace input.");
assertEquals(selenium.getText(output), "RichFaces 4", "Output did
not change.");