[richfaces-svn-commits] JBoss Rich Faces SVN: r11489 - in trunk/test-applications/seleniumTest/richfaces/src: test/java/org/richfaces/testng and 1 other directory.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue Dec 2 10:41:49 EST 2008


Author: konstantin.mishin
Date: 2008-12-02 10:41:49 -0500 (Tue, 02 Dec 2008)
New Revision: 11489

Added:
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/messageBase.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/messages.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractMessageTest.java
   trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessagesTest.java
Modified:
   trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml
   trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java
Log:
RF-5126

Modified: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml	2008-12-02 15:33:41 UTC (rev 11488)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/message.xhtml	2008-12-02 15:41:49 UTC (rev 11489)
@@ -6,60 +6,18 @@
 	xmlns:f="http://java.sun.com/jsf/core"
 	xmlns:ui="http://java.sun.com/jsf/facelets">
 	
-<ui:composition template="#{templateBean.template}">
-	<ui:define name="style">
-		
+<ui:composition template="messageBase.xhtml">
+	<ui:define name="message">
+		<rich:message id="message" for="inputText"
+			ajaxRendered="#{messageBean.ajaxRendered}"
+			showSummary="#{messageBean.showSummary}"
+			showDetail="#{messageBean.showDetail}"
+			rendered="#{messageBean.rendered}"
+			styleClass="noname"
+			style="color: blue; text-decoration: underline;"
+			>
+			<ui:insert name="facets" />
+		</rich:message>
 	</ui:define>
-	<ui:define name="component">
-		<h:form id="attrForm">
-			<h:outputText value="rendered" />
-			<h:selectBooleanCheckbox id="rendered" value="#{messageBean.rendered}">
-				<a4j:support event="onchange" />
-			</h:selectBooleanCheckbox>		
-			<h:outputText value="showSummary" />
-			<h:selectBooleanCheckbox id="showSummary" value="#{messageBean.showSummary}">
-				<a4j:support event="onchange" />
-			</h:selectBooleanCheckbox>		
-			<h:outputText value="showDetail" />
-			<h:selectBooleanCheckbox id="showDetail" value="#{messageBean.showDetail}">
-				<a4j:support event="onchange" />
-			</h:selectBooleanCheckbox>		
-			<h:outputText value="ajaxRendered" />
-			<h:selectBooleanCheckbox id="ajaxRendered" value="#{messageBean.ajaxRendered}">
-				<a4j:support event="onchange" />
-			</h:selectBooleanCheckbox>		
-		</h:form>
-		<h:form id="mainForm">
-			<h:panelGroup id="panel">
-				<h:inputText id="inputText" value="#{messageBean.string}" validator="#{messageBean.validate}"></h:inputText>
-				<rich:message id="message" for="inputText"
-					ajaxRendered="false"
-					showSummary="#{messageBean.showSummary}"
-					showDetail="#{messageBean.showDetail}"
-					rendered="#{messageBean.rendered}"
-					styleClass="noname"
-					style="color: blue; text-decoration: underline;"
-					>
-					<f:facet name="fatalMarker">
-						<h:outputText id="fatalMarker" value="fatalMarker"></h:outputText>
-					</f:facet> 
-					<f:facet name="errorMarker">
-						<h:outputText id="errorMarker" value="errorMarker"></h:outputText>
-					</f:facet> 
-					<f:facet name="warnMarker">
-						<h:outputText id="warnMarker" value="warnMarker"></h:outputText>
-					</f:facet> 
-					<f:facet name="infoMarker">
-						<h:outputText id="infoMarker" value="infoMarker"></h:outputText>
-					</f:facet> 
-					<f:facet name="passedMarker">
-						<h:outputText id="passedMarker" value="passedMarker"></h:outputText>
-					</f:facet> 
-				</rich:message>
-			</h:panelGroup>
-			<a4j:commandButton id="submit" value="Submit" reRender="panel"></a4j:commandButton>
-			<a4j:commandButton id="submitWithoutReRender" value="submitWithoutReRender"></a4j:commandButton>
-		</h:form>
-	</ui:define>
 </ui:composition>
 </html>
\ No newline at end of file

Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/messageBase.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/messageBase.xhtml	                        (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/messageBase.xhtml	2008-12-02 15:41:49 UTC (rev 11489)
@@ -0,0 +1,56 @@
+<!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="#{templateBean.template}">
+	<ui:define name="component">
+		<h:form id="attrForm">
+			<h:outputText value="rendered" />
+			<h:selectBooleanCheckbox id="rendered" value="#{messageBean.rendered}">
+				<a4j:support event="onchange" />
+			</h:selectBooleanCheckbox>		
+			<h:outputText value="showSummary" />
+			<h:selectBooleanCheckbox id="showSummary" value="#{messageBean.showSummary}">
+				<a4j:support event="onchange" />
+			</h:selectBooleanCheckbox>		
+			<h:outputText value="showDetail" />
+			<h:selectBooleanCheckbox id="showDetail" value="#{messageBean.showDetail}">
+				<a4j:support event="onchange" />
+			</h:selectBooleanCheckbox>		
+			<h:outputText value="ajaxRendered" />
+			<h:selectBooleanCheckbox id="ajaxRendered" value="#{messageBean.ajaxRendered}">
+				<a4j:support event="onchange" />
+			</h:selectBooleanCheckbox>		
+		</h:form>
+		<h:form id="mainForm">
+			<h:panelGroup id="panel">
+				<h:inputText id="inputText" value="#{messageBean.string}" validator="#{messageBean.validate}"></h:inputText>
+				<ui:insert name="message" />
+			</h:panelGroup>
+			<a4j:commandButton id="submit" value="Submit" reRender="panel"></a4j:commandButton>
+			<a4j:commandButton id="submitWithoutReRender" value="submitWithoutReRender"></a4j:commandButton>
+		</h:form>
+	</ui:define>
+	<ui:define name="facets">
+		<f:facet name="fatalMarker">
+			<h:outputText id="fatalMarker" value="fatalMarker"></h:outputText>
+		</f:facet> 
+		<f:facet name="errorMarker">
+			<h:outputText id="errorMarker" value="errorMarker"></h:outputText>
+		</f:facet> 
+		<f:facet name="warnMarker">
+			<h:outputText id="warnMarker" value="warnMarker"></h:outputText>
+		</f:facet> 
+		<f:facet name="infoMarker">
+			<h:outputText id="infoMarker" value="infoMarker"></h:outputText>
+		</f:facet> 
+		<f:facet name="passedMarker">
+			<h:outputText id="passedMarker" value="passedMarker"></h:outputText>
+		</f:facet> 
+	</ui:define>	
+</ui:composition>
+</html>
\ No newline at end of file

Added: trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/messages.xhtml
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/messages.xhtml	                        (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/main/webapp/pages/message/messages.xhtml	2008-12-02 15:41:49 UTC (rev 11489)
@@ -0,0 +1,23 @@
+<!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="messageBase.xhtml">
+	<ui:define name="message">
+		<rich:messages id="message"
+			ajaxRendered="#{messageBean.ajaxRendered}"
+			showSummary="#{messageBean.showSummary}"
+			showDetail="#{messageBean.showDetail}"
+			rendered="#{messageBean.rendered}"
+			styleClass="noname"
+			style="color: blue; text-decoration: underline;"
+			>
+			<ui:insert name="facets" />
+		</rich:messages>
+	</ui:define>
+</ui:composition>
+</html>
\ No newline at end of file

Added: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractMessageTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractMessageTest.java	                        (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/AbstractMessageTest.java	2008-12-02 15:41:49 UTC (rev 11489)
@@ -0,0 +1,124 @@
+package org.richfaces.testng;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.ajax4jsf.template.Template;
+import org.richfaces.SeleniumTestBase;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public abstract class AbstractMessageTest extends SeleniumTestBase {
+	
+	protected String mainForm;
+
+	protected String inputText;
+    
+    protected String message;
+    
+    private String submit;
+	
+    private String rendered;
+	
+	private String showDetail;
+
+	private String showSummary;
+
+	protected String ajaxRendered;
+
+	protected String label;
+
+	protected void init(Template template) {
+        renderPage(template, "#{messageBean.init}");
+        mainForm = getParentId() + "mainForm";
+        inputText = mainForm + ":inputText";
+        message = mainForm + ":message";
+        submit = mainForm + ":submit";
+        String attrForm = getParentId() + "attrForm";
+        rendered = attrForm + ":rendered"; 
+        showDetail = attrForm + ":showDetail"; 
+        showSummary = attrForm + ":showSummary"; 
+        ajaxRendered = attrForm + ":ajaxRendered"; 
+    }
+
+    /**
+     *  style and classes, standard HTML attributes are output to client
+     */
+	@Test
+	public void testHTMLAttributes(Template template) {
+        init(template);
+		Map<String, String> styleAttributes = new HashMap<String, String>();
+		styleAttributes.put("color", "blue");
+		styleAttributes.put("text-decoration", "underline");			
+        assertClassNames(message,new String [] {"noname"}, "Component's rendering invalid", true);
+        assertStyleAttributes(message, styleAttributes);
+	}
+
+	/**
+     * showDetail and showSummary attributes work
+     */
+    @Test
+    public void testShowDetailAndShowSummary(Template template) {
+    	init(template);
+		Assert.assertTrue(selenium.getText(label).length() == 0);
+    	selenium.type(inputText, "fatal");
+    	clickAjaxCommandAndWait(submit);
+    	Assert.assertTrue("messageDetail".equals(selenium.getText(label)));
+    	clickAjaxCommandAndWait(showSummary);
+    	selenium.type(inputText, "fatal");
+    	clickAjaxCommandAndWait(submit);
+    	Assert.assertTrue("messageSummarymessageDetail".equals(selenium.getText(label)));
+    	clickAjaxCommandAndWait(showDetail);
+    	selenium.type(inputText, "fatal");
+    	clickAjaxCommandAndWait(submit);
+    	Assert.assertTrue("messageSummary".equals(selenium.getText(label)));
+    	
+    }
+
+    /**
+     * level selects message of respective level
+     */
+    @Test
+    public void testLevel(Template template) {
+    	//TODO
+    	Assert.fail("This test should be completed after resolving bug RF-5107.");
+    }
+    
+    /**
+     * check markers rendering
+     */
+    @Test
+    public void testMarkers(Template template) {
+    	init(template);
+    	Assert.assertTrue(selenium.isElementPresent(mainForm + ":passedMarker"));
+    	selenium.type(inputText, "fatal");
+    	clickAjaxCommandAndWait(submit);
+    	Assert.assertTrue(selenium.isElementPresent(mainForm + ":fatalMarker"));
+    	selenium.type(inputText, "error");
+    	clickAjaxCommandAndWait(submit);
+    	Assert.assertTrue(selenium.isElementPresent(mainForm + ":errorMarker"));
+    	selenium.type(inputText, "warn");
+    	clickAjaxCommandAndWait(submit);
+    	Assert.assertTrue(selenium.isElementPresent(mainForm + ":warnMarker"));
+    	selenium.type(inputText, "info");
+    	clickAjaxCommandAndWait(submit);
+    	Assert.assertTrue(selenium.isElementPresent(mainForm + ":infoMarker"));
+    }
+    
+    /**
+     *   	 component with rendered = false is not present on the page
+     */
+    @Test
+    public void testRendered(Template template) {
+    	init(template);
+        init(template); 
+        Assert.assertTrue(selenium.isElementPresent(message), "ListShuttle must be rendered.");
+
+        selenium.click(rendered);
+        waitForAjaxCompletion();
+        clickAjaxCommandAndWait(submit);       
+        
+        Assert.assertFalse(selenium.isElementPresent(message), "ListShuttle mustn't be rendered.");
+    }
+    	
+}

Modified: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java	2008-12-02 15:33:41 UTC (rev 11488)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessageTest.java	2008-12-02 15:41:49 UTC (rev 11489)
@@ -1,89 +1,19 @@
 package org.richfaces.testng;
 
-import java.util.HashMap;
-import java.util.Map;
-
 import org.ajax4jsf.template.Template;
-import org.richfaces.SeleniumTestBase;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
-public class MessageTest extends SeleniumTestBase {
-	
-	private String mainForm;
 
-    private String inputText;
-    
-    private String message;
-    
-    private String submit;
-	
-    private String rendered;
-	
-	private String showDetail;
+public class MessageTest extends AbstractMessageTest {
 
-	private String showSummary;
-
-	private String ajaxRendered;
-
-	private void init(Template template) {
-        renderPage(template, "#{messageBean.init}");
-        mainForm = getParentId() + "mainForm";
-        inputText = mainForm + ":inputText";
-        message = mainForm + ":message";
-        submit = mainForm + ":submit";
-        String attrForm = getParentId() + "attrForm";
-        rendered = attrForm + ":rendered"; 
-        showDetail = attrForm + ":showDetail"; 
-        showSummary = attrForm + ":showSummary"; 
-        ajaxRendered = attrForm + ":ajaxRendered"; 
-    }
-
-    /**
-     *  style and classes, standard HTML attributes are output to client
-     */
-	@Test
-	public void testHTMLAttributes(Template template) {
-        init(template);
-		Map<String, String> styleAttributes = new HashMap<String, String>();
-		styleAttributes.put("color", "blue");
-		styleAttributes.put("text-decoration", "underline");			
-        assertClassNames(message,new String [] {"noname"}, "Component's rendering invalid", true);
-        assertStyleAttributes(message, styleAttributes);
+	@Override
+	protected void init(Template template) {
+		super.init(template);
+    	label = "xpath=id('" + message + "')/span[2]";
 	}
-
-	/**
-     * showDetail and showSummary attributes work
-     */
-    @Test
-    public void testShowDetailAndShowSummary(Template template) {
-    	init(template);
-    	String locator = "xpath=id('" + message + "')/span[2]";
-		Assert.assertTrue(selenium.getText(locator).length() == 0);
-    	selenium.type(inputText, "fatal");
-    	clickAjaxCommandAndWait(submit);
-    	Assert.assertTrue("messageDetail".equals(selenium.getText(locator)));
-    	clickAjaxCommandAndWait(showSummary);
-    	selenium.type(inputText, "fatal");
-    	clickAjaxCommandAndWait(submit);
-    	Assert.assertTrue("messageSummarymessageDetail".equals(selenium.getText(locator)));
-    	clickAjaxCommandAndWait(showDetail);
-    	selenium.type(inputText, "fatal");
-    	clickAjaxCommandAndWait(submit);
-    	Assert.assertTrue("messageSummary".equals(selenium.getText(locator)));
-    	
-    }
-
+	
     /**
-     * level selects message of respective level
-     */
-    @Test
-    public void testLevel(Template template) {
-    	//TODO
-    	Assert.fail("This test should be completed after resolving bug RF-5107.");
-    }
-    
-    /**
      * ajaxRendered message output first message for attached component by ajax request
      */
     @Test
@@ -98,44 +28,7 @@
     	Assert.assertTrue(selenium.isElementPresent(mainForm + ":fatalMarker"));
     }
     
-    /**
-     * check markers rendering
-     */
-    @Test
-    public void testMarkers(Template template) {
-    	init(template);
-    	Assert.assertTrue(selenium.isElementPresent(mainForm + ":passedMarker"));
-    	selenium.type(inputText, "fatal");
-    	clickAjaxCommandAndWait(submit);
-    	Assert.assertTrue(selenium.isElementPresent(mainForm + ":fatalMarker"));
-    	selenium.type(inputText, "error");
-    	clickAjaxCommandAndWait(submit);
-    	Assert.assertTrue(selenium.isElementPresent(mainForm + ":errorMarker"));
-    	selenium.type(inputText, "warn");
-    	clickAjaxCommandAndWait(submit);
-    	Assert.assertTrue(selenium.isElementPresent(mainForm + ":warnMarker"));
-    	selenium.type(inputText, "info");
-    	clickAjaxCommandAndWait(submit);
-    	Assert.assertTrue(selenium.isElementPresent(mainForm + ":infoMarker"));
-    }
-    
-    /**
-     *   	 component with rendered = false is not present on the page
-     */
-    @Test
-    public void testRendered(Template template) {
-    	init(template);
-        init(template); 
-        Assert.assertTrue(selenium.isElementPresent(message), "ListShuttle must be rendered.");
-
-        selenium.click(rendered);
-        waitForAjaxCompletion();
-        clickAjaxCommandAndWait(submit);       
-        
-        Assert.assertFalse(selenium.isElementPresent(message), "ListShuttle mustn't be rendered.");
-    }
-    	
-    @Override
+	@Override
 	public String getTestUrl() {
 		return "pages/message/message.xhtml";
 	}

Added: trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessagesTest.java
===================================================================
--- trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessagesTest.java	                        (rev 0)
+++ trunk/test-applications/seleniumTest/richfaces/src/test/java/org/richfaces/testng/MessagesTest.java	2008-12-02 15:41:49 UTC (rev 11489)
@@ -0,0 +1,17 @@
+package org.richfaces.testng;
+
+import org.ajax4jsf.template.Template;
+
+public class MessagesTest extends AbstractMessageTest {
+
+	@Override
+	protected void init(Template template) {
+		super.init(template);
+    	label = "xpath=id('" + message + "')/dt[1]/span[2]";
+	}
+	
+	@Override
+	public String getTestUrl() {
+		return "pages/message/messages.xhtml";
+	}
+}




More information about the richfaces-svn-commits mailing list