Author: andrei_exadel
Date: 2008-08-07 04:14:04 -0400 (Thu, 07 Aug 2008)
New Revision: 9961
Modified:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/A4JCommandTestBean.java
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommandButton/ajaxButtonTest.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommandLink/ajaxLinkTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandButtonTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandLinkTest.java
Log:
Add test of rerendering to ajax commands
Modified:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/A4JCommandTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/A4JCommandTestBean.java 2008-08-06
18:43:50 UTC (rev 9960)
+++
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/A4JCommandTestBean.java 2008-08-07
08:14:04 UTC (rev 9961)
@@ -1,5 +1,6 @@
package org.ajax4jsf.bean;
+import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@@ -77,5 +78,9 @@
public void setRendered(boolean rendered) {
this.rendered = rendered;
}
+
+ public String getDate () {
+ return String.valueOf(Math.random());
+ }
}
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommandButton/ajaxButtonTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommandButton/ajaxButtonTest.xhtml 2008-08-06
18:43:50 UTC (rev 9960)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommandButton/ajaxButtonTest.xhtml 2008-08-07
08:14:04 UTC (rev 9961)
@@ -116,7 +116,7 @@
actionListener="#{commandBean.actionListener}"
oncomplete="onCompleteHandler(data);"
onmousedown="setValidation(true)"
- reRender="_value"
+ reRender="_value, _rerender"
<a4j:ajaxListener
type="org.ajax4jsf.bean.TestListener"></a4j:ajaxListener>
</a4j:commandButton>
@@ -202,6 +202,7 @@
</tbody>
</table>
<h:inputHidden id="_value" required="true"
value="#{commandBean.value}"></h:inputHidden>
+ <h:outputText id="_rerender"
value="#{commandBean.date}"></h:outputText>
</h:form>
</ui:define>
</ui:composition>
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommandLink/ajaxLinkTest.xhtml
===================================================================
(Binary files differ)
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandButtonTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandButtonTest.java 2008-08-06
18:43:50 UTC (rev 9960)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandButtonTest.java 2008-08-07
08:14:04 UTC (rev 9961)
@@ -15,6 +15,9 @@
String parentId = getParentId() + "_form:";
String buttonId = parentId + "b1";
+
+ String rerenderId = parentId + "_rerender";
+ String rerenderStr = getTextById(rerenderId);
boolean ajaxSingle = false;
boolean immediate = false;
writeStatus("Click button 1");
@@ -23,6 +26,7 @@
waitForAjaxCompletion();
waitForOnCompleteHndler();
checkButton(buttonId, true, ajaxSingle, immediate, true, true, true, true);
+ checkRerendering(rerenderStr, rerenderId);
buttonId = parentId + "b2";
ajaxSingle = false;
@@ -67,6 +71,13 @@
runScript("_onCompleteHandler = false;");
}
+ private void checkRerendering(String oldRerender, String rerenderId) {
+ String newRerender = getTextById(rerenderId);
+ if (oldRerender.equals(newRerender)) {
+ Assert.fail("<a4j:commandButton> failed. Rerender does not
work.");
+ }
+ }
+
private void checkButton(String id, boolean testData, boolean ajaxSingle, boolean
immediate, boolean testAction, boolean testActionListener, boolean testFListener, boolean
testInput) {
writeStatus("Checking button...");
StringBuffer buffer = new StringBuffer("checkButton('");
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandLinkTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandLinkTest.java 2008-08-06
18:43:50 UTC (rev 9960)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandLinkTest.java 2008-08-07
08:14:04 UTC (rev 9961)
@@ -13,6 +13,9 @@
renderPage(template);
String parentId = getParentId() + "_form:";
+
+ String rerenderId = parentId + "_rerender";
+ String rerenderStr = getTextById(rerenderId);
String linkId = parentId + "l1";
boolean ajaxSingle = false;
@@ -23,6 +26,7 @@
waitForAjaxCompletion();
waitForOnCompleteHndler();
checkButton(linkId, true, ajaxSingle, immediate, true, true, true, true);
+ checkRerendering(rerenderStr, rerenderId);
linkId = parentId + "l2";
ajaxSingle = false;
@@ -69,6 +73,13 @@
runScript("_onCompleteHandler = false;");
}
+ private void checkRerendering(String oldRerender, String rerenderId) {
+ String newRerender = getTextById(rerenderId);
+ if (oldRerender.equals(newRerender)) {
+ Assert.fail("<a4j:commandButton> failed. Rerender does not
work.");
+ }
+ }
+
private void checkButton(String id, boolean testData, boolean ajaxSingle, boolean
immediate, boolean testAction, boolean testActionListener, boolean testFListener, boolean
testInput) {
writeStatus("Checking link...");
StringBuffer buffer = new StringBuffer("checkLink('");