Author: sergeyhalipov
Date: 2008-05-27 13:08:13 -0400 (Tue, 27 May 2008)
New Revision: 8789
Modified:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelMenu/panelMenuTest.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/PanelMenuTest.java
Log:
Selenium: Fixed panel menu test.
Modified:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java 2008-05-27
16:43:06 UTC (rev 8788)
+++
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/bean/RichPanelTestBean.java 2008-05-27
17:08:13 UTC (rev 8789)
@@ -26,6 +26,8 @@
public class RichPanelTestBean {
private String value;
private int value2;
+ private Object panelValue;
+ private Object panelValue2;
public RichPanelTestBean() {
value = "";
@@ -69,5 +71,28 @@
public void setValue2(int value2) {
this.value2 = value2;
}
+
+ public Object getPanelValue() {
+ return panelValue;
+ }
+ public void setPanelValue(Object panelValue) {
+ this.panelValue = panelValue;
+ }
+
+ public void cleanValues(ActionEvent event) {
+ value = "";
+ value2 = 0;
+ panelValue = null;
+ panelValue2 = null;
+ }
+
+ public Object getPanelValue2() {
+ return panelValue2;
+ }
+
+ public void setPanelValue2(Object panelValue2) {
+ this.panelValue2 = panelValue2;
+ }
+
}
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelMenu/panelMenuTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelMenu/panelMenuTest.xhtml 2008-05-27
16:43:06 UTC (rev 8788)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelMenu/panelMenuTest.xhtml 2008-05-27
17:08:13 UTC (rev 8789)
@@ -16,7 +16,7 @@
}
</ui:define>
<ui:define name="component">
- <h:form id="_form">
+ <h:form id="_form1" >
<h:panelGroup layout="block" styleClass="component_div" >
<b>Multiple</b>
<rich:panelMenu id="pMenu" >
@@ -24,7 +24,8 @@
label="Ajax group"
action="#{panelBean.increment}"
actionListener="#{panelBean.actionListener}"
- reRender="_value,_value2" >
+ reRender="_value,_value2"
+ value="#{panelBean.panelValue2}" >
<rich:panelMenuItem id="pItem1"
label="Item 1"
action="#{panelBean.action1}"
@@ -33,7 +34,8 @@
<rich:panelMenuGroup id="pGroup2" expandMode="server"
label="Server group"
action="#{panelBean.increment}"
- actionListener="#{panelBean.actionListener}" >
+ actionListener="#{panelBean.actionListener}"
+ value="#{panelBean.panelValue}" >
<rich:panelMenuItem id="pItem2"
label="Item 2" />
</rich:panelMenuGroup>
@@ -49,7 +51,9 @@
</rich:panelMenuGroup>
</rich:panelMenu>
</h:panelGroup>
-
+ </h:form>
+
+ <h:form id="_form2" >
<h:panelGroup layout="block" styleClass="component_div" >
<b>Single</b>
<rich:panelMenu id="pMenu_single" expandSingle="true" >
@@ -57,7 +61,8 @@
label="Ajax group"
action="#{panelBean.increment}"
actionListener="#{panelBean.actionListener}"
- reRender="_value,_value2" >
+ reRender="_value,_value2"
+ value="#{panelBean.panelValue2}" >
<rich:panelMenuItem id="pItem1_single"
label="Item 1"
action="#{panelBean.action2}"
@@ -66,7 +71,8 @@
<rich:panelMenuGroup id="pGroup2_single" expandMode="server"
label="Server group"
action="#{panelBean.increment}"
- actionListener="#{panelBean.actionListener}" >
+ actionListener="#{panelBean.actionListener}"
+ value="#{panelBean.panelValue}" >
<rich:panelMenuItem id="pItem2_single"
label="Item 2" />
</rich:panelMenuGroup>
@@ -82,12 +88,13 @@
</rich:panelMenuGroup>
</rich:panelMenu>
</h:panelGroup>
+ <a4j:commandButton value="Clean values" id="clean"
actionListener="#{panelBean.cleanValues}" ajaxSingle="true" />
+ </h:form>
<br/>
- <h:inputText value="#{panelBean.value}"
id="_value"></h:inputText>
- <h:outputText value="#{panelBean.value2}"
id="_value2"></h:outputText>
- <br/>
- </h:form>
+ <h:outputText value="#{panelBean.value}" id="_value" />
+ <h:outputText value="#{panelBean.value2}" id="_value2" />
+ <br/>
</ui:define>
</ui:composition>
</html>
\ No newline at end of file
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
16:43:06 UTC (rev 8788)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml 2008-05-27
17:08:13 UTC (rev 8789)
@@ -46,7 +46,8 @@
<h:panelGroup layout="block" styleClass="component_div" >
<rich:togglePanel id="panel_server" switchType="server"
initialState="one"
- stateOrder="one,two">
+ stateOrder="one,two"
+ value="#{panelBean.panelValue}" >
<f:facet name="one">
<h:outputText id="server_state_one" value="State One" />
</f:facet>
@@ -100,7 +101,8 @@
<h:inputText value="#{panelBean.value}"
id="_value"></h:inputText>
<h:outputText value="#{panelBean.value2}"
id="_value2"></h:outputText>
</a4j:outputPanel>
- <br/>
+ <br/>
+ <a4j:commandButton value="Clean values" id="clean"
actionListener="#{panelBean.cleanValues}" ajaxSingle="true" />
</h:form>
</ui:define>
</ui:composition>
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/PanelMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/PanelMenuTest.java 2008-05-27
16:43:06 UTC (rev 8788)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/PanelMenuTest.java 2008-05-27
17:08:13 UTC (rev 8789)
@@ -51,10 +51,10 @@
private void _testPanelMenuComponent(Templates template) {
renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
+ String parentId = getParentId() + "_form1:";
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
+ String value1Id = getParentId() + "_value";
+ String value2Id = getParentId() + "_value2";
String ajaxGroup = "tablehide" + parentId + "pGroup1";
String serverGroup = "tablehide" + parentId + "pGroup2";
@@ -69,16 +69,16 @@
writeStatus("Click on ajax group");
clickById(ajaxGroup);
waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1");
- AssertTextEquals(outputId, "1");
+ AssertTextEquals(value1Id, "pGroup1");
+ AssertTextEquals(value2Id, "1");
Assert.assertTrue(isVisibleById(ajaxItem));
Assert.assertFalse(isVisibleById(serverItem));
Assert.assertFalse(isVisibleById(clientItem));
writeStatus("Click on server group");
clickCommandAndWait(serverGroup);
- AssertValueEquals(inputId, "pGroup2");
- AssertTextEquals(outputId, "2");
+ AssertTextEquals(value1Id, "pGroup2");
+ AssertTextEquals(value2Id, "2");
Assert.assertTrue(isVisibleById(ajaxItem));
Assert.assertTrue(isVisibleById(serverItem));
Assert.assertFalse(isVisibleById(clientItem));
@@ -86,8 +86,8 @@
writeStatus("Click on ajax group");
clickById(ajaxGroup);
waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1");
- AssertTextEquals(outputId, "3");
+ AssertTextEquals(value1Id, "pGroup1");
+ AssertTextEquals(value2Id, "3");
Assert.assertFalse(isVisibleById(ajaxItem));
Assert.assertTrue(isVisibleById(serverItem));
Assert.assertFalse(isVisibleById(clientItem));
@@ -95,8 +95,8 @@
writeStatus("Click on server group");
clickCommandAndWait(serverGroup);
- AssertValueEquals(inputId, "pGroup2");
- AssertTextEquals(outputId, "4");
+ AssertTextEquals(value1Id, "pGroup2");
+ AssertTextEquals(value2Id, "4");
Assert.assertFalse(isVisibleById(ajaxItem));
Assert.assertFalse(isVisibleById(serverItem));
Assert.assertFalse(isVisibleById(clientItem));
@@ -116,14 +116,16 @@
writeStatus("Click on disabled client group");
clickById(disabledGroup);
Assert.assertFalse(isVisibleById(disabledItem));
+
+ tearDown();
}
private void _testPanelMenuComponentSingleMode(Templates template) {
renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
+ String parentId = getParentId() + "_form2:";
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
+ String value1Id = getParentId() + "_value";
+ String value2Id = getParentId() + "_value2";
String ajaxGroup = "tablehide" + parentId +
"pGroup1_single";
String serverGroup = "tablehide" + parentId +
"pGroup2_single";
@@ -138,16 +140,16 @@
writeStatus("Click on ajax group");
clickById(ajaxGroup);
waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1_single");
- AssertTextEquals(outputId, "1");
+ AssertTextEquals(value1Id, "pGroup1_single");
+ AssertTextEquals(value2Id, "1");
Assert.assertTrue(isVisibleById(ajaxItem));
Assert.assertFalse(isVisibleById(serverItem));
Assert.assertFalse(isVisibleById(clientItem));
writeStatus("Click on server group");
clickCommandAndWait(serverGroup);
- AssertValueEquals(inputId, "pGroup2_single");
- AssertTextEquals(outputId, "2");
+ AssertTextEquals(value1Id, "pGroup2_single");
+ AssertTextEquals(value2Id, "2");
Assert.assertFalse(isVisibleById(ajaxItem));
Assert.assertTrue(isVisibleById(serverItem));
Assert.assertFalse(isVisibleById(clientItem));
@@ -155,16 +157,16 @@
writeStatus("Click on ajax group");
clickById(ajaxGroup);
waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1_single");
- AssertTextEquals(outputId, "3");
+ AssertTextEquals(value1Id, "pGroup1_single");
+ AssertTextEquals(value2Id, "3");
Assert.assertTrue(isVisibleById(ajaxItem));
Assert.assertFalse(isVisibleById(serverItem));
Assert.assertFalse(isVisibleById(clientItem));
writeStatus("Click on server group");
clickCommandAndWait(serverGroup);
- AssertValueEquals(inputId, "pGroup2_single");
- AssertTextEquals(outputId, "4");
+ AssertTextEquals(value1Id, "pGroup2_single");
+ AssertTextEquals(value2Id, "4");
Assert.assertFalse(isVisibleById(ajaxItem));
Assert.assertTrue(isVisibleById(serverItem));
Assert.assertFalse(isVisibleById(clientItem));
@@ -184,44 +186,54 @@
writeStatus("Click on disabled client group");
clickById(disabledGroup);
Assert.assertFalse(isVisibleById(disabledItem));
+
+ tearDown();
}
private void _testPanelMenuItemAction(Templates template) {
renderPage(getTestUrl(), template);
- String parentId = getParentId() + "_form:";
+ String parentId = getParentId() + "_form";
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
+ String value1Id = getParentId() + "_value";
+ String value2Id = getParentId() + "_value2";
- String group = "tablehide" + parentId + "pGroup1";
- String groupSingle = "tablehide" + parentId + "pGroup1_single";
+ String group = "tablehide" + parentId + "1:pGroup1";
+ String groupSingle = "tablehide" + parentId + "2:pGroup1_single";
- String item = "tablehide" + parentId + "pItem1";
- String itemSingle = "tablehide" + parentId +
"pItem1_single";
+ String item = "tablehide" + parentId + "1:pItem1";
+ String itemSingle = "tablehide" + parentId +
"2:pItem1_single";
writeStatus("Click on ajax group");
clickById(group);
waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1");
+ AssertTextEquals(value1Id, "pGroup1");
writeStatus("Click on ajax group");
clickById(groupSingle);
waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1_single");
+ AssertTextEquals(value1Id, "pGroup1_single");
writeStatus("Click on server group");
clickCommandAndWait(item);
- AssertValueEquals(inputId, "pItem1");
- AssertTextEquals(outputId, "1");
+ AssertTextEquals(value1Id, "pItem1");
+ AssertTextEquals(value2Id, "1");
writeStatus("Click on server group");
clickCommandAndWait(itemSingle);
- AssertValueEquals(inputId, "pItem1_single");
- AssertTextEquals(outputId, "2");
+ AssertTextEquals(value1Id, "pItem1_single");
+ AssertTextEquals(value2Id, "2");
+
+ tearDown();
}
public String getTestUrl() {
return "/faces/pages/panelMenu/panelMenuTest.xhtml";
}
+
+ private void tearDown() {
+ writeStatus("Clean bean values");
+ clickById(getParentId() + "_form2:clean");
+ waitForAjaxCompletion();
+ }
}