[richfaces-svn-commits] JBoss Rich Faces SVN: r11876 - in trunk/test-applications/regressionArea/regressionArea-web/src: test/java/org/richfaces and 3 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Thu Dec 18 10:39:21 EST 2008


Author: nbelaevski
Date: 2008-12-18 10:39:21 -0500 (Thu, 18 Dec 2008)
New Revision: 11876

Added:
   trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5264.xhtml
   trunk/test-applications/regressionArea/regressionArea-web/src/test/java/org/richfaces/testng/rf5264/
   trunk/test-applications/regressionArea/regressionArea-web/src/test/java/org/richfaces/testng/rf5264/Test.java
Modified:
   trunk/test-applications/regressionArea/regressionArea-web/src/test/java/org/richfaces/SeleniumTestBase.java
   trunk/test-applications/regressionArea/regressionArea-web/src/test/resources/testng.xml
Log:
https://jira.jboss.org/jira/browse/RF-5264

Added: trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5264.xhtml
===================================================================
--- trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5264.xhtml	                        (rev 0)
+++ trunk/test-applications/regressionArea/regressionArea-web/src/main/webapp/pages/rf5264.xhtml	2008-12-18 15:39:21 UTC (rev 11876)
@@ -0,0 +1,22 @@
+<!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:ui="http://java.sun.com/jsf/facelets"
+      xmlns:h="http://java.sun.com/jsf/html"
+      xmlns:f="http://java.sun.com/jsf/core"
+      xmlns:a4j="http://richfaces.org/a4j"
+      xmlns:rich="http://richfaces.org/rich">
+      
+<ui:composition template="/layout/layout.xhtml">
+	<ui:define name="style">
+		
+	</ui:define>
+	<ui:define name="template">
+		<h:form id="form">
+			<rich:progressBar id="progressBar" mode="client" minValue="100" maxValue="500" value="300">
+				<f:facet name="initial">initial</f:facet>
+				<f:facet name="complete">complete</f:facet>
+			</rich:progressBar>
+		</h:form>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file

Modified: trunk/test-applications/regressionArea/regressionArea-web/src/test/java/org/richfaces/SeleniumTestBase.java
===================================================================
--- trunk/test-applications/regressionArea/regressionArea-web/src/test/java/org/richfaces/SeleniumTestBase.java	2008-12-18 15:38:04 UTC (rev 11875)
+++ trunk/test-applications/regressionArea/regressionArea-web/src/test/java/org/richfaces/SeleniumTestBase.java	2008-12-18 15:39:21 UTC (rev 11876)
@@ -3,6 +3,7 @@
 
 
 import org.ajax4jsf.bean.Configurator;
+import org.ajax4jsf.javascript.JSFunction;
 import org.ajax4jsf.javascript.ScriptUtils;
 import org.openqa.selenium.server.RemoteControlConfiguration;
 import org.openqa.selenium.server.SeleniumServer;
@@ -824,4 +825,19 @@
     	return runScript("fireMouseEvent('" + id + "','" + eventName + "', "
 				+ x + "," + y + ","+ctrl+");");
     }
+    
+    /**
+     * Calls component JS API
+     * 
+     * @param id		- Client id of the component to call operation on
+     * @param function	- JS function representing operation that should be called
+     * @return			- Result of execution
+     */
+    public String callComponentOperation(String id, JSFunction function) {
+    	StringBuffer command = new StringBuffer();
+    	new JSFunction("document.getElementById", id).appendScript(command);
+    	command.append(".component.");
+    	function.appendScript(command);
+    	return runScript(command.toString());
+    }
 }

Added: trunk/test-applications/regressionArea/regressionArea-web/src/test/java/org/richfaces/testng/rf5264/Test.java
===================================================================
--- trunk/test-applications/regressionArea/regressionArea-web/src/test/java/org/richfaces/testng/rf5264/Test.java	                        (rev 0)
+++ trunk/test-applications/regressionArea/regressionArea-web/src/test/java/org/richfaces/testng/rf5264/Test.java	2008-12-18 15:39:21 UTC (rev 11876)
@@ -0,0 +1,74 @@
+/**
+ * License Agreement.
+ *
+ * Rich Faces - Natural Ajax for Java Server Faces (JSF)
+ *
+ * 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.testng.rf5264;
+
+import org.ajax4jsf.javascript.JSFunction;
+import org.richfaces.SeleniumTestBase;
+
+/**
+ * @author Nick Belaevski
+ * @since 3.3.0
+ */
+public class Test extends SeleniumTestBase {
+
+	private static final String PROGRESS_BAR_ID = "form:progressBar";
+	private static final String PROGRESS_BAR_TEST_ELEMENT_ID = PROGRESS_BAR_ID + ":upload";
+
+	private static final String PROGRESS_BAR_INITIAL_ELEMENT_ID = PROGRESS_BAR_ID + ":initialState";
+	private static final String PROGRESS_BAR_COMPLETE_ELEMENT_ID = PROGRESS_BAR_ID + ":completeState";
+	
+	@org.testng.annotations.Test
+	public void testBeyondMinimum() throws Exception {
+		renderPage();
+		
+		assertStyleAttribute(PROGRESS_BAR_TEST_ELEMENT_ID, "width: 50%;");
+		AssertNotVisible(PROGRESS_BAR_INITIAL_ELEMENT_ID);
+		AssertNotVisible(PROGRESS_BAR_COMPLETE_ELEMENT_ID);
+
+		callComponentOperation(PROGRESS_BAR_ID, new JSFunction("setValue", 0));
+		AssertVisible(PROGRESS_BAR_INITIAL_ELEMENT_ID);
+		AssertNotVisible(PROGRESS_BAR_COMPLETE_ELEMENT_ID);
+		AssertNotVisible(PROGRESS_BAR_TEST_ELEMENT_ID);
+	}
+	
+	@org.testng.annotations.Test
+	public void testAboveMaximum() throws Exception {
+		renderPage();
+		
+		assertStyleAttribute(PROGRESS_BAR_TEST_ELEMENT_ID, "width: 50%;");
+		AssertNotVisible(PROGRESS_BAR_INITIAL_ELEMENT_ID);
+		AssertNotVisible(PROGRESS_BAR_COMPLETE_ELEMENT_ID);
+
+		callComponentOperation(PROGRESS_BAR_ID, new JSFunction("setValue", 1000));
+		AssertVisible(PROGRESS_BAR_COMPLETE_ELEMENT_ID);
+		AssertNotVisible(PROGRESS_BAR_INITIAL_ELEMENT_ID);
+		AssertNotVisible(PROGRESS_BAR_TEST_ELEMENT_ID);
+	}
+
+	@Override
+	public String getTestUrl() {
+		return "pages/rf5264.xhtml";
+	}
+
+	
+}

Modified: trunk/test-applications/regressionArea/regressionArea-web/src/test/resources/testng.xml
===================================================================
--- trunk/test-applications/regressionArea/regressionArea-web/src/test/resources/testng.xml	2008-12-18 15:38:04 UTC (rev 11875)
+++ trunk/test-applications/regressionArea/regressionArea-web/src/test/resources/testng.xml	2008-12-18 15:39:21 UTC (rev 11876)
@@ -9,6 +9,7 @@
       <package name="org.richfaces.testng" />
       <package name="org.richfaces.testng.rf4507" />
       <package name="org.richfaces.testng.rf4709" />
+      <package name="org.richfaces.testng.rf5264" />
     </packages>
   </test-->
   <test name="FireFoxFunctionalTestsDANe">
@@ -20,6 +21,7 @@
       <package name="org.richfaces.testng" />
       <package name="org.richfaces.testng.rf4507" />
       <package name="org.richfaces.testng.rf4709" />
+      <package name="org.richfaces.testng.rf5264" />
     </packages>
   </test>
 </suite>




More information about the richfaces-svn-commits mailing list