Author: jjamrich
Date: 2011-05-05 06:40:09 -0400 (Thu, 05 May 2011)
New Revision: 22469
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/RichMessageTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/RichMessagesTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesCSV.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesJSFValidator.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesJSR303.java
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/AbstractRichMessageTest.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/RichMessageComponentAttributes.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageCSV.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageJSFValidator.java
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageJSR303.java
Log:
Add selenium tests for rich:messages component
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/AbstractRichMessageTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/AbstractRichMessageTest.java 2011-05-05
10:39:23 UTC (rev 22468)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/AbstractRichMessageTest.java 2011-05-05
10:40:09 UTC (rev 22469)
@@ -58,11 +58,28 @@
protected JQueryLocator a4jCommandBtn = pjq("input[id$=a4jButton]");
// component's locators
- protected JQueryLocator mainMessage = pjq("span[id$=simpleInputMsg]");
- protected JQueryLocator message4Input1 = pjq("span[id$=simpleInputMsg1]");
- protected JQueryLocator message4Input2 = pjq("span[id$=simpleInputMsg2]");
- protected JQueryLocator messages = pjq("span[id$=msgs]");
+ protected static JQueryLocator message4Input1 =
pjq("span[id$=simpleInputMsg1]");
+ protected static JQueryLocator message4Input2 =
pjq("span[id$=simpleInputMsg2]");
+ protected static JQueryLocator messages = pjq("span[id$=msgs]");
+ /**
+ * Because of message and messages have many attributes very similar,
+ * this method helps test method distinguish between metamer
+ * page for rich:message and rich:messages (there are different element IDs
+ * per page and for messages there are messages container rendered
+ * conditionally)
+ * @return ElementLocator for container with rich:message(s)
+ */
+ public abstract JQueryLocator getTestElemLocator();
+
+ /**
+ * This method implementation specific for rich:message and rich:messages
+ * help distinguish between them, and return correct locator
+ * @return JQueryLocator for container with summary or detail of message(s)
component
+ */
+ public abstract JQueryLocator getSummaryElemLocator();
+ public abstract JQueryLocator getDetailElemLocator();
+
public void testHtmlAttribute(ElementLocator<?> element, RichMessageAttributes
attribute, String value) {
AttributeLocator<?> attr = element.getAttribute(new
Attribute(attribute.toString()));
@@ -76,7 +93,7 @@
generateValidationMessages(false);
assertTrue(selenium.getAttribute(attr).contains(value), "Attribute " +
attribute + " should contain \"" + value
- + "\".");
+ + "\".");
}
/**
@@ -148,34 +165,15 @@
}
}
- private JQueryLocator getInput4Attribute(RichMessageAttributes attribute) {
- return pjq("input[id$=" + attribute + "Input]");
+ protected void waitForAttribute(RichMessageAttributes attr) {
+ waitGui.until(attributeEquals
+ .locator(getTestElemLocator().getAttribute(new Attribute(attr.toString())))
+ .text(attr.toString()));
}
// ==================== test methods ====================
/**
- * Attribute 'for' change behavior: only messages bound to element with
- * id specified in 'for' should be displayed
- */
- @Test
- public void testFor() {
-
- // firstly, remove value from attribute for and generate message
- selenium.type(getInput4Attribute(RichMessageAttributes.FOR), "");
- selenium.waitForPageToLoad();
- generateValidationMessages(false);
- // assertFalse(selenium.isElementPresent(mainMessage));
- waitGui.until(isNotDisplayed.locator(mainMessage));
-
- // now set for attribute back to "simpleInput2"
- selenium.type(getInput4Attribute(RichMessageAttributes.FOR),
"simpleInput2");
- selenium.waitForPageToLoad();
- generateValidationMessages(false);
- waitGui.until(elementPresent.locator(mainMessage));
- }
-
- /**
* ajaxRendered attribute change behavior: messages are displayed
* after action performed by a4j:button (not only by h:command*)
*/
@@ -185,12 +183,12 @@
// by default is ajaxRendered set to true
generateValidationMessages(true);
- waitGui.until(elementPresent.locator(mainMessage));
+ waitGui.until(elementPresent.locator(getTestElemLocator()));
// then disable ajaxRendered
attributes.setAjaxRendered(Boolean.FALSE);
generateValidationMessages(true);
- waitGui.until(isNotDisplayed.locator(mainMessage));
+ waitGui.until(isNotDisplayed.locator(getTestElemLocator()));
}
/**
@@ -202,12 +200,12 @@
attributes.setRendered(Boolean.TRUE);
generateValidationMessages(false);
- waitGui.until(elementPresent.locator(mainMessage));
+ waitGui.until(elementPresent.locator(getTestElemLocator()));
// now disable rendering message
attributes.setRendered(Boolean.FALSE);
generateValidationMessages(false);
- waitGui.until(isNotDisplayed.locator(mainMessage));
+ waitGui.until(isNotDisplayed.locator(getTestElemLocator()));
}
/**
@@ -217,15 +215,13 @@
public void testShowSummary() {
// span with class=rf-msg-sum should appear when set to true
- JQueryLocator summary =
mainMessage.getDescendant(jq("span.rf-msg-sum"));
-
attributes.setShowSummary(Boolean.TRUE);
generateValidationMessages(false);
- waitModel.until(elementPresent.locator(summary));
+ waitModel.until(elementPresent.locator(getSummaryElemLocator()));
attributes.setShowSummary(Boolean.FALSE);
generateValidationMessages(false);
- waitGui.until(isNotDisplayed.locator(summary));
+ waitGui.until(isNotDisplayed.locator(getSummaryElemLocator()));
}
/**
@@ -235,91 +231,89 @@
public void testShowDetail() {
// span with class=rf-msg-det should appear when set to true
- JQueryLocator detail =
mainMessage.getDescendant(jq("span.rf-msg-det"));
-
attributes.setShowDetail(Boolean.TRUE);
generateValidationMessages(false);
- waitGui.until(elementPresent.locator(detail));
+ waitGui.until(elementPresent.locator(getDetailElemLocator()));
attributes.setShowDetail(Boolean.FALSE);
generateValidationMessages(false);
- waitGui.until(isNotDisplayed.locator(detail));
+ waitGui.until(isNotDisplayed.locator(getDetailElemLocator()));
}
@Test
public void testTitle() {
- testHtmlAttribute(mainMessage, RichMessageAttributes.TITLE, "Title
test");
+ testHtmlAttribute(getTestElemLocator(), RichMessageAttributes.TITLE, "Title
test");
}
@Test
public void testDir(){
- testHtmlAttribute(mainMessage, RichMessageAttributes.DIR, "rtl");
+ testHtmlAttribute(getTestElemLocator(), RichMessageAttributes.DIR,
"rtl");
}
@Test
public void testLang(){
- testHtmlAttribute(mainMessage, RichMessageAttributes.LANG, "US.en");
+ testHtmlAttribute(getTestElemLocator(), RichMessageAttributes.LANG,
"US.en");
}
@Test
public void testStyle(){
- testHtmlAttribute(mainMessage, RichMessageAttributes.STYLE, "color:
blue;");
+ testHtmlAttribute(getTestElemLocator(), RichMessageAttributes.STYLE, "color:
blue;");
}
@Test
public void testStyleClass() {
// attribute styleClass is propagated as class attribute in target HTML element
- testStyleClass(mainMessage, RichMessageAttributes.STYLE_CLASS.toString());
+ testStyleClass(getTestElemLocator(),
RichMessageAttributes.STYLE_CLASS.toString());
}
@Test
public void testOnClick() {
- testFireEvent(Event.CLICK, mainMessage);
+ testFireEvent(Event.CLICK, getTestElemLocator());
}
@Test
public void testOnDblClick() {
- testFireEvent(Event.DBLCLICK, mainMessage);
+ testFireEvent(Event.DBLCLICK, getTestElemLocator());
}
@Test
public void testOnKeyDown() {
- testFireEvent(Event.KEYDOWN, mainMessage);
+ testFireEvent(Event.KEYDOWN, getTestElemLocator());
}
@Test
public void testOnKeyPress() {
- testFireEvent(Event.KEYPRESS, mainMessage);
+ testFireEvent(Event.KEYPRESS, getTestElemLocator());
}
@Test
public void testOnKeyUp() {
- testFireEvent(Event.KEYUP, mainMessage);
+ testFireEvent(Event.KEYUP, getTestElemLocator());
}
@Test
public void testOnMouseDown() {
- testFireEvent(Event.MOUSEDOWN, mainMessage);
+ testFireEvent(Event.MOUSEDOWN, getTestElemLocator());
}
@Test
public void testOnMouseMove() {
- testFireEvent(Event.MOUSEMOVE, mainMessage);
+ testFireEvent(Event.MOUSEMOVE, getTestElemLocator());
}
@Test
public void testOnMouseOut() {
- testFireEvent(Event.MOUSEOUT, mainMessage);
+ testFireEvent(Event.MOUSEOUT, getTestElemLocator());
}
@Test
public void testOnMouseOver() {
- testFireEvent(Event.MOUSEOVER, mainMessage);
+ testFireEvent(Event.MOUSEOVER, getTestElemLocator());
}
@Test
public void testOnMouseUp() {
- testFireEvent(Event.MOUSEUP, mainMessage);
+ testFireEvent(Event.MOUSEUP, getTestElemLocator());
}
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/RichMessageComponentAttributes.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/RichMessageComponentAttributes.java 2011-05-05
10:39:23 UTC (rev 22468)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/RichMessageComponentAttributes.java 2011-05-05
10:40:09 UTC (rev 22469)
@@ -46,5 +46,13 @@
public void setShowSummary(Boolean showSummary){
setProperty("showSummary", showSummary);
}
+
+ public void setFor(String forAttribute){
+ setProperty("for", forAttribute);
+ }
+
+ public void setGlobalOnly(Boolean globalOnly){
+ setProperty("globalOnly", globalOnly);
+ }
}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/RichMessageTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/RichMessageTest.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/RichMessageTest.java 2011-05-05
10:40:09 UTC (rev 22469)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * 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.
+ *
+ * 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.richMessage;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.testng.annotations.Test;
+
+
+/**
+ * Abstract class with list of tests appropriate for rich:message component
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+public abstract class RichMessageTest extends AbstractRichMessageTest {
+
+ // locator for main rich:message component (tested element)
+ protected static JQueryLocator mainMessage =
pjq("span[id$=simpleInputMsg]");
+
+ protected JQueryLocator summary =
getTestElemLocator().getDescendant(jq("span.rf-msg-sum"));
+ protected JQueryLocator detail =
getTestElemLocator().getDescendant(jq("span.rf-msg-det"));
+
+ /**
+ * Attribute 'for' change behavior: only messages bound to element with
+ * id specified in 'for' should be displayed
+ */
+ @Test
+ public void testFor() {
+
+ // firstly, remove value from attribute for and generate message
+ attributes.setFor("");
+
+ generateValidationMessages(false);
+ // assertFalse(selenium.isElementPresent(getTestElemLocator()));
+ waitGui.until(isNotDisplayed.locator(getTestElemLocator()));
+
+ // now set for attribute back to "simpleInput2"
+ attributes.setFor("simpleInput2");
+
+ generateValidationMessages(false);
+ waitGui.until(elementPresent.locator(getTestElemLocator()));
+ }
+
+}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageCSV.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageCSV.java 2011-05-05
10:39:23 UTC (rev 22468)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageCSV.java 2011-05-05
10:40:09 UTC (rev 22469)
@@ -25,17 +25,34 @@
import java.net.URL;
+import org.jboss.test.selenium.locator.JQueryLocator;
+
/**
* Test case for page /faces/components/richMessage/csv.xhtml
*
* @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
* @version $Revision$
*/
-public class TestRichMessageCSV extends AbstractRichMessageTest {
+public class TestRichMessageCSV extends RichMessageTest {
@Override
public URL getTestUrl() {
return buildUrl(contextPath,
"faces/components/richMessage/csv.xhtml");
}
+
+ @Override
+ public JQueryLocator getTestElemLocator() {
+ return mainMessage;
+ }
+
+ @Override
+ public JQueryLocator getSummaryElemLocator() {
+ return summary;
+ }
+
+ @Override
+ public JQueryLocator getDetailElemLocator() {
+ return detail;
+ }
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageJSFValidator.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageJSFValidator.java 2011-05-05
10:39:23 UTC (rev 22468)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageJSFValidator.java 2011-05-05
10:40:09 UTC (rev 22469)
@@ -25,13 +25,15 @@
import java.net.URL;
+import org.jboss.test.selenium.locator.JQueryLocator;
+
/**
* Test case for page /faces/components/richMessage/jsfValidator.xhtml
*
* @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
* @version $Revision$
*/
-public class TestRichMessageJSFValidator extends AbstractRichMessageTest {
+public class TestRichMessageJSFValidator extends RichMessageTest {
/* (non-Javadoc)
* @see org.richfaces.tests.metamer.ftest.AbstractMetamerTest#getTestUrl()
@@ -40,5 +42,20 @@
public URL getTestUrl() {
return buildUrl(contextPath,
"faces/components/richMessage/jsfValidator.xhtml");
}
+
+ @Override
+ public JQueryLocator getTestElemLocator() {
+ return mainMessage;
+ }
+ @Override
+ public JQueryLocator getSummaryElemLocator() {
+ return summary;
+ }
+
+ @Override
+ public JQueryLocator getDetailElemLocator() {
+ return detail;
+ }
+
}
Modified:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageJSR303.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageJSR303.java 2011-05-05
10:39:23 UTC (rev 22468)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageJSR303.java 2011-05-05
10:40:09 UTC (rev 22469)
@@ -25,13 +25,15 @@
import java.net.URL;
+import org.jboss.test.selenium.locator.JQueryLocator;
+
/**
* Test case for page /faces/components/richMessage/jsr303.xhtml
*
* @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
* @version $Revision$
*/
-public class TestRichMessageJSR303 extends AbstractRichMessageTest {
+public class TestRichMessageJSR303 extends RichMessageTest {
/* (non-Javadoc)
* @see org.richfaces.tests.metamer.ftest.AbstractMetamerTest#getTestUrl()
@@ -41,4 +43,19 @@
return buildUrl(contextPath,
"faces/components/richMessage/jsr303.xhtml");
}
+ @Override
+ public JQueryLocator getTestElemLocator() {
+ return mainMessage;
+ }
+
+ @Override
+ public JQueryLocator getSummaryElemLocator() {
+ return summary;
+ }
+
+ @Override
+ public JQueryLocator getDetailElemLocator() {
+ return detail;
+ }
+
}
Added:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/RichMessagesTest.java
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/RichMessagesTest.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/RichMessagesTest.java 2011-05-05
10:40:09 UTC (rev 22469)
@@ -0,0 +1,132 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * 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.
+ *
+ * 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.richMessages;
+
+import static org.jboss.test.selenium.locator.LocatorFactory.jq;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+import org.richfaces.tests.metamer.ftest.richMessage.AbstractRichMessageTest;
+import org.testng.annotations.Test;
+
+
+/**
+ * Abstract class with list of tests appropriate for rich:messages component
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+public abstract class RichMessagesTest extends AbstractRichMessageTest {
+
+ // locator for main rich:message component (tested element)
+ protected static JQueryLocator mainMsg1 = pjq("span[id$=msgs1]");
+ protected static JQueryLocator mainMsg2 = pjq("span[id$=msgs2]");
+
+ // locators for
+ protected JQueryLocator summary =
getTestElemLocator().getDescendant(jq("span.rf-msgs-sum"));
+ protected JQueryLocator detail =
getTestElemLocator().getDescendant(jq("span.rf-msgs-det"));
+
+ protected JQueryLocator generateMsgsBtn =
pjq("input[id$=generateMsgsBtn]");
+
+ // Methods for error and warning message locators
+ private JQueryLocator getErrorMsg(JQueryLocator testElem) {
+ return testElem.getDescendant(jq("span.rf-msgs-err"));
+ }
+ private JQueryLocator getWarnMsg(JQueryLocator testElem) {
+ return testElem.getDescendant(jq("span.rf-msgs-wrn"));
+ }
+ private JQueryLocator getErrorMsg() {
+ return getErrorMsg(getTestElemLocator());
+ }
+ private JQueryLocator getWarnMsg() {
+ return getWarnMsg(getTestElemLocator());
+ }
+
+ /**
+ * Attribute 'for' change behavior: only messages bound to element with
+ * id specified in 'for' should be displayed
+ */
+ @Test
+ public void testFor() {
+
+ // firstly reset to null
+ attributes.setFor("");
+
+ // generate faces message by btn
+ selenium.click(generateMsgsBtn);
+
+ // no messages for simpleInput1 or simpleInput2 should appear
+
waitGui.until(countEquals.count(0).locator(getTestElemLocator().getChild(jq("span[id$=msgs1:form:simpleInput1]"))));
+
waitGui.until(countEquals.count(0).locator(getTestElemLocator().getChild(jq("span[id$=msgs1:form:simpleInput2]"))));
+
+ attributes.setFor("simpleInput1");
+ // generate faces messages by btn
+ selenium.click(generateMsgsBtn);
+ // only messages for simpleInput1 should appear:
+
waitModel.until(countEquals.count(2).locator(getTestElemLocator().getChild(jq("span[id$=msgs1:form:simpleInput1]"))));
+ // one type error
+ waitModel.until(countEquals.count(1).locator(getErrorMsg()));
+ // one type warning
+ waitModel.until(countEquals.count(1).locator(getWarnMsg()));
+
+ attributes.setFor("simpleInput2");
+ // generate faces messages by btn
+ selenium.click(generateMsgsBtn);
+ // only 2 messages for simpleInput2
+
waitModel.until(countEquals.count(2).locator(getTestElemLocator().getChild(jq("span[id$=msgs1:form:simpleInput2]"))));
+ // only 2 messages should appear
+ waitModel.until(countEquals.count(1).locator(getErrorMsg()));
+ waitModel.until(countEquals.count(1).locator(getWarnMsg()));
+ }
+
+ /**
+ * globalOnly change behavior of displaying messages.
+ * When <b>true</b> only messages not bound to any input are displayed
+ * <b>false</b> all messages are displayed
+ * This attribute cannot be set with <i>for</i> attribute.
+ *
+ * In this case, second messages component is relevant
+ * (with label "Messages2 - without 'for' but 'globalOnly'
attribute instead")
+ * This is the reason why used "mainMsg2" instead of getTestElemLocator()
+ */
+ @Test
+ public void testGlobalOnly() {
+ // firstly set for attribute to null
+ attributes.setFor("");
+
+ // then set globalOnly attribute
+ attributes.setGlobalOnly(Boolean.FALSE);
+
+ selenium.click(generateMsgsBtn);
+
+ // All messages should appear:
+ // for simpleInput1
+
waitModel.until(countEquals.count(2).locator(mainMsg2.getChild(jq("span[id$=:msgs2:form:simpleInput1]"))));
+ // for simpleInput2
+
waitModel.until(countEquals.count(2).locator(mainMsg2.getChild(jq("span[id$=:msgs2:form:simpleInput2]"))));
+ // global messages
+
waitModel.until(countEquals.count(2).locator(mainMsg2.getChild(jq("span[id$=:msgs2:]"))));
+ // three type error
+ waitModel.until(countEquals.count(3).locator(getErrorMsg(mainMsg2)));
+ // three type warning
+ waitModel.until(countEquals.count(3).locator(getWarnMsg(mainMsg2)));
+ }
+}
Copied:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesCSV.java
(from rev 22468,
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageCSV.java)
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesCSV.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesCSV.java 2011-05-05
10:40:09 UTC (rev 22469)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * 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.
+ *
+ * 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.richMessages;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+/**
+ * Test case for page /faces/components/richMessages/csv.xhtml
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+public class TestRichMessagesCSV extends RichMessagesTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richMessages/csv.xhtml");
+ }
+
+ @Override
+ public JQueryLocator getTestElemLocator() {
+ return mainMsg1;
+ }
+
+ @Override
+ public JQueryLocator getSummaryElemLocator() {
+ return summary;
+ }
+
+ @Override
+ public JQueryLocator getDetailElemLocator() {
+ return detail;
+ }
+
+}
Copied:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesJSFValidator.java
(from rev 22468,
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageCSV.java)
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesJSFValidator.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesJSFValidator.java 2011-05-05
10:40:09 UTC (rev 22469)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * 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.
+ *
+ * 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.richMessages;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+/**
+ * Test case for page /faces/components/richMessages/jsfValidator.xhtml
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+public class TestRichMessagesJSFValidator extends RichMessagesTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richMessages/jsfValidator.xhtml");
+ }
+
+ @Override
+ public JQueryLocator getTestElemLocator() {
+ return mainMsg1;
+ }
+
+ @Override
+ public JQueryLocator getSummaryElemLocator() {
+ return summary;
+ }
+
+ @Override
+ public JQueryLocator getDetailElemLocator() {
+ return detail;
+ }
+
+}
Copied:
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesJSR303.java
(from rev 22468,
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessage/TestRichMessageCSV.java)
===================================================================
---
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesJSR303.java
(rev 0)
+++
modules/tests/metamer/trunk/ftest-source/src/main/java/org/richfaces/tests/metamer/ftest/richMessages/TestRichMessagesJSR303.java 2011-05-05
10:40:09 UTC (rev 22469)
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * JBoss, Home of Professional Open Source
+ * 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.
+ *
+ * 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.richMessages;
+
+import static org.jboss.test.selenium.utils.URLUtils.buildUrl;
+
+import java.net.URL;
+
+import org.jboss.test.selenium.locator.JQueryLocator;
+
+/**
+ * Test case for page /faces/components/richMessages/jsr303.xhtml
+ *
+ * @author <a href="mailto:jjamrich@redhat.com">Jan Jamrich</a>
+ * @version $Revision$
+ */
+public class TestRichMessagesJSR303 extends RichMessagesTest {
+
+ @Override
+ public URL getTestUrl() {
+ return buildUrl(contextPath,
"faces/components/richMessages/jsr303.xhtml");
+ }
+
+ @Override
+ public JQueryLocator getTestElemLocator() {
+ return mainMsg1;
+ }
+
+ @Override
+ public JQueryLocator getSummaryElemLocator() {
+ return summary;
+ }
+
+ @Override
+ public JQueryLocator getDetailElemLocator() {
+ return detail;
+ }
+
+}