Author: sergeyhalipov
Date: 2008-04-25 06:16:02 -0400 (Fri, 25 Apr 2008)
New Revision: 8155
Added:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TemplateBean.java
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/AjaxCommandButtonTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
Removed:
trunk/test-applications/seleniumTest/src/main/webapp/template/dataTableTemplate.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/template/modalPanelTemplate.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/template/simpleTemplate.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java
Log:
Selenium tests refactoring.
Added: trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TemplateBean.java
===================================================================
--- trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TemplateBean.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TemplateBean.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,40 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.ajax4jsf;
+
+import java.util.Map;
+
+import javax.faces.context.FacesContext;
+
+public class TemplateBean {
+ public static final String PARAM_NAME = "t";
+
+ public String getTemplate() {
+ Map<String, String> reqMap =
FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ String template = reqMap.get(PARAM_NAME);
+ if (null != template) {
+ return "/template/" + template + ".xhtml";
+ } else {
+ return "/template/simple.xhtml";
+ }
+ }
+}
\ No newline at end of file
Modified: trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-04-25
10:16:02 UTC (rev 8155)
@@ -20,6 +20,11 @@
</managed-property>
</managed-bean>
+ <managed-bean>
+ <managed-bean-name>templateBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.TemplateBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
+ </managed-bean>
<managed-bean>
<managed-bean-name>commandBean</managed-bean-name>
Modified: trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml 2008-04-25
09:17:25 UTC (rev 8154)
+++ trunk/test-applications/seleniumTest/src/main/webapp/layout/layout.xhtml 2008-04-25
10:16:02 UTC (rev 8155)
@@ -47,10 +47,12 @@
</tr>
</table>
</h:form>
-<div id="_Selenium_Test_ControlPoint1" style="display:
none;">Control1</div>
-<h:panelGrid id="_Selenium_Test_Common_Grid">
- <ui:insert name="template"/>
-</h:panelGrid>
+<div id="_Selenium_Test_ControlPoint1" style="display:
none;">Control1</div>
+<h:form id="_Selenium_Test_Form" >
+ <h:panelGrid id="_Selenium_Test_Common_Grid">
+ <ui:insert name="template"/>
+ </h:panelGrid>
+</h:form>
<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/togglePanel/togglePanelTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/togglePanel/togglePanelTest.xhtml 2008-04-25
10:16:02 UTC (rev 8155)
@@ -6,7 +6,7 @@
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets">
-<ui:composition template="../../layout/template.xhtml">
+<ui:composition template="#{templateBean.template}">
<ui:define name="style">
.link {margin: 0px 5px}
@@ -92,10 +92,11 @@
</h:panelGroup>
<br/>
- <a4j:outputPanel ajaxRendered="true" >
+ <!--a4j:outputPanel ajaxRendered="true" id="outputPanel" >
<h:inputText value="#{panelBean.value}"
id="_value"></h:inputText>
<h:outputText value="#{panelBean.value2}"
id="_value2"></h:outputText>
- </a4j:outputPanel>
+ </a4j:outputPanel-->
+ <a4j:log popup="false" />
<br/>
</ui:define>
<ui:define name="description">
Copied: trunk/test-applications/seleniumTest/src/main/webapp/template/dataTable.xhtml
(from rev 8110,
trunk/test-applications/seleniumTest/src/main/webapp/template/dataTableTemplate.xhtml)
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/template/dataTable.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/src/main/webapp/template/dataTable.xhtml 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,20 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+<ui:composition template="../layout/layout.xhtml">
+ <ui:define name="template">
+ <rich:dataTable value="1" id="_Selenium_Test_DataTable">
+ <rich:column>
+ <f:facet name="header">
+ <h:outputText value="Data Table" />
+ </f:facet>
+ <ui:insert name="component" />
+ </rich:column>
+ </rich:dataTable>
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Deleted:
trunk/test-applications/seleniumTest/src/main/webapp/template/dataTableTemplate.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/template/dataTableTemplate.xhtml 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/main/webapp/template/dataTableTemplate.xhtml 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,17 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html
xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:a4j="http://richfaces.org/a4j"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:rich="http://richfaces.org/rich"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:ui="http://java.sun.com/jsf/facelets">
-<ui:composition template="../layout/layout.xhtml">
- <rich:dataTable value="1" id="_Selenium_Test_DataTable">
- <rich:column>
- <f:facet name="header">
- <ui:insert name="body" />
- </f:facet>
- </rich:column>
- </rich:dataTable>
-</ui:composition>
-</html>
\ No newline at end of file
Copied: trunk/test-applications/seleniumTest/src/main/webapp/template/modalPanel.xhtml
(from rev 8110,
trunk/test-applications/seleniumTest/src/main/webapp/template/modalPanelTemplate.xhtml)
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/template/modalPanel.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/src/main/webapp/template/modalPanel.xhtml 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,13 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+<ui:composition template="../layout/layout.xhtml">
+ <rich:modalPanel id="_Selenium_Test_ModelPanel">
+ <ui:insert name="body" />
+ </rich:modalPanel>
+</ui:composition>
+</html>
\ No newline at end of file
Deleted:
trunk/test-applications/seleniumTest/src/main/webapp/template/modalPanelTemplate.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/template/modalPanelTemplate.xhtml 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/main/webapp/template/modalPanelTemplate.xhtml 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,13 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html
xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:a4j="http://richfaces.org/a4j"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:rich="http://richfaces.org/rich"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:ui="http://java.sun.com/jsf/facelets">
-<ui:composition template="../layout/layout.xhtml">
- <rich:modalPanel id="_Selenium_Test_ModelPanel">
- <ui:insert name="body" />
- </rich:modalPanel>
-</ui:composition>
-</html>
\ No newline at end of file
Copied: trunk/test-applications/seleniumTest/src/main/webapp/template/simple.xhtml (from
rev 8110,
trunk/test-applications/seleniumTest/src/main/webapp/template/simpleTemplate.xhtml)
===================================================================
--- trunk/test-applications/seleniumTest/src/main/webapp/template/simple.xhtml
(rev 0)
+++ trunk/test-applications/seleniumTest/src/main/webapp/template/simple.xhtml 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,13 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml"
+
xmlns:a4j="http://richfaces.org/a4j"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:rich="http://richfaces.org/rich"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+<ui:composition template="../layout/layout.xhtml">
+ <ui:define name="template">
+ <ui:insert name="component" />
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Deleted:
trunk/test-applications/seleniumTest/src/main/webapp/template/simpleTemplate.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/template/simpleTemplate.xhtml 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/main/webapp/template/simpleTemplate.xhtml 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,11 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html
xmlns="http://www.w3.org/1999/xhtml"
-
xmlns:a4j="http://richfaces.org/a4j"
-
xmlns:h="http://java.sun.com/jsf/html"
-
xmlns:rich="http://richfaces.org/rich"
-
xmlns:f="http://java.sun.com/jsf/core"
-
xmlns:ui="http://java.sun.com/jsf/facelets">
-<ui:composition template="../layout/layout.xhtml">
- <ui:insert name="body" />
-</ui:composition>
-</html>
\ No newline at end of file
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/test/java/org/ajax4jsf/test/base/SeleniumTestBase.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,3 +1,24 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
package org.ajax4jsf.test.base;
import org.ajax4jsf.javascript.ScriptUtils;
@@ -20,7 +41,7 @@
protected static final int ajaxCompletionTime = 3000;
private static final String WINDOW_JS_RESOLVER =
"selenium.browserbot.getCurrentWindow().";
-
+
/** The default selenium instance */
public DefaultSelenium selenium;
@@ -36,10 +57,14 @@
/** Defines the name of current j2ee application name */
public static final String APPLICATION_NAME = "seleniumTest";
- public static final String COMPONENT_PREFIX_INSIDE_TABLE =
"_Selenium_Test_Form1:_Selenium_Test_DataTable:0:";
+ public static final String COMPONENT_PREFIX_INSIDE_TABLE =
"_Selenium_Test_Form:_Selenium_Test_DataTable:0:";
- public static final String COMPONENT_PREFIX_INSIDE_PANEL =
"_Selenium_Test_Form2:";
-
+ public static final String COMPONENT_PREFIX_SIMPLE =
"_Selenium_Test_Form:";
+
+ public static final String DATA_TABLE_TEMPLATE = "dataTable";
+ public static final String MODAL_PANEL_TEMPLATE = "modalPanel";
+ public static final String SIMPLE_TEMPLATE = "simple";
+
public SeleniumTestBase(String protocol, String host, String port) {
this.host = host;
this.port = port;
@@ -74,10 +99,10 @@
// rendered
checkJSError(); // At the second we check if JS errors occurred
- reRenderForm(); // ReRender component
+ //reRenderForm(); // ReRender component
- checkPageRendering(); // Check all again
- checkJSError();
+ //checkPageRendering(); // Check all again
+ //checkJSError();
}
@@ -98,7 +123,7 @@
* @return
*/
public String getComponentIdInsidePanel(String id) {
- return COMPONENT_PREFIX_INSIDE_PANEL + id;
+ return COMPONENT_PREFIX_SIMPLE + id;
}
/**
@@ -347,5 +372,4 @@
runScript(script.toString());
selenium.waitForCondition(WINDOW_JS_RESOLVER + "pauseHolder['" + id +
"'] == true;", String.valueOf(miliSeconds + 1000));
}
-
}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,92 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-
-public class AjaxCommandButtonTest extends SeleniumTestBase implements RichSeleniumTest
{
-
- public AjaxCommandButtonTest() {
- super("http", "localhost", "8080");
- }
-
- /**
- * This method are invoking before selenium tests started
- */
- @BeforeTest
- @Parameters( { "browser" })
- public void startSelenium(String browser) {
- super.startSelenium(browser);
- }
-
- /**
- * This method are invoking after selenium tests completed
- */
- @AfterTest
- public void stopSelenium() {
- super.stopSelenium();
- }
-
- @Test
- public void testAjaxCommandButtonComponent() throws Exception {
- renderPage("/faces/pages/ajaxCommandButton/ajaxButtonTest.xhtml");
-
- _testAjaxCommandButtonComponent(COMPONENT_PREFIX_INSIDE_TABLE);
- _testAjaxCommandButtonComponent(COMPONENT_PREFIX_INSIDE_PANEL);
- }
-
- private void _testAjaxCommandButtonComponent(String parentId) {
- // test inside DataTable
- String buttonId = parentId + "b1";
- String inputId = parentId + "_value";
-
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "3");
-
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "6");
-
- buttonId = parentId + "b2";
-
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "6");
-
- buttonId = parentId + "b3";
-
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "6");
-
- buttonId = parentId + "b4";
-
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "1");
-
- buttonId = parentId + "b5";
-
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "2");
-
- buttonId = parentId + "b1";
-
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "5");
-
- buttonId = parentId + "b3";
-
- clickById(buttonId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "5");
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandButtonTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,92 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+
+public class AjaxCommandButtonTest extends SeleniumTestBase implements RichSeleniumTest
{
+
+ public AjaxCommandButtonTest() {
+ super("http", "localhost", "8080");
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ super.startSelenium(browser);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testAjaxCommandButtonComponent() throws Exception {
+ renderPage("/faces/pages/ajaxCommandButton/ajaxButtonTest.xhtml");
+
+ _testAjaxCommandButtonComponent(COMPONENT_PREFIX_INSIDE_TABLE);
+ _testAjaxCommandButtonComponent(COMPONENT_PREFIX_SIMPLE);
+ }
+
+ private void _testAjaxCommandButtonComponent(String parentId) {
+ // test inside DataTable
+ String buttonId = parentId + "b1";
+ String inputId = parentId + "_value";
+
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "3");
+
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "6");
+
+ buttonId = parentId + "b2";
+
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "6");
+
+ buttonId = parentId + "b3";
+
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "6");
+
+ buttonId = parentId + "b4";
+
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "1");
+
+ buttonId = parentId + "b5";
+
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "2");
+
+ buttonId = parentId + "b1";
+
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "5");
+
+ buttonId = parentId + "b3";
+
+ clickById(buttonId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "5");
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,91 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class AjaxCommandLinkTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public AjaxCommandLinkTest() {
- super("http", "localhost", "8080");
- }
-
- /**
- * This method are invoking before selenium tests started
- */
- @BeforeTest
- @Parameters( { "browser" })
- public void startSelenium(String browser) {
- super.startSelenium(browser);
- }
-
- /**
- * This method are invoking after selenium tests completed
- */
- @AfterTest
- public void stopSelenium() {
- super.stopSelenium();
- }
-
- @Test
- public void testAjaxCommandLinkComponent() throws Exception {
- renderPage("/faces/pages/ajaxCommandLink/ajaxLinkTest.xhtml");
-
- _testAjaxCommandLinkComponent(COMPONENT_PREFIX_INSIDE_TABLE);
- _testAjaxCommandLinkComponent(COMPONENT_PREFIX_INSIDE_PANEL);
- }
-
- private void _testAjaxCommandLinkComponent(String parentId) {
- // test inside DataTable
- String LinkId = parentId + "l1";
- String inputId = parentId + "_value";
-
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "3");
-
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "6");
-
- LinkId = parentId + "l2";
-
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "6");
-
- LinkId = parentId + "l3";
-
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "6");
-
- LinkId = parentId + "l4";
-
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "1");
-
- LinkId = parentId + "l5";
-
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "2");
-
- LinkId = parentId + "l1";
-
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "5");
-
- LinkId = parentId + "l3";
-
- clickById(LinkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "5");
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/AjaxCommandLinkTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,91 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class AjaxCommandLinkTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public AjaxCommandLinkTest() {
+ super("http", "localhost", "8080");
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ super.startSelenium(browser);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testAjaxCommandLinkComponent() throws Exception {
+ renderPage("/faces/pages/ajaxCommandLink/ajaxLinkTest.xhtml");
+
+ _testAjaxCommandLinkComponent(COMPONENT_PREFIX_INSIDE_TABLE);
+ _testAjaxCommandLinkComponent(COMPONENT_PREFIX_SIMPLE);
+ }
+
+ private void _testAjaxCommandLinkComponent(String parentId) {
+ // test inside DataTable
+ String LinkId = parentId + "l1";
+ String inputId = parentId + "_value";
+
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "3");
+
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "6");
+
+ LinkId = parentId + "l2";
+
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "6");
+
+ LinkId = parentId + "l3";
+
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "6");
+
+ LinkId = parentId + "l4";
+
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "1");
+
+ LinkId = parentId + "l5";
+
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "2");
+
+ LinkId = parentId + "l1";
+
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "5");
+
+ LinkId = parentId + "l3";
+
+ clickById(LinkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "5");
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,98 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.testng.Assert;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class PanelBarTest extends SeleniumTestBase implements RichSeleniumTest {
-
-
- public PanelBarTest() {
- super("http", "localhost", "8080");
- }
-
-
- /**
- * This method are invoking before selenium tests started
- */
- @BeforeTest
- @Parameters( { "browser" })
- public void startSelenium(String browser) {
- super.startSelenium(browser);
- }
-
- /**
- * This method are invoking after selenium tests completed
- */
- @AfterTest
- public void stopSelenium() {
- super.stopSelenium();
- }
-
- @Test
- public void testPanelBarComponent() throws Exception {
- renderPage("/faces/pages/panelBar/panelBarTest.xhtml");
-
- _testPanelBarComponent(COMPONENT_PREFIX_INSIDE_PANEL);
- _testPanelBarComponent(COMPONENT_PREFIX_INSIDE_TABLE);
- }
-
- private void _testPanelBarComponent(String parentId) {
- String label2 = parentId + "label2";
- String label3 = parentId + "label3";
-
- String output1 = parentId + "output1";
- String output2 = parentId + "output2";
- String output3 = parentId + "output3";
-
- String ajaxButton = parentId + "button_ajax";
- String simpleButton = parentId + "button_simple";
-
- clickById(label2);
- Assert.assertFalse(isVisibleById(output1));
- Assert.assertTrue(isVisibleById(output2));
- Assert.assertFalse(isVisibleById(output3));
-
- clickById(simpleButton);
- waitForPageToLoad();
- Assert.assertFalse(isVisibleById(output1));
- Assert.assertTrue(isVisibleById(output2));
- Assert.assertFalse(isVisibleById(output3));
-
- clickById(label3);
- Assert.assertFalse(isVisibleById(output1));
- Assert.assertFalse(isVisibleById(output2));
- Assert.assertTrue(isVisibleById(output3));
-
- clickById(ajaxButton);
- waitForAjaxCompletion();
- Assert.assertFalse(isVisibleById(output1));
- Assert.assertFalse(isVisibleById(output2));
- Assert.assertTrue(isVisibleById(output3));
- }
-}
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,98 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class PanelBarTest extends SeleniumTestBase implements RichSeleniumTest {
+
+
+ public PanelBarTest() {
+ super("http", "localhost", "8080");
+ }
+
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ super.startSelenium(browser);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testPanelBarComponent() throws Exception {
+ renderPage("/faces/pages/panelBar/panelBarTest.xhtml");
+
+ _testPanelBarComponent(COMPONENT_PREFIX_SIMPLE);
+ _testPanelBarComponent(COMPONENT_PREFIX_INSIDE_TABLE);
+ }
+
+ private void _testPanelBarComponent(String parentId) {
+ String label2 = parentId + "label2";
+ String label3 = parentId + "label3";
+
+ String output1 = parentId + "output1";
+ String output2 = parentId + "output2";
+ String output3 = parentId + "output3";
+
+ String ajaxButton = parentId + "button_ajax";
+ String simpleButton = parentId + "button_simple";
+
+ clickById(label2);
+ Assert.assertFalse(isVisibleById(output1));
+ Assert.assertTrue(isVisibleById(output2));
+ Assert.assertFalse(isVisibleById(output3));
+
+ clickById(simpleButton);
+ waitForPageToLoad();
+ Assert.assertFalse(isVisibleById(output1));
+ Assert.assertTrue(isVisibleById(output2));
+ Assert.assertFalse(isVisibleById(output3));
+
+ clickById(label3);
+ Assert.assertFalse(isVisibleById(output1));
+ Assert.assertFalse(isVisibleById(output2));
+ Assert.assertTrue(isVisibleById(output3));
+
+ clickById(ajaxButton);
+ waitForAjaxCompletion();
+ Assert.assertFalse(isVisibleById(output1));
+ Assert.assertFalse(isVisibleById(output2));
+ Assert.assertTrue(isVisibleById(output3));
+ }
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,198 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.testng.Assert;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-import com.thoughtworks.selenium.SeleniumException;
-
-public class PanelMenuTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public PanelMenuTest() {
- super("http", "localhost", "8080");
- }
-
- /**
- * This method are invoking before selenium tests started
- */
- @BeforeTest
- @Parameters( { "browser" })
- public void startSelenium(String browser) {
- super.startSelenium(browser);
- }
-
- /**
- * This method are invoking after selenium tests completed
- */
- @AfterTest
- public void stopSelenium() {
- super.stopSelenium();
- }
-
- @Test
- public void testPanelMenuComponent() throws Exception {
- renderPage("/faces/pages/panelMenu/panelMenuTest.xhtml");
-
- _testPanelMenuComponent(COMPONENT_PREFIX_INSIDE_PANEL);
- _testPanelMenuComponent(COMPONENT_PREFIX_INSIDE_TABLE);
-
- _testPanelMenuComponentSingleMode(COMPONENT_PREFIX_INSIDE_PANEL);
- _testPanelMenuComponentSingleMode(COMPONENT_PREFIX_INSIDE_TABLE);
-
- _testPanelMenuItemAction(COMPONENT_PREFIX_INSIDE_PANEL);
- _testPanelMenuItemAction(COMPONENT_PREFIX_INSIDE_TABLE);
- }
-
- private void _testPanelMenuComponent(String parentId) {
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- String ajaxGroup = "tablehide" + parentId + "pGroup1";
- String serverGroup = "tablehide" + parentId + "pGroup2";
- String clientGroup = "tablehide" + parentId + "pGroup3";
- String disabledGroup = "tablehide" + parentId + "pGroup4";
-
- String ajaxItem = "tablehide" + parentId + "pItem1";
- String serverItem = "tablehide" + parentId + "pItem2";
- String clientItem = "tablehide" + parentId + "pItem3";
- String disabledItem = "tablehide" + parentId + "pItem4";
-
- clickById(ajaxGroup);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1");
- AssertTextEquals(outputId, "1");
- Assert.assertTrue(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- clickById(serverGroup);
- waitForPageToLoad();
- AssertValueEquals(inputId, "pGroup2");
- AssertTextEquals(outputId, "2");
- Assert.assertTrue(isVisibleById(ajaxItem));
- Assert.assertTrue(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- clickById(ajaxGroup);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1");
- AssertTextEquals(outputId, "3");
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertTrue(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- clickById(serverGroup);
- waitForPageToLoad();
- AssertValueEquals(inputId, "pGroup2");
- AssertTextEquals(outputId, "4");
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- clickById(clientGroup);
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertTrue(isVisibleById(clientItem));
-
- clickById(clientGroup);
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- clickById(disabledGroup);
- Assert.assertFalse(isVisibleById(disabledItem));
- }
-
- private void _testPanelMenuComponentSingleMode(String parentId) {
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- String ajaxGroup = "tablehide" + parentId +
"pGroup1_single";
- String serverGroup = "tablehide" + parentId +
"pGroup2_single";
- String clientGroup = "tablehide" + parentId +
"pGroup3_single";
- String disabledGroup = "tablehide" + parentId +
"pGroup4_single";
-
- String ajaxItem = "tablehide" + parentId + "pItem1_single";
- String serverItem = "tablehide" + parentId +
"pItem2_single";
- String clientItem = "tablehide" + parentId +
"pItem3_single";
- String disabledItem = "tablehide" + parentId +
"pItem4_single";
-
- clickById(ajaxGroup);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1_single");
- AssertTextEquals(outputId, "1");
- Assert.assertTrue(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- clickById(serverGroup);
- waitForPageToLoad();
- AssertValueEquals(inputId, "pGroup2_single");
- AssertTextEquals(outputId, "2");
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertTrue(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- clickById(ajaxGroup);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1_single");
- AssertTextEquals(outputId, "3");
- Assert.assertTrue(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- clickById(serverGroup);
- waitForPageToLoad();
- AssertValueEquals(inputId, "pGroup2_single");
- AssertTextEquals(outputId, "4");
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertTrue(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- clickById(clientGroup);
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertTrue(isVisibleById(clientItem));
-
- clickById(clientGroup);
- Assert.assertFalse(isVisibleById(ajaxItem));
- Assert.assertFalse(isVisibleById(serverItem));
- Assert.assertFalse(isVisibleById(clientItem));
-
- clickById(disabledGroup);
- Assert.assertFalse(isVisibleById(disabledItem));
- }
-
- private void _testPanelMenuItemAction(String parentId) {
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- String group = "tablehide" + parentId + "pGroup1";
- String groupSingle = "tablehide" + parentId + "pGroup1_single";
-
- String item = "tablehide" + parentId + "pItem1";
- String itemSingle = "tablehide" + parentId +
"pItem1_single";
-
- clickById(group);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1");
-
- clickById(groupSingle);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "pGroup1_single");
-
- clickById(item);
- waitForPageToLoad();
- AssertValueEquals(inputId, "pItem1");
- AssertTextEquals(outputId, "1");
-
- clickById(itemSingle);
- waitForPageToLoad();
- AssertValueEquals(inputId, "pItem1_single");
- AssertTextEquals(outputId, "2");
- }
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelMenuTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,198 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.SeleniumException;
+
+public class PanelMenuTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public PanelMenuTest() {
+ super("http", "localhost", "8080");
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ super.startSelenium(browser);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testPanelMenuComponent() throws Exception {
+ renderPage("/faces/pages/panelMenu/panelMenuTest.xhtml");
+
+ _testPanelMenuComponent(COMPONENT_PREFIX_SIMPLE);
+ _testPanelMenuComponent(COMPONENT_PREFIX_INSIDE_TABLE);
+
+ _testPanelMenuComponentSingleMode(COMPONENT_PREFIX_SIMPLE);
+ _testPanelMenuComponentSingleMode(COMPONENT_PREFIX_INSIDE_TABLE);
+
+ _testPanelMenuItemAction(COMPONENT_PREFIX_SIMPLE);
+ _testPanelMenuItemAction(COMPONENT_PREFIX_INSIDE_TABLE);
+ }
+
+ private void _testPanelMenuComponent(String parentId) {
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ String ajaxGroup = "tablehide" + parentId + "pGroup1";
+ String serverGroup = "tablehide" + parentId + "pGroup2";
+ String clientGroup = "tablehide" + parentId + "pGroup3";
+ String disabledGroup = "tablehide" + parentId + "pGroup4";
+
+ String ajaxItem = "tablehide" + parentId + "pItem1";
+ String serverItem = "tablehide" + parentId + "pItem2";
+ String clientItem = "tablehide" + parentId + "pItem3";
+ String disabledItem = "tablehide" + parentId + "pItem4";
+
+ clickById(ajaxGroup);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1");
+ AssertTextEquals(outputId, "1");
+ Assert.assertTrue(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ clickById(serverGroup);
+ waitForPageToLoad();
+ AssertValueEquals(inputId, "pGroup2");
+ AssertTextEquals(outputId, "2");
+ Assert.assertTrue(isVisibleById(ajaxItem));
+ Assert.assertTrue(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ clickById(ajaxGroup);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1");
+ AssertTextEquals(outputId, "3");
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertTrue(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ clickById(serverGroup);
+ waitForPageToLoad();
+ AssertValueEquals(inputId, "pGroup2");
+ AssertTextEquals(outputId, "4");
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ clickById(clientGroup);
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertTrue(isVisibleById(clientItem));
+
+ clickById(clientGroup);
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ clickById(disabledGroup);
+ Assert.assertFalse(isVisibleById(disabledItem));
+ }
+
+ private void _testPanelMenuComponentSingleMode(String parentId) {
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ String ajaxGroup = "tablehide" + parentId +
"pGroup1_single";
+ String serverGroup = "tablehide" + parentId +
"pGroup2_single";
+ String clientGroup = "tablehide" + parentId +
"pGroup3_single";
+ String disabledGroup = "tablehide" + parentId +
"pGroup4_single";
+
+ String ajaxItem = "tablehide" + parentId + "pItem1_single";
+ String serverItem = "tablehide" + parentId +
"pItem2_single";
+ String clientItem = "tablehide" + parentId +
"pItem3_single";
+ String disabledItem = "tablehide" + parentId +
"pItem4_single";
+
+ clickById(ajaxGroup);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1_single");
+ AssertTextEquals(outputId, "1");
+ Assert.assertTrue(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ clickById(serverGroup);
+ waitForPageToLoad();
+ AssertValueEquals(inputId, "pGroup2_single");
+ AssertTextEquals(outputId, "2");
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertTrue(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ clickById(ajaxGroup);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1_single");
+ AssertTextEquals(outputId, "3");
+ Assert.assertTrue(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ clickById(serverGroup);
+ waitForPageToLoad();
+ AssertValueEquals(inputId, "pGroup2_single");
+ AssertTextEquals(outputId, "4");
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertTrue(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ clickById(clientGroup);
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertTrue(isVisibleById(clientItem));
+
+ clickById(clientGroup);
+ Assert.assertFalse(isVisibleById(ajaxItem));
+ Assert.assertFalse(isVisibleById(serverItem));
+ Assert.assertFalse(isVisibleById(clientItem));
+
+ clickById(disabledGroup);
+ Assert.assertFalse(isVisibleById(disabledItem));
+ }
+
+ private void _testPanelMenuItemAction(String parentId) {
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ String group = "tablehide" + parentId + "pGroup1";
+ String groupSingle = "tablehide" + parentId + "pGroup1_single";
+
+ String item = "tablehide" + parentId + "pItem1";
+ String itemSingle = "tablehide" + parentId +
"pItem1_single";
+
+ clickById(group);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1");
+
+ clickById(groupSingle);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "pGroup1_single");
+
+ clickById(item);
+ waitForPageToLoad();
+ AssertValueEquals(inputId, "pItem1");
+ AssertTextEquals(outputId, "1");
+
+ clickById(itemSingle);
+ waitForPageToLoad();
+ AssertValueEquals(inputId, "pItem1_single");
+ AssertTextEquals(outputId, "2");
+ }
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,110 +0,0 @@
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.testng.Assert;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class ProgressBarTest extends SeleniumTestBase implements
- RichSeleniumTest {
-
- public ProgressBarTest() {
- super("http", "localhost", "8080");
- }
-
- /**
- * This method are invoking before selenium tests started
- */
- @BeforeTest
- @Parameters( { "browser" })
- public void startSelenium(String browser) {
- super.startSelenium(browser);
- }
-
- /**
- * This method are invoking after selenium tests completed
- */
- @AfterTest
- public void stopSelenium() {
- super.stopSelenium();
- }
-
- @Test
- public void testProgressBarComponent() {
- renderPage("/faces/pages/progressBar/progressBarTest.xhtml");
-
- _testProgressBarComponent(COMPONENT_PREFIX_INSIDE_TABLE);
- _testProgressBarComponent(COMPONENT_PREFIX_INSIDE_PANEL);
- }
-
- private void _testProgressBarComponent(String parentId) {
-
- //- Test ajax mode
-
- String progressBarId = parentId + "progressBar1";
- int value = getProgressBarValue(progressBarId);
- Assert.assertTrue(value < 0);
- String text = getTextById(progressBarId);
- Assert.assertTrue(text.startsWith("Process not started"));
-
- enableProgressBar(progressBarId, true);
-
- pause(5000, progressBarId);
-
- enableProgressBar(progressBarId, false);
-
- text = getTextById(progressBarId + ":remain");
- Assert.assertTrue(text.endsWith("%"));
-
- value = getProgressBarValue(progressBarId);
- Assert.assertTrue(value > 0);
-
- enableProgressBar(progressBarId, true);
-
- pause(5000, progressBarId);
- Assert.assertTrue((getProgressBarValue(progressBarId).intValue() != value));
-
- enableProgressBar(progressBarId, false);
-
- value = getProgressBarValue(progressBarId);
- delay(1500);
- Assert.assertTrue(getProgressBarValue(progressBarId) == value);
-
-
- // - Test client mode
-
- progressBarId = parentId + "progressBar2";
- value = getProgressBarValue(progressBarId);
- Assert.assertTrue(value == -5);
-
- text = getTextById(progressBarId);
- Assert.assertTrue(text.startsWith("Process not started"));
-
- setProgressBarValue(progressBarId, 20);
- value = getProgressBarValue(progressBarId);
- Assert.assertTrue(value == 20);
-
- setProgressBarValue(progressBarId, 60);
- value = getProgressBarValue(progressBarId);
- Assert.assertTrue(value == 60);
-
- }
-
- private void enableProgressBar(String id, boolean enable) {
- invokeFromComponent(id, (enable ? "enable" : "disable"), null);
- }
-
- private void setProgressBarValue(String id, Object value) {
- invokeFromComponent(id, "setValue", value);
- }
-
- private Integer getProgressBarValue(String id) {
- String value = invokeFromComponent(id, "getValue", null);
//runScript(script.toString());
- Integer v = Integer.parseInt(value);
- return v;
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/ProgressBarTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,110 @@
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class ProgressBarTest extends SeleniumTestBase implements
+ RichSeleniumTest {
+
+ public ProgressBarTest() {
+ super("http", "localhost", "8080");
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ super.startSelenium(browser);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testProgressBarComponent() {
+ renderPage("/faces/pages/progressBar/progressBarTest.xhtml");
+
+ _testProgressBarComponent(COMPONENT_PREFIX_INSIDE_TABLE);
+ _testProgressBarComponent(COMPONENT_PREFIX_SIMPLE);
+ }
+
+ private void _testProgressBarComponent(String parentId) {
+
+ //- Test ajax mode
+
+ String progressBarId = parentId + "progressBar1";
+ int value = getProgressBarValue(progressBarId);
+ Assert.assertTrue(value < 0);
+ String text = getTextById(progressBarId);
+ Assert.assertTrue(text.startsWith("Process not started"));
+
+ enableProgressBar(progressBarId, true);
+
+ pause(5000, progressBarId);
+
+ enableProgressBar(progressBarId, false);
+
+ text = getTextById(progressBarId + ":remain");
+ Assert.assertTrue(text.endsWith("%"));
+
+ value = getProgressBarValue(progressBarId);
+ Assert.assertTrue(value > 0);
+
+ enableProgressBar(progressBarId, true);
+
+ pause(5000, progressBarId);
+ Assert.assertTrue((getProgressBarValue(progressBarId).intValue() != value));
+
+ enableProgressBar(progressBarId, false);
+
+ value = getProgressBarValue(progressBarId);
+ delay(1500);
+ Assert.assertTrue(getProgressBarValue(progressBarId) == value);
+
+
+ // - Test client mode
+
+ progressBarId = parentId + "progressBar2";
+ value = getProgressBarValue(progressBarId);
+ Assert.assertTrue(value == -5);
+
+ text = getTextById(progressBarId);
+ Assert.assertTrue(text.startsWith("Process not started"));
+
+ setProgressBarValue(progressBarId, 20);
+ value = getProgressBarValue(progressBarId);
+ Assert.assertTrue(value == 20);
+
+ setProgressBarValue(progressBarId, 60);
+ value = getProgressBarValue(progressBarId);
+ Assert.assertTrue(value == 60);
+
+ }
+
+ private void enableProgressBar(String id, boolean enable) {
+ invokeFromComponent(id, (enable ? "enable" : "disable"), null);
+ }
+
+ private void setProgressBarValue(String id, Object value) {
+ invokeFromComponent(id, "setValue", value);
+ }
+
+ private Integer getProgressBarValue(String id) {
+ String value = invokeFromComponent(id, "getValue", null);
//runScript(script.toString());
+ Integer v = Integer.parseInt(value);
+ return v;
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,61 +0,0 @@
-/**
- *
- */
-package org.richfaces;
-
-/**
- * @author asmirnov
- *
- */
-import static org.testng.Assert.assertEquals;
-
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-import com.thoughtworks.selenium.DefaultSelenium;
-
-public class SeleniumExampleTest
-
-{
- private DefaultSelenium selenium;
-
- protected DefaultSelenium createSeleniumClient(String url, String browser){
- return new DefaultSelenium("localhost", 4444,
- browser, url);
- }
- @BeforeTest
- @Parameters({ "browser" })
- public void startSelenium(String browser){
- selenium = createSeleniumClient("http://localhost:8080/", browser);
- selenium.start();
- }
-
- @Test(enabled=true)
- public void testSomethingSimple() throws Exception {
- selenium.open("http://localhost:8080/seleniumTest/faces/test.xhtml");
- selenium.waitForPageToLoad("5000");
-
- //
- System.out.println("body [" + selenium.getHtmlSource() + "]");
- //
- // selenium.getEval("window.done=false;A4J.AJAX.AddListener(new
- // A4J.AJAX.Listener(function(){window.done=true}))");
- selenium.click("id=fff:lnk");
- selenium.waitForCondition(
- "selenium.browserbot.getCurrentWindow().done==true", "3000");
- System.out.println("ajax body [" + selenium.getHtmlSource() + "]");
- assertEquals("testOk", selenium.getText("id=fff:out"));
-
- // Test help link
- }
- /**
- *
- */
- @AfterTest
- public void stopSelenium() {
- selenium.stop();
- selenium = null;
- }
-}
\ No newline at end of file
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SeleniumExampleTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,61 @@
+/**
+ *
+ */
+package org.richfaces;
+
+/**
+ * @author asmirnov
+ *
+ */
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.DefaultSelenium;
+
+public class SeleniumExampleTest
+
+{
+ private DefaultSelenium selenium;
+
+ protected DefaultSelenium createSeleniumClient(String url, String browser){
+ return new DefaultSelenium("localhost", 4444,
+ browser, url);
+ }
+ @BeforeTest
+ @Parameters({ "browser" })
+ public void startSelenium(String browser){
+ selenium = createSeleniumClient("http://localhost:8080/", browser);
+ selenium.start();
+ }
+
+ @Test(enabled=true)
+ public void testSomethingSimple() throws Exception {
+ selenium.open("http://localhost:8080/seleniumTest/faces/test.xhtml");
+ selenium.waitForPageToLoad("5000");
+
+ //
+ System.out.println("body [" + selenium.getHtmlSource() + "]");
+ //
+ // selenium.getEval("window.done=false;A4J.AJAX.AddListener(new
+ // A4J.AJAX.Listener(function(){window.done=true}))");
+ selenium.click("id=fff:lnk");
+ selenium.waitForCondition(
+ "selenium.browserbot.getCurrentWindow().done==true", "3000");
+ System.out.println("ajax body [" + selenium.getHtmlSource() + "]");
+ assertEquals("testOk", selenium.getText("id=fff:out"));
+
+ // Test help link
+ }
+ /**
+ *
+ */
+ @AfterTest
+ public void stopSelenium() {
+ selenium.stop();
+ selenium = null;
+ }
+}
\ No newline at end of file
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,105 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.testng.Assert;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-public class SimpleTogglePanelTest extends SeleniumTestBase implements RichSeleniumTest
{
-
- public SimpleTogglePanelTest() {
- super("http", "localhost", "8080");
- }
-
- /**
- * This method are invoking before selenium tests started
- */
- @BeforeTest
- @Parameters( { "browser" })
- public void startSelenium(String browser) {
- super.startSelenium(browser);
- }
-
- /**
- * This method are invoking after selenium tests completed
- */
- @AfterTest
- public void stopSelenium() {
- super.stopSelenium();
- }
-
- @Test
- public void testSimpleTogglePanelComponent() throws Exception {
- renderPage("/faces/pages/simpleTogglePanel/simpleTogglePanel.xhtml");
-
- _testSimpleTogglePanelComponent(COMPONENT_PREFIX_INSIDE_PANEL);
- _testSimpleTogglePanelComponent(COMPONENT_PREFIX_INSIDE_TABLE);
- }
-
- private void _testSimpleTogglePanelComponent(String parentId) {
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- String ajaxHeader = parentId + "panel1_header";
- String serverHeader = parentId + "panel2_header";
- String clientHeader = parentId + "panel3_header";
-
- String ajaxBody = parentId + "panel1_body";
- String serverBody = parentId + "panel2_body";
- String clientBody = parentId + "panel3_body";
-
- clickById(clientHeader);
- Assert.assertTrue(isVisibleById(clientBody));
- clickById(clientHeader);
- Assert.assertFalse(isVisibleById(clientBody));
-
- clickById(ajaxHeader);
- waitForAjaxCompletion(5000);
- AssertValueEquals(inputId, "panel1");
- AssertTextEquals(outputId, "1");
- Assert.assertTrue(isVisibleById(ajaxBody));
-
- clickById(ajaxHeader);
- waitForAjaxCompletion(5000);
- AssertValueEquals(inputId, "panel1");
- AssertTextEquals(outputId, "2");
- Assert.assertFalse(isVisibleById(ajaxBody));
-
- clickById(serverHeader);
- waitForPageToLoad();
- AssertValueEquals(inputId, "panel2");
- AssertTextEquals(outputId, "3");
- Assert.assertTrue(isVisibleById(serverBody));
-
- clickById(serverHeader);
- waitForPageToLoad();
- AssertValueEquals(inputId, "panel2");
- AssertTextEquals(outputId, "4");
- Assert.assertFalse(isVisibleById(serverBody));
- }
-
-}
Added:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,105 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+public class SimpleTogglePanelTest extends SeleniumTestBase implements RichSeleniumTest
{
+
+ public SimpleTogglePanelTest() {
+ super("http", "localhost", "8080");
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ super.startSelenium(browser);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testSimpleTogglePanelComponent() throws Exception {
+ renderPage("/faces/pages/simpleTogglePanel/simpleTogglePanel.xhtml");
+
+ _testSimpleTogglePanelComponent(COMPONENT_PREFIX_SIMPLE);
+ _testSimpleTogglePanelComponent(COMPONENT_PREFIX_INSIDE_TABLE);
+ }
+
+ private void _testSimpleTogglePanelComponent(String parentId) {
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ String ajaxHeader = parentId + "panel1_header";
+ String serverHeader = parentId + "panel2_header";
+ String clientHeader = parentId + "panel3_header";
+
+ String ajaxBody = parentId + "panel1_body";
+ String serverBody = parentId + "panel2_body";
+ String clientBody = parentId + "panel3_body";
+
+ clickById(clientHeader);
+ Assert.assertTrue(isVisibleById(clientBody));
+ clickById(clientHeader);
+ Assert.assertFalse(isVisibleById(clientBody));
+
+ clickById(ajaxHeader);
+ waitForAjaxCompletion(5000);
+ AssertValueEquals(inputId, "panel1");
+ AssertTextEquals(outputId, "1");
+ Assert.assertTrue(isVisibleById(ajaxBody));
+
+ clickById(ajaxHeader);
+ waitForAjaxCompletion(5000);
+ AssertValueEquals(inputId, "panel1");
+ AssertTextEquals(outputId, "2");
+ Assert.assertFalse(isVisibleById(ajaxBody));
+
+ clickById(serverHeader);
+ waitForPageToLoad();
+ AssertValueEquals(inputId, "panel2");
+ AssertTextEquals(outputId, "3");
+ Assert.assertTrue(isVisibleById(serverBody));
+
+ clickById(serverHeader);
+ waitForPageToLoad();
+ AssertValueEquals(inputId, "panel2");
+ AssertTextEquals(outputId, "4");
+ Assert.assertFalse(isVisibleById(serverBody));
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -1,123 +0,0 @@
-/**
- * License Agreement.
- *
- * JBoss RichFaces - Ajax4jsf Component Library
- *
- * Copyright (C) 2007 Exadel, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-package org.richfaces;
-
-import org.ajax4jsf.test.base.RichSeleniumTest;
-import org.ajax4jsf.test.base.SeleniumTestBase;
-import org.testng.Assert;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Parameters;
-import org.testng.annotations.Test;
-
-import com.thoughtworks.selenium.SeleniumException;
-
-public class TabPanelTest extends SeleniumTestBase implements RichSeleniumTest {
-
- public TabPanelTest() {
- super("http", "localhost", "8080");
- }
-
- public TabPanelTest(String protocol, String host, String port) {
- super(protocol, host, port);
- // TODO Auto-generated constructor stub
- }
-
- /**
- * This method are invoking before selenium tests started
- */
- @BeforeTest
- @Parameters( { "browser" })
- public void startSelenium(String browser) {
- super.startSelenium(browser);
- }
-
- /**
- * This method are invoking after selenium tests completed
- */
- @AfterTest
- public void stopSelenium() {
- super.stopSelenium();
- }
-
- @Test
- public void testTabPanelComponent() throws Exception {
- renderPage("/faces/pages/tabPanel/tabPanelTest.xhtml");
-
- _testRichTabPanelComponent(COMPONENT_PREFIX_INSIDE_PANEL);
- _testRichTabPanelComponent(COMPONENT_PREFIX_INSIDE_TABLE);
- }
-
- private void _testRichTabPanelComponent(String parentId) {
- String linkId = parentId + "tab2_lbl";
- String tabId1 = parentId + "tab1";
- String tabId2 = parentId + "tab2";
- String tabId4 = parentId + "tab4";
- String inputId = parentId + "_value";
- String outputId = parentId + "_value2";
-
- clickById(linkId);
- waitForAjaxCompletion();
- AssertValueEquals(inputId, "tab2");
- AssertTextEquals(outputId, "2");
- Assert.assertTrue(isVisibleById(tabId2));
- Assert.assertFalse(isVisibleById(tabId4));
- try {
- getTextById(tabId1);
- Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
- } catch (SeleniumException se) {
-
- }
-
-
- linkId = parentId + "tab1_lbl";
- clickById(linkId);
- waitForPageToLoad();
- AssertValueEquals(inputId, "tab1");
- AssertTextEquals(outputId, "1");
- Assert.assertTrue(isVisibleById(tabId1));
- Assert.assertFalse(isVisibleById(tabId4));
- try {
- getTextById(tabId2);
- Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
- } catch (SeleniumException se) {
-
- }
-
- linkId = parentId + "tab3_lbl";
- clickById(linkId);
- AssertValueEquals(inputId, "tab1");
- Assert.assertTrue(isVisibleById(tabId1));
-
- linkId = parentId + "tab4_lbl";
- clickById(linkId);
- Assert.assertTrue(isVisibleById(tabId4));
- Assert.assertFalse(isVisibleById(tabId1));
- try {
- getTextById(tabId2);
- Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
- } catch (SeleniumException se) {
-
- }
- }
-
-}
Added: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -0,0 +1,123 @@
+/**
+ * License Agreement.
+ *
+ * JBoss RichFaces - Ajax4jsf Component Library
+ *
+ * Copyright (C) 2007 Exadel, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+package org.richfaces;
+
+import org.ajax4jsf.test.base.RichSeleniumTest;
+import org.ajax4jsf.test.base.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Parameters;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.SeleniumException;
+
+public class TabPanelTest extends SeleniumTestBase implements RichSeleniumTest {
+
+ public TabPanelTest() {
+ super("http", "localhost", "8080");
+ }
+
+ public TabPanelTest(String protocol, String host, String port) {
+ super(protocol, host, port);
+ // TODO Auto-generated constructor stub
+ }
+
+ /**
+ * This method are invoking before selenium tests started
+ */
+ @BeforeTest
+ @Parameters( { "browser" })
+ public void startSelenium(String browser) {
+ super.startSelenium(browser);
+ }
+
+ /**
+ * This method are invoking after selenium tests completed
+ */
+ @AfterTest
+ public void stopSelenium() {
+ super.stopSelenium();
+ }
+
+ @Test
+ public void testTabPanelComponent() throws Exception {
+ renderPage("/faces/pages/tabPanel/tabPanelTest.xhtml");
+
+ _testRichTabPanelComponent(COMPONENT_PREFIX_SIMPLE);
+ _testRichTabPanelComponent(COMPONENT_PREFIX_INSIDE_TABLE);
+ }
+
+ private void _testRichTabPanelComponent(String parentId) {
+ String linkId = parentId + "tab2_lbl";
+ String tabId1 = parentId + "tab1";
+ String tabId2 = parentId + "tab2";
+ String tabId4 = parentId + "tab4";
+ String inputId = parentId + "_value";
+ String outputId = parentId + "_value2";
+
+ clickById(linkId);
+ waitForAjaxCompletion();
+ AssertValueEquals(inputId, "tab2");
+ AssertTextEquals(outputId, "2");
+ Assert.assertTrue(isVisibleById(tabId2));
+ Assert.assertFalse(isVisibleById(tabId4));
+ try {
+ getTextById(tabId1);
+ Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
+ } catch (SeleniumException se) {
+
+ }
+
+
+ linkId = parentId + "tab1_lbl";
+ clickById(linkId);
+ waitForPageToLoad();
+ AssertValueEquals(inputId, "tab1");
+ AssertTextEquals(outputId, "1");
+ Assert.assertTrue(isVisibleById(tabId1));
+ Assert.assertFalse(isVisibleById(tabId4));
+ try {
+ getTextById(tabId2);
+ Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
+ } catch (SeleniumException se) {
+
+ }
+
+ linkId = parentId + "tab3_lbl";
+ clickById(linkId);
+ AssertValueEquals(inputId, "tab1");
+ Assert.assertTrue(isVisibleById(tabId1));
+
+ linkId = parentId + "tab4_lbl";
+ clickById(linkId);
+ Assert.assertTrue(isVisibleById(tabId4));
+ Assert.assertFalse(isVisibleById(tabId1));
+ try {
+ getTextById(tabId2);
+ Assert.fail("Both of 'tab1' and 'tab2' tabs were rendered
for tab panel.");
+ } catch (SeleniumException se) {
+
+ }
+ }
+
+}
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java 2008-04-25
09:17:25 UTC (rev 8154)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TogglePanelTest.java 2008-04-25
10:16:02 UTC (rev 8155)
@@ -21,6 +21,7 @@
package org.richfaces;
+import org.ajax4jsf.TemplateBean;
import org.ajax4jsf.test.base.RichSeleniumTest;
import org.ajax4jsf.test.base.SeleniumTestBase;
import org.testng.Assert;
@@ -32,6 +33,7 @@
import com.thoughtworks.selenium.SeleniumException;
public class TogglePanelTest extends SeleniumTestBase implements RichSeleniumTest {
+ private static final String PAGE =
"/faces/pages/togglePanel/togglePanelTest.xhtml";
public TogglePanelTest() {
super("http", "localhost", "8080");
@@ -56,13 +58,13 @@
@Test
public void testTogglePanelComponent() throws Exception {
- renderPage("/faces/pages/togglePanel/togglePanelTest.xhtml");
-
- _testTogglePanelComponent(COMPONENT_PREFIX_INSIDE_PANEL);
- _testTogglePanelComponent(COMPONENT_PREFIX_INSIDE_TABLE);
+ _testTogglePanelComponent(DATA_TABLE_TEMPLATE, COMPONENT_PREFIX_INSIDE_TABLE);
+ _testTogglePanelComponent(SIMPLE_TEMPLATE, COMPONENT_PREFIX_SIMPLE);
}
- private void _testTogglePanelComponent(String parentId) {
+ private void _testTogglePanelComponent(String template, String parentId) {
+ renderPage(PAGE + "?" + TemplateBean.PARAM_NAME + "=" +
template);
+
String inputId = parentId + "_value";
String outputId = parentId + "_value2";
@@ -75,6 +77,7 @@
clickById(controlNext);
waitForAjaxCompletion(5000);
+ pause(60000, "");
AssertValueEquals(inputId, "ajax_next");
AssertTextEquals(outputId, "1");
Assert.assertTrue(isVisibleById(twoFacet));