Author: sergeyhalipov
Date: 2008-04-22 11:52:48 -0400 (Tue, 22 Apr 2008)
New Revision: 8074
Added:
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelBar/
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelBar/panelBarDescription.xhtml
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelBar/panelBarTest.xhtml
trunk/test-applications/seleniumTest/src/test/java/org/richfaces/PanelBarTest.java
Log:
Selenium tests for panel bar.
Added:
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelBar/panelBarDescription.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelBar/panelBarDescription.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelBar/panelBarDescription.xhtml 2008-04-22
15:52:48 UTC (rev 8074)
@@ -0,0 +1,5 @@
+<html>
+<table border="1" style="border-color: #F1EEE9"
cellpadding="5" cellspacing="0">
+
+</table>
+</html>
\ No newline at end of file
Added:
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelBar/panelBarTest.xhtml
===================================================================
---
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelBar/panelBarTest.xhtml
(rev 0)
+++
trunk/test-applications/seleniumTest/src/main/webapp/pages/panelBar/panelBarTest.xhtml 2008-04-22
15:52:48 UTC (rev 8074)
@@ -0,0 +1,44 @@
+<!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">
+ .link {margin: 0px 5px}
+ </ui:define>
+ <ui:define name="component">
+ <rich:panelBar id="panelBar" width="300" height="300"
>
+ <rich:panelBarItem id="item1" >
+ <f:facet name="label">
+ <h:outputText value="1" id="label1" />
+ </f:facet>
+ <h:outputText id="output1" value="Item 1" />
+ </rich:panelBarItem>
+ <rich:panelBarItem id="item2">
+ <f:facet name="label">
+ <h:outputText value="2" id="label2" />
+ </f:facet>
+ <h:outputText id="output2" value="Item 2" />
+ </rich:panelBarItem>
+ <rich:panelBarItem id="item3" >
+ <f:facet name="label">
+ <h:outputText value="3" id="label3" />
+ </f:facet>
+ <h:outputText id="output3" value="Item 3" />
+ </rich:panelBarItem>
+ </rich:panelBar>
+
+ <br/>
+ <h:commandButton id="button_simple" value="Submit" />
+ <a4j:commandButton id="button_ajax" value="Submit"
reRender="panelBar" />
+ <br/>
+ </ui:define>
+ <ui:define name="description">
+ <ui:include src="panelBarDescription.xhtml" />
+ </ui:define>
+</ui:composition>
+</html>
\ No newline at end of file
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-22
15:52:48 UTC (rev 8074)
@@ -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_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));
+ }
+}