Author: sergeyhalipov
Date: 2008-04-18 11:00:39 -0400 (Fri, 18 Apr 2008)
New Revision: 7936
Added:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/RichPanelTestBean.java
trunk/test-applications/seleniumTest/src/main/webapp/pages/simpleTogglePanel/
trunk/test-applications/seleniumTest/src/main/webapp/pages/simpleTogglePanel/simpleTogglePanel.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/pages/simpleTogglePanel/simpleTogglePanelDescription.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/SimpleTogglePanelTest.java
Removed:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TabPanelTestBean.java
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml
trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
Log:
Selenium tests for simple toggle panel.
Copied:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/RichPanelTestBean.java
(from rev 7921,
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TabPanelTestBean.java)
===================================================================
---
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/RichPanelTestBean.java
(rev 0)
+++
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/RichPanelTestBean.java 2008-04-18
15:00:39 UTC (rev 7936)
@@ -0,0 +1,73 @@
+/**
+ * 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 javax.faces.event.ActionEvent;
+
+public class RichPanelTestBean {
+ private String value;
+ private int value2;
+
+ public RichPanelTestBean() {
+ value = "";
+ value2 = 0;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public void actionListener(ActionEvent event) {
+ this.value = event.getComponent().getId();
+ }
+
+ public String action1() {
+ this.value2 = 1;
+ return null;
+ }
+
+ public String action2() {
+ this.value2 = 2;
+ return null;
+ }
+
+ public String increment() {
+ if (4 == this.value2) {
+ this.value2 = 0;
+ }
+ this.value2++;
+ return null;
+ }
+
+ public int getValue2() {
+ return value2;
+ }
+
+ public void setValue2(int value2) {
+ this.value2 = value2;
+ }
+
+}
Deleted:
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TabPanelTestBean.java
===================================================================
---
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TabPanelTestBean.java 2008-04-18
13:57:50 UTC (rev 7935)
+++
trunk/test-applications/seleniumTest/src/main/java/org/ajax4jsf/TabPanelTestBean.java 2008-04-18
15:00:39 UTC (rev 7936)
@@ -1,44 +0,0 @@
-package org.ajax4jsf;
-
-import javax.faces.event.ActionEvent;
-
-public class TabPanelTestBean {
- private String value;
- private String value2;
-
- public TabPanelTestBean() {
- value = "";
- value2 = "";
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
- }
-
- public void actionListener(ActionEvent event) {
- this.value = event.getComponent().getId();
- }
-
- public String action1() {
- this.value2 = "1";
- return null;
- }
-
- public String action2() {
- this.value2 = "2";
- return null;
- }
-
- public String getValue2() {
- return value2;
- }
-
- public void setValue2(String value2) {
- this.value2 = value2;
- }
-
-}
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-18
13:57:50 UTC (rev 7935)
+++
trunk/test-applications/seleniumTest/src/main/webapp/WEB-INF/faces-config.xml 2008-04-18
15:00:39 UTC (rev 7936)
@@ -32,9 +32,9 @@
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>
<managed-bean>
- <managed-bean-name>tabPanelBean</managed-bean-name>
- <managed-bean-class>org.ajax4jsf.TabPanelTestBean</managed-bean-class>
- <managed-bean-scope>request</managed-bean-scope>
+ <managed-bean-name>panelBean</managed-bean-name>
+ <managed-bean-class>org.ajax4jsf.RichPanelTestBean</managed-bean-class>
+ <managed-bean-scope>session</managed-bean-scope>
</managed-bean>
</faces-config>
\ No newline at end of file
Added:
trunk/test-applications/seleniumTest/src/main/webapp/pages/simpleTogglePanel/simpleTogglePanel.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/simpleTogglePanel/simpleTogglePanel.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/simpleTogglePanel/simpleTogglePanel.xhtml 2008-04-18
15:00:39 UTC (rev 7936)
@@ -0,0 +1,64 @@
+<!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:rich="http://richfaces.org/rich"
+
xmlns:h="http://java.sun.com/jsf/html"
+
xmlns:f="http://java.sun.com/jsf/core"
+
xmlns:ui="http://java.sun.com/jsf/facelets">
+
+<ui:composition template="../../layout/template.xhtml">
+ <ui:define name="style">
+
+ </ui:define>
+ <ui:define name="component">
+ <rich:simpleTogglePanel switchType="ajax" id="panel1"
label="ajax switchType"
+ action="#{panelBean.increment}"
actionListener="#{panelBean.actionListener}"
+ opened="false"
+ reRender="_value,_value2" >
+ <f:facet name="closeMarker">
+ <h:outputText value="Close It" />
+ </f:facet>
+ <f:facet name="openMarker">
+ <h:outputText value="Open It" />
+ </f:facet>
+ <h:panelGroup id="content1" >
+ <h:outputText value="content" />
+ </h:panelGroup>
+ </rich:simpleTogglePanel>
+
+ <rich:simpleTogglePanel switchType="server" id="panel2"
label="server switchType"
+ action="#{panelBean.increment}"
actionListener="#{panelBean.actionListener}"
+ opened="false" >
+ <f:facet name="closeMarker">
+ <h:outputText value="Close It" />
+ </f:facet>
+ <f:facet name="openMarker">
+ <h:outputText value="Open It" />
+ </f:facet>
+ <h:panelGroup id="content2" >
+ <h:outputText value="content" />
+ </h:panelGroup>
+ </rich:simpleTogglePanel>
+
+ <rich:simpleTogglePanel switchType="client" id="panel3"
label="client switchType"
+ opened="false" >
+ <f:facet name="closeMarker">
+ <h:outputText value="Close It" />
+ </f:facet>
+ <f:facet name="openMarker">
+ <h:outputText value="Open It" />
+ </f:facet>
+ <h:panelGroup id="content3" >
+ <h:outputText value="content" />
+ </h:panelGroup>
+ </rich:simpleTogglePanel>
+ <br/>
+ <h:inputText value="#{panelBean.value}"
id="_value"></h:inputText>
+ <h:outputText value="#{panelBean.value2}"
id="_value2"></h:outputText>
+ <br/>
+ </ui:define>
+ <ui:define name="description">
+ <ui:include src="simpleTogglePanelDescription.xhtml" />
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
Added:
trunk/test-applications/seleniumTest/src/main/webapp/pages/simpleTogglePanel/simpleTogglePanelDescription.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/simpleTogglePanel/simpleTogglePanelDescription.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/simpleTogglePanel/simpleTogglePanelDescription.xhtml 2008-04-18
15:00:39 UTC (rev 7936)
@@ -0,0 +1,5 @@
+<html>
+<table border="1" style="border-color: #F1EEE9"
cellpadding="5" cellspacing="0">
+
+</table>
+</html>
\ No newline at end of file
Modified:
trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelTest.xhtml 2008-04-18
13:57:50 UTC (rev 7935)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/tabPanel/tabPanelTest.xhtml 2008-04-18
15:00:39 UTC (rev 7936)
@@ -14,15 +14,15 @@
<rich:tabPanel id="panel1" switchType="ajax" >
<rich:tab label="tab1"
id="tab1"
- action="#{tabPanelBean.action1}"
- actionListener="#{tabPanelBean.actionListener}"
+ action="#{panelBean.action1}"
+ actionListener="#{panelBean.actionListener}"
switchType="server"
</rich:tab>
<rich:tab label="tab2"
id="tab2"
- action="#{tabPanelBean.action2}"
- actionListener="#{tabPanelBean.actionListener}"
+ action="#{panelBean.action2}"
+ actionListener="#{panelBean.actionListener}"
reRender="_value,_value2"
</rich:tab>
@@ -39,8 +39,8 @@
</rich:tabPanel>
<br/>
- <h:inputText value="#{tabPanelBean.value}"
id="_value"></h:inputText>
- <h:outputText value="#{tabPanelBean.value2}"
id="_value2"></h:outputText>
+ <h:inputText value="#{panelBean.value}"
id="_value"></h:inputText>
+ <h:outputText value="#{panelBean.value2}"
id="_value2"></h:outputText>
<br/>
</ui:define>
<ui:define name="description">
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-18
15:00:39 UTC (rev 7936)
@@ -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 testTabPanelComponent() 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));
+ }
+
+}
Modified:
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java
===================================================================
---
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java 2008-04-18
13:57:50 UTC (rev 7935)
+++
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/TabPanelTest.java 2008-04-18
15:00:39 UTC (rev 7936)
@@ -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.richfaces;
import org.ajax4jsf.test.base.RichSeleniumTest;