Author: alevkovsky
Date: 2008-12-09 10:18:48 -0500 (Tue, 09 Dec 2008)
New Revision: 11665
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/testMoreThanOneMessage.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractMessageTest.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessagesTest.java
Log:
https://jira.jboss.org/jira/browse/RF-5127
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/testMoreThanOneMessage.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/testMoreThanOneMessage.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractMessageTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractMessageTest.java 2008-12-09
15:06:12 UTC (rev 11664)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractMessageTest.java 2008-12-09
15:18:48 UTC (rev 11665)
@@ -29,7 +29,11 @@
protected String label;
protected void init(Template template) {
- renderPage(template, "#{messageBean.init}");
+ init(template, null);
+ }
+
+ protected void init(Template template, String url) {
+ renderPage(url, template, "#{messageBean.init}");
mainForm = getParentId() + "mainForm";
inputText = mainForm + ":inputText";
message = mainForm + ":message";
@@ -112,13 +116,13 @@
public void testRendered(Template template) {
init(template);
init(template);
- Assert.assertTrue(selenium.isElementPresent(message), "ListShuttle must be
rendered.");
+ Assert.assertTrue(selenium.isElementPresent(message), "Message must be
rendered.");
selenium.click(rendered);
waitForAjaxCompletion();
clickAjaxCommandAndWait(submit);
- Assert.assertFalse(selenium.isElementPresent(message), "ListShuttle
mustn't be rendered.");
+ Assert.assertFalse(selenium.isElementPresent(message), "Message mustn't
be rendered.");
}
}
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessagesTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessagesTest.java 2008-12-09
15:06:12 UTC (rev 11664)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessagesTest.java 2008-12-09
15:18:48 UTC (rev 11665)
@@ -1,9 +1,14 @@
package org.richfaces.testng;
import org.ajax4jsf.template.Template;
+import org.testng.Assert;
+import org.testng.annotations.Test;
public class MessagesTest extends AbstractMessageTest {
+ private static String TEST_MORE_THAN_ONE_MESSAGE =
"pages/message/testMoreThanOneMessage.xhtml";
+ private static String TEST_MESSAGES_WITH_FOR_ATTRIBUTE =
"pages/message/testMessagesWithForAttribute.xhtml";
+
@Override
protected void init(Template template) {
super.init(template);
@@ -14,4 +19,31 @@
public String getTestUrl() {
return "pages/message/messages.xhtml";
}
+
+ @Test
+ public void testComponentOutputAllMessagesByAjax(Template template) {
+ init(template, TEST_MORE_THAN_ONE_MESSAGE);
+
+ Assert.assertFalse(selenium.isElementPresent(mainForm + ":fatalMarker"));
+ Assert.assertFalse(selenium.isElementPresent(mainForm + ":errorMarker"));
+
+ selenium.type(inputText, "fatal");
+ selenium.type(inputText + "2", "");
+ selenium.type(inputText + "3", "");
+
+ clickAjaxCommandAndWait(mainForm + ":submitWithoutReRender");
+ Assert.assertTrue(selenium.isElementPresent(mainForm + ":fatalMarker"));
+ Assert.assertTrue(selenium.isElementPresent(mainForm + ":errorMarker"));
+ Assert.assertEquals("messageSummary",
selenium.getText("xpath=id('" + message +
"')/dt[1]/span[2]"));
+ Assert.assertEquals("Required message 1",
selenium.getText("xpath=id('" + message +
"')/dt[2]/span[2]"));
+ Assert.assertEquals("Required message 2",
selenium.getText("xpath=id('" + message +
"')/dt[3]/span[2]"));
+
+ selenium.type(inputText, "passed");
+ selenium.type(inputText + "2", "passed");
+ selenium.type(inputText + "3", "passed");
+
+ clickAjaxCommandAndWait(mainForm + ":submitWithoutReRender");
+ Assert.assertFalse(selenium.isElementPresent(mainForm + ":fatalMarker"));
+ Assert.assertFalse(selenium.isElementPresent(mainForm + ":errorMarker"));
+ }
}