Author: dsvyatobatsko
Date: 2008-08-21 12:31:37 -0400 (Thu, 21 Aug 2008)
New Revision: 10165
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/TogglePanelTest.java
Log:
TogglePanelTest refactoring
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml 2008-08-21
14:29:32 UTC (rev 10164)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml 2008-08-21
16:31:37 UTC (rev 10165)
@@ -43,11 +43,10 @@
<h:outputText value="Ajax two" />
</rich:toggleControl>
</h:panelGroup>
-
+
<h:panelGroup layout="block" styleClass="component_div" >
<rich:togglePanel id="panel_server" switchType="server"
initialState="one"
- stateOrder="one,two"
- value="#{panelBean.panelValue}" >
+ stateOrder="one,two">
<f:facet name="one">
<h:outputText id="server_state_one" value="State One" />
</f:facet>
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/TogglePanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/TogglePanelTest.java 2008-08-21
14:29:32 UTC (rev 10164)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/TogglePanelTest.java 2008-08-21
16:31:37 UTC (rev 10165)
@@ -31,8 +31,9 @@
public class TogglePanelTest extends SeleniumTestBase {
@Test
- public void testTogglePanelComponent(Template template) {
+ public void testTogglePanelComponentAjaxMode(Template template) {
renderPage(template);
+
String parentId = getParentId() + "_form:";
String inputId = parentId + "_value";
@@ -45,11 +46,10 @@
String oneFacet = parentId + "ajax_state_one";
String twoFacet = parentId + "ajax_state_two";
- String cleanButton = parentId + "clean";
+ reset();
writeStatus("Click on ajax controlNext");
- clickById(controlNext);
- waitForAjaxCompletion();
+ clickAjaxCommandAndWait(controlNext);
// pause(6000, "panel_ajax");
AssertValueEquals(inputId, "ajax_next");
AssertTextEquals(outputId, "1");
@@ -84,19 +84,30 @@
getTextById(oneFacet);
Assert.fail("Both of 'one' and 'two' states were
rendered for ajax toggle panel.");
} catch (SeleniumException se) {
-
}
+ }
- controlNext = parentId + "server_next";
- controlOne = parentId + "server_one";
- controlTwo = parentId + "server_two";
- oneFacet = parentId + "server_state_one";
- twoFacet = parentId + "server_state_two";
+ @Test
+ public void testTogglePanelComponentServerMode(Template template) {
+ renderPage(template);
+ String parentId = getParentId() + "_form:";
+
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ String controlNext = parentId + "server_next";
+ String controlOne = parentId + "server_one";
+ String controlTwo = parentId + "server_two";
+ String oneFacet = parentId + "server_state_one";
+ String twoFacet = parentId + "server_state_two";
+
+ reset();
+
writeStatus("Click on controlNext");
clickCommandAndWait(controlNext);
AssertValueEquals(inputId, "server_next");
- AssertTextEquals(outputId, "2");
+ AssertTextEquals(outputId, "1");
Assert.assertTrue(isVisibleById(twoFacet));
try {
getTextById(oneFacet);
@@ -108,7 +119,7 @@
writeStatus("Click on server controlOne");
clickCommandAndWait(controlOne);
AssertValueEquals(inputId, "server_one");
- AssertTextEquals(outputId, "3");
+ AssertTextEquals(outputId, "2");
Assert.assertTrue(isVisibleById(oneFacet));
try {
getTextById(twoFacet);
@@ -120,21 +131,27 @@
writeStatus("Click on server controlTwo");
clickCommandAndWait(controlTwo);
AssertValueEquals(inputId, "server_two");
- AssertTextEquals(outputId, "4");
+ AssertTextEquals(outputId, "3");
Assert.assertTrue(isVisibleById(twoFacet));
try {
getTextById(oneFacet);
Assert.fail("Both of 'one' and 'two' states were
rendered for server toggle panel.");
} catch (SeleniumException se) {
-
}
+ }
- controlNext = parentId + "client_next";
- controlOne = parentId + "client_one";
- controlTwo = parentId + "client_two";
- oneFacet = parentId + "client_state_one";
- twoFacet = parentId + "client_state_two";
+ @Test
+ public void testTogglePanelComponentClientMode(Template template) {
+ renderPage(template);
+ String parentId = getParentId() + "_form:";
+
+ String controlNext = parentId + "client_next";
+ String controlOne = parentId + "client_one";
+ String controlTwo = parentId + "client_two";
+ String oneFacet = parentId + "client_state_one";
+ String twoFacet = parentId + "client_state_two";
+
writeStatus("Click on client controlNext");
clickById(controlNext);
Assert.assertTrue(isVisibleById(twoFacet));
@@ -149,10 +166,11 @@
clickById(controlTwo);
Assert.assertTrue(isVisibleById(twoFacet));
Assert.assertFalse(isVisibleById(oneFacet));
+ }
+ private void reset() {
writeStatus("Clean bean values");
- clickById(cleanButton);
- waitForAjaxCompletion();
+ clickAjaxCommandAndWait(getParentId() + "_form:clean");
}
public String getTestUrl() {
Show replies by date