[seam-commits] Seam SVN: r11393 - in branches/enterprise/JBPAPP_5_0/src/test/ftest: examples/remoting and 10 other directories.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Mon Aug 17 08:17:03 EDT 2009


Author: mgencur at redhat.com
Date: 2009-08-17 08:17:03 -0400 (Mon, 17 Aug 2009)
New Revision: 11393

Added:
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/build.xml
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/jboss5.xml
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/
   branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java
Modified:
   branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml
Log:
JBPAPP-2513 Added a functional test for gwt example.

Modified: branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml	2009-08-17 12:09:36 UTC (rev 11392)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/build.xml	2009-08-17 12:17:03 UTC (rev 11393)
@@ -83,6 +83,7 @@
 		<testexample name="registration" />
 		<testexample name="remoting/chatroom" />
 		<testexample name="remoting/helloworld" />
+		<testexample name="remoting/gwt" />
 		<testexample name="seambay" />
 		<antcall target="stop.selenium.server" />
 	</target>
@@ -138,6 +139,7 @@
 		<cleanexample name="registration" />
 		<cleanexample name="remoting/chatroom" />
 		<cleanexample name="remoting/helloworld" />
+		<cleanexample name="remoting/gwt" />
 		<cleanexample name="seambay" />
 		<cleanexample name="seamdiscs" />
 		<cleanexample name="seampay" />
@@ -169,6 +171,7 @@
 		<undeployexample name="registration" />
 		<undeployexample name="remoting/chatroom" />
 		<undeployexample name="remoting/helloworld" />
+		<undeployexample name="remoting/gwt" />
 		<undeployexample name="seambay" />
 		<undeployexample name="seamdiscs" />
 		<undeployexample name="seampay" />

Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/build.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/build.xml	                        (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/build.xml	2009-08-17 12:17:03 UTC (rev 11393)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+JBoss, Home of Professional Open Source
+Copyright 2008, Red Hat Middleware LLC, and individual contributors
+by the @authors tag. See the copyright.txt in the distribution for a
+full listing of individual contributors.
+
+This is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License as
+published by the Free Software Foundation; either version 2.1 of
+the License, or (at your option) any later version.
+
+This software 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 software; if not, write to the Free
+Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+02110-1301 USA, or see the FSF site: http://www.fsf.org.
+-->
+<project name="remoting.gwt.ftest.build" basedir="." default="build">
+	<property name="example.name" value="remoting/gwt" />
+	<property name="context.path" value="/seam-gwt" />
+	
+	<import file="../../build.xml" />
+</project>

Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/jboss5.xml
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/jboss5.xml	                        (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/jboss5.xml	2009-08-17 12:17:03 UTC (rev 11393)
@@ -0,0 +1,27 @@
+
+	<!--
+		JBoss, Home of Professional Open Source Copyright 2008, Red Hat
+		Middleware LLC, and individual contributors by the @authors tag. See
+		the copyright.txt in the distribution for a full listing of individual
+		contributors. This is free software; you can redistribute it and/or
+		modify it under the terms of the GNU Lesser General Public License as
+		published by the Free Software Foundation; either version 2.1 of the
+		License, or (at your option) any later version. This software 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 software; if not, write
+		to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+		Boston, MA 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+	--> 
+<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
+<suite name="Gwt example" verbose="2" parallel="false">
+	<test name="remoting_gwt_jboss5">
+		<parameter name="PROPERTY_FILE" value="" />
+		<classes>
+			<class
+				name="org.jboss.seam.example.remoting.gwt.test.selenium.GwtTest" />
+		</classes>
+	</test>
+</suite>


Property changes on: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/jboss5.xml
___________________________________________________________________
Name: svn:executable
   + *

Added: branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java
===================================================================
--- branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java	                        (rev 0)
+++ branches/enterprise/JBPAPP_5_0/src/test/ftest/examples/remoting/gwt/src/org/jboss/seam/example/remoting/gwt/test/selenium/GwtTest.java	2009-08-17 12:17:03 UTC (rev 11393)
@@ -0,0 +1,102 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and individual contributors
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software 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 software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */ 
+
+package org.jboss.seam.example.remoting.gwt.test.selenium;
+
+import org.jboss.seam.example.common.test.selenium.SeamSeleniumTest;
+
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.thoughtworks.selenium.Wait;
+
+import static org.testng.AssertJUnit.*;
+
+/**
+ * This class tests a functionality of remoting/gwt example.
+ * 
+ * @author Martin Gencur
+ * 
+ */
+public class GwtTest extends SeamSeleniumTest
+{
+   protected static final String GWT_URL = "/HelloWorld.html";
+   protected static final String GWT_TITLE = "Wrapper HTML for HelloWorld";   
+   protected static final String ASK_BUTTON = "dom=document.getElementsByTagName('button')[0]";
+   protected static final String TEXT_FIELD = "dom=document.getElementsByTagName('input')[0]";
+   protected static final Long TIMEOUT = 2000L; //2 seconds      
+   
+   protected static final String ENTER_TEXT_WITHOUT = "Text without question mark at the end";
+   protected static final String ENTER_TEXT_WITH = "Text WITH question mark at the end?";
+   
+   protected static final String MESSAGE_WITHOUT = "A question has to end with a \'?\'";
+   protected static final String MESSAGE_WITH = "Its the real question that you seek now";
+ 
+   @Override
+   @BeforeMethod
+   public void setUp()
+   {
+      super.setUp();
+      browser.open(CONTEXT_PATH + GWT_URL);
+   }
+
+   @Test
+   public void simplePageContentTest()
+   {      
+      assertTrue("Home page of Remoting/Gwt Example expected", browser.getLocation().contains(GWT_URL));      
+      assertTrue("Different page title expected ale je:"+ browser.getTitle(),browser.getTitle().contains(GWT_TITLE));
+      assertTrue("Home page should contain Text field", browser.isElementPresent(TEXT_FIELD));
+      assertTrue("Home page should contain Ask button", browser.isElementPresent(ASK_BUTTON));
+   }
+   
+   @Test(dependsOnMethods = {"simplePageContentTest"})
+   public void withoutQuestionMarkTest(){
+      String result = "";   
+      browser.type(TEXT_FIELD, ENTER_TEXT_WITHOUT);
+      browser.click(ASK_BUTTON);
+      waitForAlertPresent(TIMEOUT);
+      result = browser.getAlert();      
+      assertTrue("An alert message should show up and should contain message \"" + MESSAGE_WITHOUT + "\"", result.contains(MESSAGE_WITHOUT));       
+   } 
+   
+   @Test(dependsOnMethods = {"simplePageContentTest"})
+   public void withQuestionMarkTest(){
+      String result = "";   
+      browser.type(TEXT_FIELD, ENTER_TEXT_WITH);
+      browser.click(ASK_BUTTON);
+      waitForAlertPresent(TIMEOUT);
+      result = browser.getAlert();      
+      assertTrue("An alert message should show up and should contain message \"" + MESSAGE_WITH + "\"", result.contains(MESSAGE_WITH));       
+   }    
+   
+   public void waitForAlertPresent(Long timeout){
+      new Wait()
+      {
+         @Override
+         public boolean until()
+         {
+            return browser.isAlertPresent();
+         }
+      }.wait("Timeout while waiting for alert window.", timeout);
+   }   
+}



More information about the seam-commits mailing list