Author: dsvyatobatsko
Date: 2008-10-30 04:51:11 -0400 (Thu, 30 Oct 2008)
New Revision: 10974
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxPush/ajaxPushAutoTest.xhtml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxPushTestBean.java
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPushTest.java
Log:
https://jira.jboss.org/jira/browse/RF-4746
https://jira.jboss.org/jira/browse/RF-4747
Modified:
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxPushTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxPushTestBean.java 2008-10-30
00:26:08 UTC (rev 10973)
+++
trunk/test-applications/seleniumTest/richfaces/src/main/java/org/ajax4jsf/bean/AjaxPushTestBean.java 2008-10-30
08:51:11 UTC (rev 10974)
@@ -18,7 +18,25 @@
private int eventsSent = 0;
+ private String content = "content";
+
/**
+ * Gets value of content field.
+ * @return value of content field
+ */
+ public String getContent() {
+ return content;
+ }
+
+ /**
+ * Set a new value for content field.
+ * @param content a new value for content field
+ */
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ /**
* Gets value of eventsSent field.
* @return value of eventsSent field
*/
@@ -85,4 +103,8 @@
this.enabled = enabled;
}
+ public void restart() {
+ stop();
+ start();
+ }
}
Added:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxPush/ajaxPushAutoTest.xhtml
===================================================================
(Binary files differ)
Property changes on:
trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/ajaxPush/ajaxPushAutoTest.xhtml
___________________________________________________________________
Name: svn:mime-type
+ application/xhtml+xml
Modified:
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPushTest.java
===================================================================
---
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPushTest.java 2008-10-30
00:26:08 UTC (rev 10973)
+++
trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AjaxPushTest.java 2008-10-30
08:51:11 UTC (rev 10974)
@@ -1,23 +1,39 @@
package org.richfaces.testng;
+import java.util.HashMap;
+import java.util.Map;
+
import org.ajax4jsf.template.Template;
+import org.richfaces.AutoTester;
import org.richfaces.SeleniumTestBase;
import org.testng.Assert;
import org.testng.annotations.Test;
public class AjaxPushTest extends SeleniumTestBase {
+ private final static String RESTART_RESET = "#{ajaxPushBean.restart}";
+
+ private final static String STOP_RESET = "#{ajaxPushBean.stop}";
+
+ private static Map<String, String> params = new HashMap<String,
String>();
+
+ static {
+ params.put("parameter1", "value1");
+ params.put("parameter2", "value2");
+ params.put("parameter3", "value3");
+ }
+
@Test
public void testAjaxPushComponent(Template template) throws Exception {
- renderPage(template);
-
+ renderPage(template, STOP_RESET);
+
String parentId = getParentId() + "_form:";
String startBtnID = parentId + "startButton";
- String stopBtnID = parentId + "stopButton";
+ String stopBtnID = parentId + "stopButton";
- String startPanelID = parentId + "startPanel";
- String progressPanelID = parentId + "progressPanel";
+ String startPanelID = parentId + "startPanel";
+ String progressPanelID = parentId + "progressPanel";
writeStatus("Check layout before start pushing");
@@ -47,7 +63,7 @@
int eventAfter = getEventsCount();
- if(eventBefore >= eventAfter) {
+ if (eventBefore >= eventAfter) {
Assert.fail("PushEvents are not fired");
}
@@ -65,6 +81,33 @@
}
+ @Test
+ public void testNestedParams(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, RESTART_RESET);
+ writeStatus("Test component encodes nested f:param tags and their values are
present as request parameters");
+ tester.testRequestParameters(params);
+ }
+
+ @Test
+ public void testRenderedAttribute(Template template) {
+ AutoTester tester = getAutoTester(this);
+ tester.renderPage(template, null);
+ writeStatus("Test component with rendered = false is not present on the
page");
+ tester.testRendered();
+ }
+
+ @Override
+ public void sendAjax() {
+ delay(1500);
+ }
+
+ @Override
+ public void setInternalValidationFailed() {
+ String childCompId = getAutoTester(this).getClientId("") +
"child";
+ setValueById(childCompId, "");
+ }
+
private int getEventsCount() throws Exception {
String events = getTextById(getParentId() + "_form:events");
try {
@@ -80,4 +123,9 @@
return "pages/ajaxPush/ajaxPushTest.xhtml";
}
+ @Override
+ public String getAutoTestUrl() {
+ return "pages/ajaxPush/ajaxPushAutoTest.xhtml";
+ }
+
}