Author: sergeyhalipov
Date: 2008-05-13 11:15:16 -0400 (Tue, 13 May 2008)
New Revision: 8555
Modified:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/ContextMenuTestBean.java
trunk/test-applications/seleniumTest/src/main/webapp/pages/contextMenu/contextMenu.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/Templates.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java
Log:
Selenium tests for context menu.
Modified:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/ContextMenuTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/ContextMenuTestBean.java 2008-05-13
14:38:18 UTC (rev 8554)
+++
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/ContextMenuTestBean.java 2008-05-13
15:15:16 UTC (rev 8555)
@@ -26,7 +26,12 @@
public class ContextMenuTestBean {
private String value;
- private int value2 = 0;
+ private int value2;
+
+ public ContextMenuTestBean() {
+ value = "";
+ value2 = 0;
+ }
public void actionListener(ActionEvent event) {
this.value = event.getComponent().getId();
@@ -41,7 +46,11 @@
}
public String action() {
- value2++;
+ if (4 == value2 ) {
+ value2 = 1;
+ } else {
+ value2++;
+ }
return null;
}
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/contextMenu/contextMenu.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/contextMenu/contextMenu.xhtml 2008-05-13
14:38:18 UTC (rev 8554)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/contextMenu/contextMenu.xhtml 2008-05-13
15:15:16 UTC (rev 8555)
@@ -9,33 +9,34 @@
<ui:composition template="#{templateBean.template}">
<ui:define name="component">
<h:form id="_form">
- <rich:contextMenu submitMode="server" id="menu_input"
attached="false" >
- <rich:menuItem action="#{contextMenuBean.action}"
- value="One" submitMode="ajax"
- actionListener="#{contextMenuBean.actionListener}"
- id="menu1_item1"
- reRender="input,input2" >
- </rich:menuItem>
- <rich:menuSeparator />
- <rich:menuItem action="#{contextMenuBean.action}"
- value="Two"
- actionListener="#{contextMenuBean.actionListener}"
- id="menu1_item2" >
- </rich:menuItem>
- <rich:menuItem action="#{contextMenuBean.action}"
- value="Three"
- actionListener="#{contextMenuBean.actionListener}" >
- </rich:menuItem>
- </rich:contextMenu>
+ <h:inputText id="input" value="#{contextMenuBean.value}" >
+ <rich:contextMenu submitMode="server" id="menu_input"
attached="true" event="onclick" >
+ <rich:menuItem action="#{contextMenuBean.action}"
+ value="One" submitMode="ajax"
+ actionListener="#{contextMenuBean.actionListener}"
+ id="menu1_item1"
+ reRender="input,_value2" >
+ </rich:menuItem>
+ <rich:menuSeparator />
+ <rich:menuItem action="#{contextMenuBean.action}"
+ value="Two"
+ actionListener="#{contextMenuBean.actionListener}"
+ id="menu1_item2" >
+ </rich:menuItem>
+ <rich:menuItem action="#{contextMenuBean.action}"
+ value="Three"
+ actionListener="#{contextMenuBean.actionListener}" >
+ </rich:menuItem>
+ </rich:contextMenu>
+ </h:inputText>
- <h:inputText id="input" value="#{contextMenuBean.value}" />
- <h:inputText id="input2" value="#{contextMenuBean.value2}"
>
+ <h:inputText id="input2" >
<rich:contextMenu submitMode="server" id="menu_input2"
event="onclick" >
<rich:menuItem action="#{contextMenuBean.action}"
value="One" submitMode="ajax"
actionListener="#{contextMenuBean.actionListener}"
id="menu2_item1"
- reRender="input,input2" >
+ reRender="input,_value2" >
</rich:menuItem>
<rich:menuSeparator />
<rich:menuItem action="#{contextMenuBean.action}"
@@ -49,10 +50,7 @@
</rich:menuItem>
</rich:contextMenu>
</h:inputText>
-
- <rich:componentControl event="onclick" attachTo="input"
for=":_form:menu_input"
- operation="doShow">
- </rich:componentControl>
+ <h:outputText value="#{contextMenuBean.value2}" id="_value2"
/>
</h:form>
</ui:define>
<ui:define name="description">
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/Templates.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/Templates.java 2008-05-13
14:38:18 UTC (rev 8554)
+++
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/Templates.java 2008-05-13
15:15:16 UTC (rev 8555)
@@ -18,7 +18,7 @@
public static Templates DATATABLE = new Templates("dataTable");
- public static Templates MODALPANEL = new Templates("dodalPanel");
+ public static Templates MODALPANEL = new Templates("modalPanel");
private void setParentId(SeleniumTestBase test) {
if ("simple".equals(template)) {
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java 2008-05-13
14:38:18 UTC (rev 8554)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ContextMenuTest.java 2008-05-13
15:15:16 UTC (rev 8555)
@@ -65,19 +65,54 @@
String parentId = getParentId() + "_form:";
String inputId = parentId + "input";
String input2Id = parentId + "input2";
+ String outputId = parentId + "_value2";
String menuId = parentId + "menu_input_menu";
String menu2Id = parentId + "menu_input2_menu";
+ String menu1_item_ajax = parentId + "menu1_item1";
+ String menu1_item_server = parentId + "menu1_item2";
+ String menu2_item_ajax = parentId + "menu2_item1";
+ String menu2_item_server = parentId + "menu2_item2";
+
writeStatus("Click on first input");
clickById(inputId);
Assert.assertTrue(isVisibleById(menuId));
writeStatus("Click on second input");
clickById(input2Id);
+ Assert.assertFalse(isVisibleById(menuId));
Assert.assertTrue(isVisibleById(menu2Id));
- Assert.assertFalse(isVisibleById(menuId));
+ writeStatus("Click on first input again");
+ clickById(inputId);
+ Assert.assertTrue(isVisibleById(menuId));
+ Assert.assertFalse(isVisibleById(menu2Id));
+ writeStatus("Click on ajax item in first menu");
+ clickById(menu1_item_ajax);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "menu1_item1");
+ AssertTextEquals(outputId, "1");
+
+ writeStatus("Click on server item in first menu");
+ clickCommandAndWait(menu1_item_server);
+ AssertValueEquals(inputId, "menu1_item2");
+ AssertTextEquals(outputId, "2");
+
+ writeStatus("Click on second input again");
+ clickById(input2Id);
+ Assert.assertTrue(isVisibleById(menu2Id));
+
+ writeStatus("Click on ajax item in first menu");
+ clickById(menu2_item_ajax);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "menu2_item1");
+ AssertTextEquals(outputId, "3");
+
+ writeStatus("Click on server item in second menu");
+ clickCommandAndWait(menu2_item_server);
+ AssertValueEquals(inputId, "menu2_item2");
+ AssertTextEquals(outputId, "4");
}
public String getTestUrl() {
Show replies by date