[richfaces-svn-commits] JBoss Rich Faces SVN: r9179 - trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Tue Jun 24 08:17:55 EDT 2008


Author: alevkovsky
Date: 2008-06-24 08:17:55 -0400 (Tue, 24 Jun 2008)
New Revision: 9179

Modified:
   trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java
Log:
Move template to methods parameter

Modified: trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java
===================================================================
--- trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java	2008-06-24 12:00:39 UTC (rev 9178)
+++ trunk/test-applications/seleniumTest/src/test/java/org/richfaces/testng/AjaxOutputPanelTest.java	2008-06-24 12:17:55 UTC (rev 9179)
@@ -9,8 +9,6 @@
 import org.ajax4jsf.template.Template;
 import org.richfaces.SeleniumTestBase;
 import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Parameters;
 import org.testng.annotations.Test;
 
 /**
@@ -39,6 +37,8 @@
 
     private final static String BUTTON4_ID = "b4";
 
+    private final static String RESET_BUTTON_ID = "reset";
+
     private final static String TEXT_SUFFIX = "_text";
 
     private final static String RESULT_SUFFIX = "_result";
@@ -47,27 +47,16 @@
 	return "pages/ajaxOutputPanel/ajaxOutputPanelTest.xhtml";
     }
 
-    /**
-     * This method are invoking before selenium tests started
-     */
-    @BeforeMethod
-    @Parameters( { "browser", "filterPrefix" })
-    public void startSelenium(String browser, String filterPrefix) {
-	super.startSelenium(browser, filterPrefix);
-
-	// TODO remove template - it should pass as parameter
-	renderPage(Template.SIMPLE);
-    }
-
-    @Test
-    public void testLayoutAttribute() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testLayoutAttribute(Template template) throws Exception {
+	renderPage(template);
 	// panel_1 has layout=inline(default)
 	// panel_2 has layout=block
 	// panel_3 has layout=none
 	writeStatus("Testing layout attribute...");
 
-	String panelId = FORM_ID + PANEL1_ID;
-	String panel2Id = FORM_ID + PANEL2_ID;
+	String panelId = getParentId() + FORM_ID + PANEL1_ID;
+	String panel2Id = getParentId() + FORM_ID + PANEL2_ID;
 	String panel3Id = getParentId() + FORM_ID + PANEL3_ID;
 
 	Assert.assertTrue(isPresentById(panelId));
@@ -92,11 +81,12 @@
 	// rendered with id of a child component and display:none style
 	Assert.assertTrue(isPresentById(panel3Id + "_text"), "panel_3 has layout=none and should peresent if no child component is rendered with id of a child component");
 	Assert.assertFalse(isVisibleById(panel3Id + "_text"), "panel_3 has layout=none and should peresent if no child component is rendered with display:none style");
-
+	clickReset();
     }
 
-    @Test
-    public void testRenderedAttribute() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testRenderedAttribute(Template template) throws Exception {
+	renderPage(template);
 	writeStatus("Testing rendered attribute...");
 
 	String panelId = getParentId() + FORM_ID + PANEL4_ID;
@@ -111,10 +101,12 @@
 
 	// panel_4 has rendered=false and should not present on page
 	AssertNotRendered(panelId);
+	clickReset();
     }
 
-    @Test
-    public void testAjaxRenderedAttribute() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testAjaxRenderedAttribute(Template template) throws Exception {
+	renderPage(template);
 	// panel_1 has ajaxRendered=false and is reRender by b1
 	// panel_2 has ajaxRendered=true
 	writeStatus("Testing ajaxRendered attribute...");
@@ -139,11 +131,13 @@
 	waitForAjaxCompletion();
 	// panel text should NOT be visible as it reRendered by b1
 	Assert.assertFalse(isPresentById(panelId), "panel_1 text should not be visible as it reRendered by b1");
+	clickReset();
 
     }
 
-    @Test
-    public void testAjaxRenderedAttributeWithLimitToList() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testAjaxRenderedAttributeWithLimitToList(Template template) throws Exception {
+	renderPage(template);
 	// panel_1 has ajaxRendered=false and is reRender by b1 with
 	// limitToList=true
 	// panel_2 has ajaxRendered=true
@@ -168,11 +162,12 @@
 	// panel_2 text should not be visible as it has ajaxRendered=true and b2
 	// has limitToList=false
 	Assert.assertFalse(isPresentById(panelId2), "panel_2 text should not be visible as it has ajaxRendered=true and b2 has limitToList=false");
-
+	clickReset();
     }
 
-    @Test
-    public void testOnDoubleClickEvent() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testOnDoubleClickEvent(Template template) throws Exception {
+	renderPage(template);
 	String parentId = getParentId() + FORM_ID;
 	String panelId = parentId + "panel_5";
 	String panelResultId = panelId + RESULT_SUFFIX;
@@ -182,8 +177,9 @@
 	AssertTextEquals(panelResultId, "Yes");
     }
 
-    @Test
-    public void testOnKeyDownEvent() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testOnKeyDownEvent(Template template) throws Exception {
+	renderPage(template);
 	String parentId = getParentId() + FORM_ID;
 	String panelId = parentId + "panel_6";
 	String panelResultId = panelId + RESULT_SUFFIX;
@@ -193,8 +189,9 @@
 	AssertTextEquals(panelResultId, "Yes");
     }
 
-    @Test
-    public void testOnKeyPressEvent() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testOnKeyPressEvent(Template template) throws Exception {
+	renderPage(template);
 	String parentId = getParentId() + FORM_ID;
 	String panelId = parentId + "panel_7";
 	String panelResultId = panelId + RESULT_SUFFIX;
@@ -204,8 +201,9 @@
 	AssertTextEquals(panelResultId, "Yes");
     }
 
-    @Test
-    public void testOnKeyUpEvent() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testOnKeyUpEvent(Template template) throws Exception {
+	renderPage(template);
 	String parentId = getParentId() + FORM_ID;
 	String panelId = parentId + "panel_8";
 	String panelResultId = panelId + RESULT_SUFFIX;
@@ -215,8 +213,9 @@
 	AssertTextEquals(panelResultId, "Yes");
     }
 
-    @Test
-    public void testOnMouseDownEvent() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testOnMouseDownEvent(Template template) throws Exception {
+	renderPage(template);
 	String parentId = getParentId() + FORM_ID;
 	String panelId = parentId + "panel_9";
 	String panelResultId = panelId + RESULT_SUFFIX;
@@ -226,8 +225,9 @@
 	AssertTextEquals(panelResultId, "Yes");
     }
 
-    @Test
-    public void testOnMouseMoveEvent() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testOnMouseMoveEvent(Template template) throws Exception {
+	renderPage(template);
 	String parentId = getParentId() + FORM_ID;
 	String panelId = parentId + "panel_10";
 	String panelResultId = panelId + RESULT_SUFFIX;
@@ -237,8 +237,9 @@
 	AssertTextEquals(panelResultId, "Yes");
     }
 
-    @Test
-    public void testOnMouseOutEvent() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testOnMouseOutEvent(Template template) throws Exception {
+	renderPage(template);
 	String parentId = getParentId() + FORM_ID;
 	String panelId = parentId + "panel_11";
 	String panelResultId = panelId + RESULT_SUFFIX;
@@ -248,8 +249,9 @@
 	AssertTextEquals(panelResultId, "Yes");
     }
 
-    @Test
-    public void testOnMouseOverEvent() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testOnMouseOverEvent(Template template) throws Exception {
+	renderPage(template);
 	String parentId = getParentId() + FORM_ID;
 	String panelId = parentId + "panel_12";
 	String panelResultId = panelId + RESULT_SUFFIX;
@@ -259,8 +261,9 @@
 	AssertTextEquals(panelResultId, "Yes");
     }
 
-    @Test
-    public void testOnMouseUpEvent() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testOnMouseUpEvent(Template template) throws Exception {
+	renderPage(template);
 	String parentId = getParentId() + FORM_ID;
 	String panelId = parentId + "panel_13";
 	String panelResultId = panelId + RESULT_SUFFIX;
@@ -270,8 +273,9 @@
 	AssertTextEquals(panelResultId, "Yes");
     }
 
-    @Test
-    public void testOnClickEvent() throws Exception {
+    @Test(dataProvider = "templates")
+    public void testOnClickEvent(Template template) throws Exception {
+	renderPage(template);
 	String parentId = getParentId() + FORM_ID;
 	String panelId = parentId + "panel_14";
 	String panelResultId = panelId + RESULT_SUFFIX;
@@ -280,4 +284,10 @@
 	selenium.click(panelId);
 	AssertTextEquals(panelResultId, "Yes");
     }
+
+    private void clickReset() {
+	String buttonId = getParentId() + FORM_ID + RESET_BUTTON_ID;
+	writeStatus("Click reset button");
+	clickCommandAndWait(buttonId);
+    }
 }




More information about the richfaces-svn-commits mailing list