JBoss Rich Faces SVN: r22651 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-08-17 19:41:40 -0400 (Wed, 17 Aug 2011)
New Revision: 22651
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
RFPL-1612: add tests for various *class attributes and immediate for pickList
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java 2011-08-17 23:41:22 UTC (rev 22650)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java 2011-08-17 23:41:40 UTC (rev 22651)
@@ -64,7 +64,7 @@
setProperty("headerClass", headerClass);
}
- public void setImmediate(String immediate) {
+ public void setImmediate(Boolean immediate) {
setProperty("immediate", immediate);
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:41:22 UTC (rev 22650)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:41:40 UTC (rev 22651)
@@ -181,25 +181,46 @@
}
- // @Test
+ @Test
public void testDisabledClass() {
- // TODO JJa 2011-08-05: ask Brian about this attr:
- // attributes.setDisabledClass(disabledClass);
+ String disabledClass = "my-cool-disabled-class";
+ attributes.setDisabledClass(disabledClass);
+
+ String found = selenium.getAttribute(pickListTop.getAttribute(classAttr));
+ assertTrue(found != null);
+ assertTrue(found.contains(disabledClass));
}
- // @Test
+ @Test
public void testHeaderClass() {
- // attributes.setHeaderClass(headerClass);
+ String headerClass = "my-cool-header-class";
+ attributes.setHeaderClass(headerClass);
+
+ String found = selenium.getAttribute(pickListTop.getAttribute(classAttr));
+ assertTrue(found != null);
+ assertTrue(found.contains(headerClass));
}
- // @Test
+ @Test
public void testImmediate() {
- // attributes.setImmediate(immediate);
+ attributes.setImmediate(Boolean.TRUE);
+ addItem("richfaces");
+ selenium.click(a4jSubmit);
+
+ // for immediate submit is record in 3rd line
+ waitModel.until(textEquals.locator(phaseListenerFormat.format(2))
+ .text(format(phaseListenerLogFormat, "[]", "[richfaces]")));
+
}
- // @Test
+ @Test
public void testItemClass() {
- // attributes.setItemClass(itemClass);
+ String itemClass = "xxx";
+ attributes.setItemClass(itemClass);
+
+ String classVal = selenium.getAttribute(pickListSrcItemByText.format("richfaces").getAttribute(classAttr));
+ assertTrue(classVal != null);
+ assertTrue(classVal.contains(itemClass));
}
// @Test
13 years, 4 months
JBoss Rich Faces SVN: r22650 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-08-17 19:41:22 -0400 (Wed, 17 Aug 2011)
New Revision: 22650
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
RFPL-1612: add tests for events on pickList
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:41:03 UTC (rev 22649)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:41:22 UTC (rev 22650)
@@ -29,6 +29,7 @@
import java.net.URL;
+import org.jboss.test.selenium.dom.Event;
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.utils.URLUtils;
@@ -221,229 +222,229 @@
// attributes.setMinListHeight(minListHeight);
}
- // @Test
+ @Test
public void testOnadditem() {
- // attributes.setOnadditem(onadditem);
+ testFireEvent(new Event("additem"), pickListTop);
}
- // @Test
+ @Test
public void testOnblur() {
- // attributes.setOnblur(onblur);
+ testFireEvent(new Event("blur"), pickListTop);
}
- // @Test
+ @Test
public void testOnchange() {
- // attributes.setOnchange(onchange);
+ testFireEvent(new Event("change"), pickListTop);
}
- // @Test
+ @Test
public void testOnclick() {
- // attributes.setOnclick(onclick);
+ testFireEvent(new Event("click"), pickListTop);
}
- // @Test
+ @Test
public void testOndblclick() {
- // attributes.setOndblclick(ondblclick);
+ testFireEvent(new Event("dblclick"), pickListTop);
}
- // @Test
+ @Test
public void testOnfocus() {
- // attributes.setOnfocus(onfocus);
+ testFireEvent(new Event("focus"), pickListTop);
}
- // @Test
+ @Test
public void testOnkeydown() {
- // attributes.setOnkeydown(onkeydown);
+ testFireEvent(new Event("keydown"), pickListTop);
}
- // @Test
+ @Test
public void testOnkeypress() {
- // attributes.setOnkeypress(onkeypress);
+ testFireEvent(new Event("keypress"), pickListTop);
}
- // @Test
+ @Test
public void testOnkeyup() {
- // attributes.setOnkeyup(onkeyup);
+ testFireEvent(new Event("keyup"), pickListTop);
}
- // @Test
+ @Test
public void testOnlistclick() {
- // attributes.setOnlistclick(onlistclick);
+ testFireEvent(new Event("listclick"), pickListTop);
}
- // @Test
+ @Test
public void testOnlistdblclick() {
- // attributes.setOnlistdblclick(onlistdblclick);
+ testFireEvent(new Event("listdblclick"), pickListTop);
}
- // @Test
+ @Test
public void testOnlistkeydown() {
- // attributes.setOnlistkeydown(onlistkeydown);
+ testFireEvent(new Event("listkeydown"), pickListTop);
}
- // @Test
+ @Test
public void testOnlistkeypress() {
- // attributes.setOnlistkeypress(onlistkeypress);
+ testFireEvent(new Event("listkeypress"), pickListTop);
}
- // @Test
+ @Test
public void testOnlistkeyup() {
- // attributes.setOnlistkeyup(onlistkeyup);
+ testFireEvent(new Event("listkeyup"), pickListTop);
}
- // @Test
+ @Test
public void testOnlistmousedown() {
- // attributes.setOnlistmousedown(onlistmousedown);
+ testFireEvent(new Event("listmousedown"), pickListTop);
}
- // @Test
+ @Test
public void testOnlistmousemove() {
- // attributes.setOnlistmousemove(onlistmousemove);
+ testFireEvent(new Event("listmousemove"), pickListTop);
}
- // @Test
+ @Test
public void testOnlistmouseout() {
- // attributes.setOnlistmouseout(onlistmouseout);
+ testFireEvent(new Event("listmouseout"), pickListTop);
}
- // @Test
+ @Test
public void testOnlistmouseover() {
- // attributes.setOnlistmouseover(onlistmouseover);
+ testFireEvent(new Event("listmouseover"), pickListTop);
}
- // @Test
+ @Test
public void testOnlistmouseup() {
- // attributes.setOnlistmouseup(onlistmouseup);
+ testFireEvent(new Event("listmouseup"), pickListTop);
}
- // @Test
+ @Test
public void testOnmousedown() {
- // attributes.setOnmousedown(onmousedown);
+ testFireEvent(new Event("mousedown"), pickListTop);
}
- // @Test
+ @Test
public void testOnmousemove() {
- // attributes.setOnmousemove(onmousemove);
+ testFireEvent(new Event("mousemove"), pickListTop);
}
- // @Test
+ @Test
public void testOnmouseout() {
- // attributes.setOnmouseout(onmouseout);
+ testFireEvent(new Event("mouseout"), pickListTop);
}
- // @Test
+ @Test
public void testOnmouseover() {
- // attributes.setOnmouseover(onmouseover);
+ testFireEvent(new Event("mouseover"), pickListTop);
}
- // @Test
+ @Test
public void testOnmouseup() {
- // attributes.setOnmouseup(onmouseup);
+ testFireEvent(new Event("mouseup"), pickListTop);
}
- // @Test
+ @Test
public void testOnremoveitem() {
- // attributes.setOnremoveitem(onremoveitem);
+ testFireEvent(new Event("emoveitem"), pickListTop);
}
- // @Test
+ @Test
public void testOnsourceclick() {
- // attributes.setOnsourceclick(onsourceclick);
+ testFireEvent(new Event("sourceclick"), pickListTop);
}
- // @Test
+ @Test
public void testOnsourcedblclick() {
- // attributes.setOnsourcedblclick(onsourcedblclick);
+ testFireEvent(new Event("sourcedblclick"), pickListTop);
}
- // @Test
+ @Test
public void testOnsourcekeydown() {
- // attributes.setOnsourcekeydown(onsourcekeydown);
+ testFireEvent(new Event("sourcekeydown"), pickListTop);
}
- // @Test
+ @Test
public void testOnsourcekeypress() {
- // attributes.setOnsourcekeypress(onsourcekeypress);
+ testFireEvent(new Event("sourcekeypress"), pickListTop);
}
- // @Test
+ @Test
public void testOnsourcekeyup() {
- // attributes.setOnsourcekeyup(onsourcekeyup);
+ testFireEvent(new Event("sourcekeyup"), pickListTop);
}
- // @Test
+ @Test
public void testOnsourcemousedown() {
- // attributes.setOnsourcemousedown(onsourcemousedown);
+ testFireEvent(new Event("sourcemousedown"), pickListTop);
}
- // @Test
+ @Test
public void testOnsourcemousemove() {
- // attributes.setOnsourcemousemove(onsourcemousemove);
+ testFireEvent(new Event("sourcemousemove"), pickListTop);
}
- // @Test
+ @Test
public void testOnsourcemouseout() {
- // attributes.setOnsourcemouseout(onsourcemouseout);
+ testFireEvent(new Event("sourcemouseout"), pickListTop);
}
- // @Test
+ @Test
public void testOnsourcemouseover() {
- // attributes.setOnsourcemouseover(onsourcemouseover);
+ testFireEvent(new Event("sourcemouseover"), pickListTop);
}
- // @Test
+ @Test
public void testOnsourcemouseup() {
- // attributes.setOnsourcemouseup(onsourcemouseup);
+ testFireEvent(new Event("sourcemouseup"), pickListTop);
}
- // @Test
+ @Test
public void testOntargetclick() {
- // attributes.setOntargetclick(ontargetclick);
+ testFireEvent(new Event("targetclick"), pickListTop);
}
- // @Test
+ @Test
public void testOntargetdblclick() {
- // attributes.setOntargetdblclick(ontargetdblclick);
+ testFireEvent(new Event("targetdblclick"), pickListTop);
}
- // @Test
+ @Test
public void testOntargetkeydown() {
- // attributes.setOntargetkeydown(ontargetkeydown);
+ testFireEvent(new Event("targetkeydown"), pickListTop);
}
- // @Test
+ @Test
public void testOntargetkeypress() {
- // attributes.setOntargetkeypress(ontargetkeypress);
+ testFireEvent(new Event("targetkeypress"), pickListTop);
}
- // @Test
+ @Test
public void testOntargetkeyup() {
- // attributes.setOntargetkeyup(ontargetkeyup);
+ testFireEvent(new Event("targetkeyup"), pickListTop);
}
- // @Test
+ @Test
public void testOntargetmousedown() {
- // attributes.setOntargetmousedown(ontargetmousedown);
+ testFireEvent(new Event("targetmousedown"), pickListTop);
}
- // @Test
+ @Test
public void testOntargetmousemove() {
- // attributes.setOntargetmousemove(ontargetmousemove);
+ testFireEvent(new Event("targetmousemove"), pickListTop);
}
- // @Test
+ @Test
public void testOntargetmouseout() {
- // attributes.setOntargetmouseout(ontargetmouseout);
+ testFireEvent(new Event("targetmouseout"), pickListTop);
}
- // @Test
+ @Test
public void testOntargetmouseover() {
- // attributes.setOntargetmouseover(ontargetmouseover);
+ testFireEvent(new Event("targetmouseover"), pickListTop);
}
- // @Test
+ @Test
public void testOntargetmouseup() {
- // attributes.setOntargetmouseup(ontargetmouseup);
+ testFireEvent(new Event("targetmouseup"), pickListTop);
}
@Test
13 years, 4 months
JBoss Rich Faces SVN: r22649 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-08-17 19:41:03 -0400 (Wed, 17 Aug 2011)
New Revision: 22649
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
RFPL-1612: add tests for attrs controlling labels on action buttons (add, addAll, remove, removeAll)
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:40:45 UTC (rev 22648)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:41:03 UTC (rev 22649)
@@ -123,14 +123,16 @@
@Test
public void testAddAllText() {
- attributes.setAddAllText("addAll");
- assertEquals(selenium.getText(addAllBtn), "addAll");
+ String label = "xxx";
+ attributes.setAddAllText(label);
+ assertTrue(label.equals(selenium.getText(addAllBtn)));
}
@Test
public void testAddText() {
- attributes.setAddText("add");
- assertEquals(selenium.getText(addBtn), "add");
+ String label = "xxx";
+ attributes.setAddText(label);
+ assertTrue(label.equals(selenium.getText(addBtn)));
}
// @Test
@@ -145,12 +147,6 @@
// attributes.setColumnVar(columnVar);
}
- // @Test
- public void testDefaultLabel() {
- // TODO JJa 2011-08-05: ask Brian about this attr:
- // attributes.setDefaultLabel(defaultLabel);
- }
-
@Test
public void testDisabled() {
@@ -450,14 +446,18 @@
// attributes.setOntargetmouseup(ontargetmouseup);
}
- // @Test
+ @Test
public void testRemoveAllText() {
- // attributes.setRemoveAllText(removeAllText);
+ String label = "xxx";
+ attributes.setRemoveAllText(label);
+ assertTrue(label.equals(selenium.getText(removeAllBtn)));
}
- // @Test
+ @Test
public void testRemoveText() {
- // attributes.setRemoveText(removeText);
+ String label = "xxx";
+ attributes.setRemoveText(label);
+ assertTrue(label.equals(selenium.getText(removeBtn)));
}
@Test
13 years, 4 months
JBoss Rich Faces SVN: r22648 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-08-17 19:40:45 -0400 (Wed, 17 Aug 2011)
New Revision: 22648
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
RFPL-1612: add rendered attribute tests for pickList
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java 2011-08-17 23:40:24 UTC (rev 22647)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java 2011-08-17 23:40:45 UTC (rev 22648)
@@ -276,7 +276,7 @@
setProperty("removeText", removeText);
}
- public void setRendered(String rendered) {
+ public void setRendered(Boolean rendered) {
setProperty("rendered", rendered);
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:40:24 UTC (rev 22647)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:40:45 UTC (rev 22648)
@@ -460,9 +460,10 @@
// attributes.setRemoveText(removeText);
}
- // @Test
+ @Test
public void testRendered() {
- // attributes.setRendered(rendered);
+ attributes.setRendered(Boolean.FALSE);
+ assertFalse(selenium.isElementPresent(pickListTop));
}
@Test
13 years, 4 months
JBoss Rich Faces SVN: r22647 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-08-17 19:40:24 -0400 (Wed, 17 Aug 2011)
New Revision: 22647
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
RFPL-1612: add required and requiredMessage tests
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:40:05 UTC (rev 22646)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:40:24 UTC (rev 22647)
@@ -465,14 +465,30 @@
// attributes.setRendered(rendered);
}
- // @Test
+ @Test
public void testRequired() {
- // attributes.setRequired(required);
+ attributes.setRequired(Boolean.TRUE);
+ addItem("richfaces");
+ selenium.click(a4jSubmit);
+
+ assertFalse(selenium.isElementPresent(pickListMsgBox));
+
+ removeAllItems();
+ selenium.click(a4jSubmit);
+
+ waitModel.until(elementPresent.locator(pickListMsgBox));
+ assertTrue(selenium.isElementPresent(pickListMsgBox));
}
- // @Test
+ @Test
public void testRequiredMessage() {
- // attributes.setRequiredMessage(requiredMessage);
+ String requiredMessage = "Test validation message";
+ attributes.setRequiredMessage(requiredMessage);
+
+ attributes.setRequired(Boolean.TRUE);
+ selenium.click(a4jSubmit);
+
+ assertEquals(selenium.getText(pickListMsgBox), requiredMessage);
}
@Test
13 years, 4 months
JBoss Rich Faces SVN: r22646 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-08-17 19:40:05 -0400 (Wed, 17 Aug 2011)
New Revision: 22646
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
RFPL-1612: add tests for value attr. for pickList and add routine to select item by text value
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:39:47 UTC (rev 22645)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:40:05 UTC (rev 22646)
@@ -30,7 +30,6 @@
import java.net.URL;
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.utils.URLUtils;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
@@ -549,16 +548,11 @@
@Test
public void testValueChangeListener() {
-<<<<<<< HEAD
addItem("richfaces"); //
-=======
- addItem(53); // "richfaces"
->>>>>>> RFPL-1621: Add test for valueChangeListener attribute on pickList
selenium.click(a4jSubmit);
// valueChangeListener output as 4th record
-<<<<<<< HEAD
waitModel.until(textEquals.locator(phaseListenerFormat.format(3))
.text(format(phaseListenerLogFormat, "[]", "[richfaces]")));
@@ -568,19 +562,15 @@
// valueChangeListener output as 4th record
waitModel.until(textEquals.locator(phaseListenerFormat.format(3))
.text(format(phaseListenerLogFormat, "[richfaces]", "[richfaces, Alabama]")));
-=======
- String listenerText = selenium.getText(phaseListenerFormat.format(3));
- assertEquals(listenerText, format(phaseListenerLogFormat, "[]", "[richfaces]"),
- "Value change listener was not invoked or not in expected order");
+ .text(format(phaseListenerLogFormat, "[]", "[richfaces]")));
- addItem(0);
+ addItem("Alabama");
selenium.click(a4jSubmit);
// valueChangeListener output as 4th record
listenerText = selenium.getText(phaseListenerFormat.format(3));
assertEquals(listenerText, format(phaseListenerLogFormat, "[richfaces]", "[richfaces, Alabama]"),
"Value change listener was not invoked or not in expected order");
->>>>>>> RFPL-1621: Add test for valueChangeListener attribute on pickList
}
/**
13 years, 4 months
JBoss Rich Faces SVN: r22645 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-08-17 19:39:47 -0400 (Wed, 17 Aug 2011)
New Revision: 22645
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
RFPL-1621: Add test for valueChangeListener attribute on pickList
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:39:28 UTC (rev 22644)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:39:47 UTC (rev 22645)
@@ -549,11 +549,16 @@
@Test
public void testValueChangeListener() {
+<<<<<<< HEAD
addItem("richfaces"); //
+=======
+ addItem(53); // "richfaces"
+>>>>>>> RFPL-1621: Add test for valueChangeListener attribute on pickList
selenium.click(a4jSubmit);
// valueChangeListener output as 4th record
+<<<<<<< HEAD
waitModel.until(textEquals.locator(phaseListenerFormat.format(3))
.text(format(phaseListenerLogFormat, "[]", "[richfaces]")));
@@ -563,6 +568,19 @@
// valueChangeListener output as 4th record
waitModel.until(textEquals.locator(phaseListenerFormat.format(3))
.text(format(phaseListenerLogFormat, "[richfaces]", "[richfaces, Alabama]")));
+=======
+ String listenerText = selenium.getText(phaseListenerFormat.format(3));
+ assertEquals(listenerText, format(phaseListenerLogFormat, "[]", "[richfaces]"),
+ "Value change listener was not invoked or not in expected order");
+
+ addItem(0);
+ selenium.click(a4jSubmit);
+
+ // valueChangeListener output as 4th record
+ listenerText = selenium.getText(phaseListenerFormat.format(3));
+ assertEquals(listenerText, format(phaseListenerLogFormat, "[richfaces]", "[richfaces, Alabama]"),
+ "Value change listener was not invoked or not in expected order");
+>>>>>>> RFPL-1621: Add test for valueChangeListener attribute on pickList
}
/**
13 years, 4 months
JBoss Rich Faces SVN: r22644 - modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-08-17 19:39:28 -0400 (Wed, 17 Aug 2011)
New Revision: 22644
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
Add tests for add|remove button disable on item selected
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 21:34:37 UTC (rev 22643)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 23:39:28 UTC (rev 22644)
@@ -30,6 +30,7 @@
import java.net.URL;
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.utils.URLUtils;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
13 years, 4 months
JBoss Rich Faces SVN: r22643 - in modules/tests/metamer/trunk: ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList and 1 other directory.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-08-17 17:34:37 -0400 (Wed, 17 Aug 2011)
New Revision: 22643
Modified:
modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichPickListBean.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
Log:
Add requiredMessage attribute default value
Modified: modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichPickListBean.java
===================================================================
--- modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichPickListBean.java 2011-08-17 19:56:16 UTC (rev 22642)
+++ modules/tests/metamer/trunk/application/src/main/java/org/richfaces/tests/metamer/bean/rich/RichPickListBean.java 2011-08-17 21:34:37 UTC (rev 22643)
@@ -82,6 +82,8 @@
attributes.setAttribute("rendered", Boolean.TRUE);
attributes.setAttribute("minListHeight", "100");
+ attributes.setAttribute("requiredMessage", "Not empty target list is required!");
+
attributes.setAttribute("addText", ">");
attributes.setAttribute("addAllText", ">>");
attributes.setAttribute("removeText", "<");
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java 2011-08-17 19:56:16 UTC (rev 22642)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/RichPickListComponentAttribute.java 2011-08-17 21:34:37 UTC (rev 22643)
@@ -280,7 +280,7 @@
setProperty("rendered", rendered);
}
- public void setRequired(String required) {
+ public void setRequired(Boolean required) {
setProperty("required", required);
}
Modified: modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java
===================================================================
--- modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 19:56:16 UTC (rev 22642)
+++ modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richPickList/TestPickList.java 2011-08-17 21:34:37 UTC (rev 22643)
@@ -21,16 +21,19 @@
*******************************************************************************/
package org.richfaces.tests.metamer.ftest.richPickList;
+import static java.text.MessageFormat.format;
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.testng.Assert.assertFalse;
import java.net.URL;
+
import org.jboss.test.selenium.locator.Attribute;
import org.jboss.test.selenium.locator.JQueryLocator;
import org.jboss.test.selenium.utils.URLUtils;
import org.richfaces.tests.metamer.ftest.AbstractMetamerTest;
+import org.richfaces.tests.metamer.ftest.annotations.IssueTracking;
import org.testng.annotations.Test;
/**
@@ -43,18 +46,30 @@
public class TestPickList extends AbstractMetamerTest {
private RichPickListComponentAttribute attributes = new RichPickListComponentAttribute();
+
+ private JQueryLocator phaseListenerFormat = jq("div#phasesPanel li:eq({0})");
+
private JQueryLocator hSubmit = pjq("input[id$=hButton]");
private JQueryLocator a4jSubmit = pjq("input[id$=a4jButton]");
- private JQueryLocator pickListSourceItems = pjq("div[id$=pickListSourceItems]");
- private JQueryLocator pickListSourceItem = pickListSourceItems.getChild(jq("div[id$=pickListItem{0}]"));
+ private JQueryLocator pickListTop = pjq("div.rf-pick[id$=pickList]");
+ private JQueryLocator output = pjq("span[id$=output]");
+ private JQueryLocator pickListMsgBox = pjq("span.rf-msg > span[id$=msg:form:pickList] > span.rf-msg-det");
+ private JQueryLocator targetCaptionLocator = pjq("div[id$=pickListTarget] div.rf-pick-target-caption");
+ private JQueryLocator sourceCaptionLocator = pjq("div[id$=pickListSource] div.rf-pick-source-caption");
+ private JQueryLocator pickListSrcItems = pjq("div[id$=pickListSourceItems]");
+ private JQueryLocator pickListSrcItem = pickListSrcItems.getChild(jq("div[id$=pickListItem{0}]"));
+ private JQueryLocator pickListSrcItemByText = pickListSrcItems.getChild(jq("div.rf-pick-opt:contains({0})"));
+
private JQueryLocator pickListTargetItems = pjq("div[id$=pickListTargetItems]");
private JQueryLocator pickListTargetItem = pickListTargetItems.getChild(jq("div[id$=pickListItem{0}]"));
+ private JQueryLocator pickListTargetItemByText = pickListTargetItems.getChild(jq("div.rf-pick-opt:contains({0})"));
// after click on 'add' button, item is moved to 'staging' container (not child of #pickListTargetItems)
- private JQueryLocator pickListTargetItemsStage = pjq("div[id$=pickListTargetList] div.rf-pick-lst-scrl");
- private JQueryLocator pickListTargetItemStage = pickListTargetItemsStage.getChild(jq("div[id$=pickListItem{0}]"));
+ private JQueryLocator pickListTrgtItemsStage = pjq("div[id$=pickListTargetList] div.rf-pick-lst-scrl");
+ private JQueryLocator pickListTrgtItemStage = pickListTrgtItemsStage.getChild(jq("div[id$=pickListItem{0}]"));
+ private JQueryLocator pickListTrgtItemStageByText = pickListTrgtItemsStage.getChild(jq("div.rf-pick-opt:contains({0})"));
private JQueryLocator addBtn = pjq("button.rf-pick-add");
private JQueryLocator addAllBtn = pjq("button.rf-pick-add-all");
@@ -63,10 +78,13 @@
private Attribute classAttr = new Attribute("class");
private Attribute disabledAttr = new Attribute("disabled");
+ private Attribute styleAttr = new Attribute("style");
private String STYLE_CLASS_ITEM_DISABLED = "rf-pick-opt-dis";
private String STYLE_CLASS_BTN_DISABLED = "rf-pick-btn-dis";
private String STYLE_CLASS_ITEM_SELECTED = "rf-pick-sel";
+
+ private String phaseListenerLogFormat = "*3 value changed: {0} -> {1}";
@Override
public URL getTestUrl() {
@@ -74,12 +92,24 @@
}
private void addItem(int id) {
- selenium.click(pickListSourceItem.format(id));
+ selenium.click(pickListSrcItem.format(id));
selenium.click(addBtn);
}
+ private void addItem(String value) {
+ selenium.click(pickListSrcItemByText.format(value));
+ selenium.click(addBtn);
+ }
+
private void removeItem(int id) {
- selenium.click(pickListTargetItem.format(id));
+
+ if (selenium.isElementPresent(pickListTrgtItemStage.format(id))){
+ selenium.click(pickListTrgtItemStage.format(id));
+ } else {
+ // if doesn't exist at this point, there we don't know what happens
+ selenium.click(pickListTargetItem.format(id));
+ }
+
selenium.click(removeBtn);
}
@@ -132,7 +162,7 @@
// check if source items are disabled (check second - first item after 0 item added)
String pickListSourceItemClass = selenium.getAttribute(
- pickListSourceItem.format(1).getAttribute(classAttr));
+ pickListSrcItem.format(1).getAttribute(classAttr));
assertTrue(pickListSourceItemClass.contains(STYLE_CLASS_ITEM_DISABLED));
// all buttons should be disabled
@@ -445,106 +475,213 @@
// attributes.setRequiredMessage(requiredMessage);
}
- // @Test
+ @Test
public void testSelectItemClass() {
- // attributes.setSelectItemClass(selectItemClass);
+ String selectItemClass = "my-select-item-class";
+ attributes.setSelectItemClass(selectItemClass);
+
+ selenium.click(pickListSrcItemByText.format("richfaces"));
+
+ String classVal = selenium.getAttribute(pickListSrcItemByText.format("richfaces").getAttribute(classAttr));
+ assertTrue(classVal.contains(selectItemClass));
}
- // @Test
+ @Test
+ @IssueTracking("https://issues.jboss.org/browse/RF-11222")
public void testShowButton() {
- // TODO JJa 2011-08-05: create JIRA for this attribute: its not working
+ // this attribute doessn't work until the resolution of RF-11209
}
- // @Test
+ @Test
public void testSourceCaption() {
- // attributes.setSourceCaption(sourceCaption);
+ String sourceCaption = "This is source";
+ attributes.setSourceCaption(sourceCaption);
+
+ waitModel.until(textEquals.locator(sourceCaptionLocator).text(sourceCaption));
}
- // @Test
+ @Test
public void testStyle() {
- // attributes.setStyle(style);
+ testStyle(pickListTop, "style");
}
- // @Test
- public void testStyleClass() {
- // attributes.setStyleClass(styleClass);
+ @Test
+ public void testStyleClass() {
+ testStyleClass(pickListTop, "styleClass");
}
- // @Test
+ @Test
public void testTargetCaption() {
- // attributes.setTargetCaption(targetCaption);
+ String targetCaption = "This is target";
+ attributes.setTargetCaption(targetCaption);
+
+ waitModel.until(textEquals.locator(targetCaptionLocator).text(targetCaption));
}
- // @Test
+ @Test
public void testValidator() {
+ addAllItems();
+ selenium.click(a4jSubmit);
- // verify difference between submit incorrect value by h and a4j btn.
- // Seems that while h submit cause incorrect value removed from target list, a4j don't do it
-
- // attributes.setValidator(validator);
+ // following message is predefined by validator
+ waitModel.until(textEquals.locator(pickListMsgBox).text("PickList don't like '@' char!"));
}
- // @Test
+ @Test
public void testValidatorMessage() {
- // attributes.setValidatorMessage(validatorMessage);
+ String validationMessage = "We are sorry, but @ is not allowed to join us!";
+ attributes.setValidatorMessage(validationMessage);
+ addAllItems();
+ selenium.click(a4jSubmit);
+
+ // verify our own validation message
+ waitModel.until(textEquals.locator(pickListMsgBox).text(validationMessage));
}
- // @Test
+ @Test
public void testValue() {
- // attributes.setValue(value);
+ addItem("richfaces"); // "richfaces"
+ selenium.click(a4jSubmit);
+
+ waitModel.until(textEquals.locator(output).text("[richfaces]"));
}
- // @Test
+ @Test
public void testValueChangeListener() {
+ addItem("richfaces"); //
+ selenium.click(a4jSubmit);
+
+ // valueChangeListener output as 4th record
+ waitModel.until(textEquals.locator(phaseListenerFormat.format(3))
+ .text(format(phaseListenerLogFormat, "[]", "[richfaces]")));
+
+ addItem("Alabama");
+ selenium.click(a4jSubmit);
+
+ // valueChangeListener output as 4th record
+ waitModel.until(textEquals.locator(phaseListenerFormat.format(3))
+ .text(format(phaseListenerLogFormat, "[richfaces]", "[richfaces, Alabama]")));
}
/**
* Verify that addBtn is disabled until item from source items picked
*/
- // @Test
+ @Test
public void testDisableAddBtn() {
+ int itemIdx = 0;
+ String addBtnClass = selenium.getAttribute(addBtn.getAttribute(classAttr));
+
+ // assert that button is visually disabled
+ assertTrue(addBtnClass != null);
+ assertTrue(addBtnClass.contains(STYLE_CLASS_BTN_DISABLED));
+
+ selenium.click(pickListSrcItem.format(itemIdx));
+
+ addBtnClass = selenium.getAttribute(addBtn.getAttribute(classAttr));
+
+ assertFalse(addBtnClass.contains(STYLE_CLASS_BTN_DISABLED));
+
}
/**
* Verify that removeBtn is disabled until item from target items picked
*/
- // @Test
+ @Test
public void testDisableRemoveBtn() {
+ int itemIdx = 0;
+ addAllItems();
+
+ String removeBtnClass = selenium.getAttribute(removeBtn.getAttribute(classAttr));
+
+ // assert that button is visually disabled
+ assertTrue(removeBtnClass != null);
+ assertTrue(removeBtnClass.contains(STYLE_CLASS_BTN_DISABLED));
+
+ selenium.click(pickListTrgtItemStage.format(itemIdx));
+
+ removeBtnClass = selenium.getAttribute(removeBtn.getAttribute(classAttr));
+
+ assertFalse(removeBtnClass.contains(STYLE_CLASS_BTN_DISABLED));
}
/**
* Verify addAll button working correctly
*/
- // @Test
+ @Test
public void testAddAllBtn(){
+ addAllItems();
+ waitModel.until(countEquals.count(54).locator(pickListTrgtItemsStage.getChild(jq("div.rf-pick-opt"))));
}
/**
* Verify removeAll button working correctly
*/
- // @Test
+ @Test
public void testRemoveAllBtn() {
+ int itemAtIdx = 50;
+ addAllItems();
+ // validator doesn't allow '@', so remove it before save
+ removeItem(itemAtIdx);
+
+ selenium.click(hSubmit);
+ waitModel.until(countEquals.count(53).locator(pickListTargetItems.getChild(jq("div.rf-pick-opt"))));
+
+ removeAllItems();
+ // nothing should remain in target container
+ waitModel.until(countEquals.count(0).locator(pickListTargetItems.getChild(jq("div.rf-pick-opt"))));
+
}
/**
* Verify submit by JSF submit button
*/
- // @Test
+ @Test
public void testSaveJSF() {
+ int itemIdx = 0;
+ addItem(itemIdx);
+ // verify that item "added" to target list really appears in target (staging) container.
+ waitModel.until(elementPresent.locator(pickListTrgtItemStage.format(itemIdx)));
+
+ // submit by JSF submit btn:
+ selenium.click(hSubmit);
+
+ // now item moved to target and submitted should appear in target (not staging)
+ waitModel.until(elementPresent.locator(pickListTargetItem.format(itemIdx)));
+
+ // todo check output!
}
/**
* Verify submit by ajax button
*/
- // @Test
+ @Test
public void testSaveAjax() {
+ int itemIdx = 0;
+ addItem(itemIdx);
+ // verify that item "added" to target list really appears in target (staging) container.
+ waitModel.until(elementPresent.locator(pickListTrgtItemStage.format(itemIdx)));
+
+ // submit by ajax btn:
+ selenium.click(a4jSubmit);
+
+ // and here is difference between jsf and ajax submit.
+ // With ajax, submitted item doesn'e move from stage to target
+ waitModel.until(elementPresent.locator(pickListTrgtItemStage.format(itemIdx)));
+
+ // now call rerenderAll on whole page
+ selenium.click(rerenderAllIcon);
+
+ // now item moved to target and submitted should appear in target (not staging)
+ waitModel.until(elementPresent.locator(pickListTargetItem.format(itemIdx)));
+
+ // todo check output!
}
/**
@@ -557,15 +694,15 @@
public void testKeepSelected() {
int itemIdx = 0;
- String classBeforeSelect = selenium.getAttribute(pickListSourceItem.format(itemIdx).getAttribute(classAttr));
+ String classBeforeSelect = selenium.getAttribute(pickListSrcItem.format(itemIdx).getAttribute(classAttr));
assertFalse(classBeforeSelect.contains(STYLE_CLASS_ITEM_SELECTED),
"pickList item shouldn't be selected before any click made! Current class(es) found: " + classBeforeSelect);
- selenium.click(pickListSourceItem.format(itemIdx));
+ selenium.click(pickListSrcItem.format(itemIdx));
- String pickedItemText = selenium.getText(pickListSourceItem.format(itemIdx));
+ String pickedItemText = selenium.getText(pickListSrcItem.format(itemIdx));
- String classAfterSelect = selenium.getAttribute(pickListSourceItem.format(itemIdx).getAttribute(classAttr));
+ String classAfterSelect = selenium.getAttribute(pickListSrcItem.format(itemIdx).getAttribute(classAttr));
assertTrue(classAfterSelect.contains(STYLE_CLASS_ITEM_SELECTED),
"pickList item should be selected after click on item was made. Current class(es) found: " + classAfterSelect);
@@ -575,12 +712,12 @@
waitGui.until(elementPresent.locator(jq("div[id$=pickListTargetList] div.rf-pick-lst-scrl > div[id$=pickListItem0]")));
// and check if item remain selected
- String classAfterMove = selenium.getAttribute(pickListTargetItemStage.format(itemIdx).getAttribute(classAttr));
+ String classAfterMove = selenium.getAttribute(pickListTrgtItemStage.format(itemIdx).getAttribute(classAttr));
assertTrue(classAfterMove.contains(STYLE_CLASS_ITEM_SELECTED),
"pickList item should keep selected after move to target list. Current class(es) found: " + classAfterMove);
// verify that the same text is within item with the same ID index
- assertEquals(selenium.getText(pickListTargetItemStage.format(itemIdx)), pickedItemText);
+ assertEquals(selenium.getText(pickListTrgtItemStage.format(itemIdx)), pickedItemText);
}
/**
@@ -592,17 +729,17 @@
int itemIdx = 5;
// select item
- selenium.click(pickListSourceItem.format(itemIdx));
+ selenium.click(pickListSrcItem.format(itemIdx));
- String pickedItemText = selenium.getText(pickListSourceItem.format(itemIdx));
+ String pickedItemText = selenium.getText(pickListSrcItem.format(itemIdx));
// add item to target list
selenium.click(addBtn);
// item index doesn't change when moved to target list
- assertTrue(selenium.isElementPresent(pickListTargetItemStage.format(itemIdx)));
+ assertTrue(selenium.isElementPresent(pickListTrgtItemStage.format(itemIdx)));
// verify that the same text is within item with the same ID index
- assertEquals(selenium.getText(pickListTargetItemStage.format(itemIdx)), pickedItemText);
+ assertEquals(selenium.getText(pickListTrgtItemStage.format(itemIdx)), pickedItemText);
}
/**
@@ -613,13 +750,13 @@
// this item will be selected and verified appropriate class change/add
int itemIdx = 0;
- String classBeforeSelect = selenium.getAttribute(pickListSourceItem.format(itemIdx).getAttribute(classAttr));
+ String classBeforeSelect = selenium.getAttribute(pickListSrcItem.format(itemIdx).getAttribute(classAttr));
assertFalse(classBeforeSelect.contains(STYLE_CLASS_ITEM_SELECTED),
"pickList item shouldn't be selected before any click made! Current class(es) found: " + classBeforeSelect);
- selenium.click(pickListSourceItem.format(itemIdx));
+ selenium.click(pickListSrcItem.format(itemIdx));
- String classAfterSelect = selenium.getAttribute(pickListSourceItem.format(itemIdx).getAttribute(classAttr));
+ String classAfterSelect = selenium.getAttribute(pickListSrcItem.format(itemIdx).getAttribute(classAttr));
assertTrue(classAfterSelect.contains(STYLE_CLASS_ITEM_SELECTED),
"pickList item should be selected after click on item was made. Current class(es) found: " + classAfterSelect);
13 years, 4 months
JBoss Rich Faces SVN: r22642 - modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList.
by richfaces-svn-commits@lists.jboss.org
Author: jjamrich
Date: 2011-08-17 15:56:16 -0400 (Wed, 17 Aug 2011)
New Revision: 22642
Modified:
modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/simple.xhtml
Log:
RFPL-1605: change valueChangeListener to improved
Modified: modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/simple.xhtml
===================================================================
--- modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/simple.xhtml 2011-08-17 15:47:16 UTC (rev 22641)
+++ modules/tests/metamer/trunk/application/src/main/webapp/components/richPickList/simple.xhtml 2011-08-17 19:56:16 UTC (rev 22642)
@@ -111,7 +111,7 @@
targetCaption="#{richPickListBean.attributes['targetCaption'].value}"
validator="#{richPickListBean.validatePickListValue}"
value="#{richPickListBean.value}"
- valueChangeListener="#{richBean.valueChangeListener}" >
+ valueChangeListener="#{richBean.valueChangeListenerImproved}" >
<f:selectItems value="#{richPickListBean.validationOptions}" />
13 years, 4 months