Author: andrei_exadel
Date: 2008-05-27 12:00:11 -0400 (Tue, 27 May 2008)
New Revision: 8785
Added:
trunk/test-applications/seleniumTest/src/main/webapp/layout/controlLayout.xhtml
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommandButton/ajaxButtonTest.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/template/dataTable.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/template/modalPanel.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/template/simple.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandButtonTest.java
Log:
command button test
Added: trunk/test-applications/seleniumTest/src/main/webapp/layout/controlLayout.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/layout/controlLayout.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/src/main/webapp/layout/controlLayout.xhtml 2008-05-27
16:00:11 UTC (rev 8785)
@@ -0,0 +1,34 @@
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+<hr />
+<h:form id="_Selenium_Test_Template_Form">
+<table style="background-color: #F2F2F2">
+<tr>
+<td>
+Current Template:
+</td>
+<td>
+ <h:selectOneMenu value="#{templateBean.templateId}"
id="_Selenium_Test_Template_id">
+ <f:selectItem itemValue="simple" itemLabel="Simple"/>
+ <f:selectItem itemValue="dataTable" itemLabel="DataTable"/>
+ <f:selectItem itemValue="modalPanel" itemLabel="Modal
Panel"/>
+ </h:selectOneMenu>
+</td>
+<td>
+ <h:commandLink id="_Selenium_Test_loadTemplate"
value="Load"></h:commandLink>
+</td>
+</tr>
+</table>
+</h:form>
+<h:form id="_Selenium_Test_ReRender_Form">
+<div>
+ <a
href="#{facesContext.externalContext.requestContextPath}/faces/index.xhtml">Home</a>
+</div>
+<div>
+ <a4j:commandLink ajaxSingle="true"
reRender="_Selenium_Test_Common_Grid" value="ReRenderAll"
id="_reRender"/>
+</div>
+</h:form>
+</html>
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml 2008-05-27
15:41:11 UTC (rev 8784)
+++ trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml 2008-05-27
16:00:11 UTC (rev 8785)
@@ -27,7 +27,7 @@
}
function reRenderAll () {
- document.getElementById('_Selenium_Test_Template_Form:_reRender').onclick();
+ document.getElementById('_Selenium_Test_ReRender_Form:_reRender').onclick();
return;
}
@@ -44,6 +44,7 @@
function writeStatus (mess) {
document.getElementById('_Selenium_Test_Status_Message').value = mess;
}
+
</script>
<style type="text/css">
<ui:insert name="style"/>
@@ -65,34 +66,9 @@
</h:panelGrid>
<div id="_Selenium_Test_ControlPoint2" style="display:
none;">Control2</div>
-<hr />
-<h:form id="_Selenium_Test_Template_Form">
-<table style="background-color: #F2F2F2">
-<tr>
-<td>
-Current Template:
-</td>
-<td>
- <h:selectOneMenu value="#{templateBean.templateId}"
id="_Selenium_Test_Template_id">
- <f:selectItem itemValue="simple" itemLabel="Simple"/>
- <f:selectItem itemValue="dataTable" itemLabel="DataTable"/>
- <f:selectItem itemValue="modalPanel" itemLabel="Modal
Panel"/>
- </h:selectOneMenu>
-</td>
-<td>
- <h:commandLink id="_Selenium_Test_loadTemplate"
value="Load"></h:commandLink>
-</td>
-</tr>
-<tr>
-<td>
- <a
href="#{facesContext.externalContext.requestContextPath}/faces/index.xhtml">Home</a>
-</td>
-<td>
- <a4j:commandLink ajaxSingle="true"
reRender="_Selenium_Test_Common_Grid" value="ReRenderAll"
id="_reRender"/>
-</td>
-</tr>
-</table>
-</h:form>
+
+<ui:insert name="control" />
+
<script type="text/javascript">
window.done=false; A4J.AJAX.AddListener(new
A4J.AJAX.Listener(function(){window.done=true;}));
</script>
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommandButton/ajaxButtonTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommandButton/ajaxButtonTest.xhtml 2008-05-27
15:41:11 UTC (rev 8784)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/ajaxCommandButton/ajaxButtonTest.xhtml 2008-05-27
16:00:11 UTC (rev 8785)
@@ -20,8 +20,13 @@
<script type="text/javascript">
<!--
var responseData = null;
+ var _onCompleteHandler = false;
+
function onCompleteHandler (data) {
- responseData = data;
+ if (data) {
+ responseData = data;
+ }
+ _onCompleteHandler = true;
}
function checkButton(id, testData ,testAction, testActionListener, testFListener,
testInput) {
@@ -45,8 +50,10 @@
responseData = null;
if (b == '') {
writeStatus('Test button id=['+id+'] passed succesfully');
+ markButton(id, true);
}else {
writeStatus('Test button id=['+id+'] failed');
+ markButton(id, false);
}
return b;
}
@@ -57,6 +64,14 @@
}
return true;
}
+
+ function markButton(id, success) {
+ if (success) {
+ document.getElementById(id).style.cssText = 'background-color: green';
+ }else {
+ document.getElementById(id).style.cssText = 'background-color: red';
+ }
+ }
function setValidation(success) {
var i = document.getElementById(getParentId() + '_form:_value');
@@ -68,10 +83,9 @@
}
}
}
-
-->
</script>
-
+
<h:form id="_form">
<table border="1px" cellspacing="0"
cellpadding="3">
<thead style="font-size: 13px; color: green; font-style: italic;">
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml 2008-05-27
15:41:11 UTC (rev 8784)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml 2008-05-27
16:00:11 UTC (rev 8785)
@@ -29,7 +29,8 @@
</rich:togglePanel>
<rich:toggleControl id="ajax_next" for="panel_ajax"
action="#{panelBean.increment}"
actionListener="#{panelBean.actionListener}" >
- <h:outputText value="Ajax next" />
+ <h:outputText value="Ajax next" />
+ <a4j:ajaxListener
type="org.ajax4jsf.ajax.ForceRender"></a4j:ajaxListener>
</rich:toggleControl>
<br />
<rich:toggleControl id="ajax_one" for="panel_ajax"
switchToState="one"
@@ -65,8 +66,10 @@
<br />
<rich:toggleControl id="server_two" for="panel_server"
switchToState="two"
action="#{panelBean.increment}"
actionListener="#{panelBean.actionListener}" >
- <h:outputText value="Server two" />
- </rich:toggleControl>
+ <h:outputText value="Server two" />
+
+ </rich:toggleControl>
+
</h:panelGroup>
<h:panelGroup layout="block" styleClass="component_div" >
Modified: trunk/test-applications/seleniumTest/src/main/webapp/template/dataTable.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/src/main/webapp/template/modalPanel.xhtml
===================================================================
(Binary files differ)
Modified: trunk/test-applications/seleniumTest/src/main/webapp/template/simple.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-05-27
15:41:11 UTC (rev 8784)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxCommandButtonTest.java 2008-05-27
16:00:11 UTC (rev 8785)
@@ -52,6 +52,7 @@
setValidation(true);
clickById(buttonId);
waitForAjaxCompletion();
+ waitForOnCompleteHndler();
checkButton(buttonId, true, ajaxSingle, immediate, true, true, true, true);
buttonId = parentId + "b2";
@@ -61,6 +62,7 @@
setValidation(false);
clickById(buttonId);
waitForAjaxCompletion();
+ waitForOnCompleteHndler();
checkButton(buttonId, false, ajaxSingle, immediate, false, false, false, false);
buttonId = parentId + "b3";
@@ -70,6 +72,7 @@
setValidation(true);
clickById(buttonId);
waitForAjaxCompletion();
+ waitForOnCompleteHndler();
checkButton(buttonId, true, ajaxSingle, immediate, true, true, true, false);
buttonId = parentId + "b4";
@@ -79,6 +82,7 @@
setValidation(false);
clickById(buttonId);
waitForAjaxCompletion();
+ waitForOnCompleteHndler();
checkButton(buttonId, true, ajaxSingle, immediate, true, true, true, false);
@@ -91,6 +95,11 @@
runScript(buffer.toString());
}
+ private void waitForOnCompleteHndler () {
+ waiteForCondition("_onCompleteHandler == true;", 3000);
+ runScript("_onCompleteHandler = false;");
+ }
+
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('");