Author: ppitonak(a)redhat.com
Date: 2011-02-02 10:55:57 -0500 (Wed, 02 Feb 2011)
New Revision: 21393
Removed:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/collapsiblePanel/
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/simple.xhtml
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java
Log:
* added 8 tests for inplace input RFPL-757
* removed empty directory collapsiblePanel
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 2011-02-02
15:39:03 UTC (rev 21392)
+++
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/RichInplaceInputBean.java 2011-02-02
15:55:57 UTC (rev 21393)
@@ -63,8 +63,16 @@
attributes.setAttribute("value", "RichFaces 4");
// TODO has to be tested in another way
+ attributes.remove("converter");
+ attributes.remove("converterMessage");
+ attributes.remove("required");
+ attributes.remove("requiredMessage");
attributes.remove("validator");
+ attributes.remove("validatorMessage");
attributes.remove("valueChangeListener");
+
+ // TODO remove as soon as RF-10411 is fixed
+ attributes.setAttribute("style", null);
}
public Attributes getAttributes() {
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/simple.xhtml
===================================================================
---
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/simple.xhtml 2011-02-02
15:39:03 UTC (rev 21392)
+++
modules/tests/metamer/trunk/application/src/main/webapp/components/richInplaceInput/simple.xhtml 2011-02-02
15:55:57 UTC (rev 21393)
@@ -46,7 +46,7 @@
converterMessage="#{richInplaceInputBean.attributes['converterMessage'].value}"
defaultLabel="#{richInplaceInputBean.attributes['defaultLabel'].value}"
disabled="#{richInplaceInputBean.attributes['disabled'].value}"
-
disabledStateClass="#{richInplaceInputBean.attributes['disableStateClass'].value}"
+
disabledStateClass="#{richInplaceInputBean.attributes['disabledStateClass'].value}"
editClass="#{richInplaceInputBean.attributes['editClass'].value}"
editEvent="#{richInplaceInputBean.attributes['editEvent'].value}"
editStateClass="#{richInplaceInputBean.attributes['editStateClass'].value}"
@@ -83,7 +83,7 @@
requiredMessage="#{richInplaceInputBean.attributes['requiredMessage'].value}"
saveOnBlur="#{richInplaceInputBean.attributes['saveOnBlur'].value}"
showControls="#{richInplaceInputBean.attributes['showControls'].value}"
-
state="#{richInplaceInputBean.attributes['state'].value}"
+
style="#{richInplaceInputBean.attributes['style'].value}"
tabindex="#{richInplaceInputBean.attributes['tabindex'].value}"
validatorMessage="#{richInplaceInputBean.attributes['validatorMessage'].value}"
value="#{richInplaceInputBean.attributes['value'].value}"
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 2011-02-02
15:39:03 UTC (rev 21392)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richInplaceInput/TestRichInplaceInput.java 2011-02-02
15:55:57 UTC (rev 21393)
@@ -1,6 +1,6 @@
/*******************************************************************************
* JBoss, Home of Professional Open Source
- * Copyright 2010, Red Hat, Inc. and individual contributors
+ * Copyright 2010-2011, Red Hat, Inc. and individual contributors
* by the @authors tag. See the copyright.txt in the distribution for a
* full listing of individual contributors.
*
@@ -30,11 +30,13 @@
import static org.testng.Assert.assertTrue;
import java.net.URL;
+
import javax.faces.event.PhaseId;
+
import org.jboss.test.selenium.css.CssProperty;
-
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;
@@ -67,7 +69,7 @@
assertTrue(selenium.isElementPresent(inplaceInput), "Inplace input is not on
the page.");
assertTrue(selenium.isElementPresent(label), "Default label should be
present on the page.");
assertEquals(selenium.getText(label), "RichFaces 4", "Default
label");
- assertTrue(selenium.isElementPresent(inplaceInput), "Input should be present
on the page.");
+ assertTrue(selenium.isElementPresent(input), "Input should be present on the
page.");
assertFalse(selenium.isElementPresent(okButton), "OK button should not be
present on the page.");
assertFalse(selenium.isElementPresent(cancelButton), "Cancel button should
not be present on the page.");
assertEquals(selenium.getValue(input), "RichFaces 4", "Value of
inplace input.");
@@ -89,9 +91,27 @@
String listenerText = selenium.getText(jq("div#phasesPanel
li:eq(3)"));
assertEquals(listenerText, "* value changed: RichFaces 4 -> new
value", "Value change listener was not invoked.");
+
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
+ phaseInfo.assertListener(PhaseId.PROCESS_VALIDATIONS, "value changed:
RichFaces 4 -> new value");
}
@Test
+ public void testChangedStateClass() {
+ selenium.type(pjq("input[id$=changedStateClassInput]"),
"metamer-ftest-class");
+ selenium.waitForPageToLoad();
+
+ selenium.click(inplaceInput);
+ selenium.type(input, "new value");
+ selenium.fireEvent(input, Event.BLUR);
+
+ JQueryLocator elementWhichHasntThatClass = jq(inplaceInput.getRawLocator() +
":not(.metamer-ftest-class)");
+ assertTrue(selenium.isElementPresent(inplaceInput));
+ assertFalse(selenium.isElementPresent(elementWhichHasntThatClass));
+ }
+
+ @Test
public void testDefaultLabel() {
selenium.type(pjq("input[type=text][id$=valueInput]"), "");
selenium.waitForPageToLoad();
@@ -107,6 +127,28 @@
}
@Test
+ public void testDisabled() {
+
selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.isElementPresent(inplaceInput), "Inplace input is not on
the page.");
+ assertTrue(selenium.isElementPresent(label), "Default label should be
present on the page.");
+ assertEquals(selenium.getText(label), "RichFaces 4", "Default
label");
+ assertFalse(selenium.isElementPresent(input), "Input should not be present
on the page.");
+ assertFalse(selenium.isElementPresent(okButton), "OK button should not be
present on the page.");
+ assertFalse(selenium.isElementPresent(cancelButton), "Cancel button should
not be present on the page.");
+ assertFalse(selenium.isElementPresent(edit), "Edit should not be present on
the page.");
+ }
+
+ @Test
+ public void testDisabledStateClass() {
+
selenium.click(pjq("input[type=radio][name$=disabledInput][value=true]"));
+ selenium.waitForPageToLoad();
+
+ testStyleClass(inplaceInput, "disabledStateClass");
+ }
+
+ @Test
public void testEditClass() {
testStyleClass(edit, "editClass");
}
@@ -123,6 +165,20 @@
}
@Test
+ public void testEditStateClass() {
+ selenium.type(pjq("input[id$=editStateClassInput]"),
"metamer-ftest-class");
+ selenium.waitForPageToLoad();
+
+ assertFalse(selenium.belongsClass(inplaceInput, "metamer-ftest-class"),
"Inplace input should not have class metamer-ftest-class.");
+
+ selenium.click(inplaceInput);
+ assertTrue(selenium.belongsClass(inplaceInput, "metamer-ftest-class"),
"Inplace input should have class metamer-ftest-class.");
+
+ selenium.fireEvent(input, Event.BLUR);
+ assertFalse(selenium.belongsClass(inplaceInput, "metamer-ftest-class"),
"Inplace input should not have class metamer-ftest-class.");
+ }
+
+ @Test
public void testImmediate() {
selenium.click(pjq("input[type=radio][name$=immediateInput][value=true]"));
selenium.waitForPageToLoad();
@@ -133,10 +189,9 @@
selenium.fireEvent(input, Event.BLUR);
waitGui.failWith("Page was not updated").waitForChange(timeValue,
retrieveText.locator(time));
- assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
+ phaseInfo.assertPhases(PhaseId.RESTORE_VIEW, PhaseId.APPLY_REQUEST_VALUES,
PhaseId.PROCESS_VALIDATIONS,
PhaseId.UPDATE_MODEL_VALUES, PhaseId.INVOKE_APPLICATION,
PhaseId.RENDER_RESPONSE);
- String listenerText = selenium.getText(jq("div#phasesPanel
li:eq(2)"));
- assertEquals(listenerText, "* value changed: RichFaces 4 -> new
value", "Value change listener was not invoked.");
+ phaseInfo.assertListener(PhaseId.APPLY_REQUEST_VALUES, "value changed:
RichFaces 4 -> new value");
}
@Test
@@ -312,6 +367,11 @@
}
@Test
+ public void testReadyStateClass() {
+ testStyleClass(inplaceInput, "readyStateClass");
+ }
+
+ @Test
public void testRendered() {
selenium.click(pjq("input[type=radio][name$=renderedInput][value=false]"));
selenium.waitForPageToLoad();
@@ -320,6 +380,24 @@
}
@Test
+ public void testSaveOnBlur() {
+
selenium.click(pjq("input[type=radio][name$=saveOnBlurInput][value=false]"));
+ selenium.waitForPageToLoad();
+
+ selenium.click(inplaceInput);
+ assertFalse(selenium.belongsClass(edit, "rf-ii-none"), "Edit
should not contain class rf-is-none when popup is open.");
+ assertTrue(selenium.isDisplayed(input), "Input should be displayed.");
+
+ selenium.type(input, "new value");
+ selenium.fireEvent(input, Event.BLUR);
+ assertFalse(selenium.belongsClass(inplaceInput, "rf-ii-c-s"), "New
class rf-ii-c-s should not be added to inplace input.");
+ assertTrue(selenium.belongsClass(edit, "rf-ii-none"), "Edit should
contain class rf-is-none when popup is closed.");
+
+ assertEquals(selenium.getText(label), "RichFaces 4", "Label should
not change.");
+ assertEquals(selenium.getText(output), "RichFaces 4", "Output
should not change.");
+ }
+
+ @Test
public void testShowControls() {
selenium.click(pjq("input[type=radio][name$=showControlsInput][value=true]"));
selenium.waitForPageToLoad();
@@ -361,6 +439,21 @@
}
@Test
+ public void testStyle() {
+ testStyle(inplaceInput, "style");
+ }
+
+ @Test
+ public void testTabindex() {
+ AttributeLocator<?> attr = input.getAttribute(new
Attribute("tabindex"));
+
+ selenium.type(pjq("input[id$=tabindexInput]"), "47");
+ selenium.waitForPageToLoad();
+
+ assertTrue(selenium.getAttribute(attr).contains("47"), "Attribute
tabindex should contain \"47\".");
+ }
+
+ @Test
public void testValue() {
selenium.type(pjq("input[type=text][id$=valueInput]"), "new
value");
selenium.waitForPageToLoad();