continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From wsm...@apache.org
Subject svn commit: r779341 - in /continuum/trunk/continuum-webapp-test/src/test: resources/ testng/org/apache/continuum/web/test/ testng/org/apache/continuum/web/test/parent/
Date Wed, 27 May 2009 22:14:12 GMT
Author: wsmoak
Date: Wed May 27 22:14:12 2009
New Revision: 779341

URL: http://svn.apache.org/viewvc?rev=779341&view=rev
Log:
[CONTINUUM-2073] Updates to the Selenium TestNG tests (patch #7)
Submitted by: Tin Pardo

Modified:
    continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildQueueTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java

Modified: continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties?rev=779341&r1=779340&r2=779341&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties (original)
+++ continuum/trunk/continuum-webapp-test/src/test/resources/testng.properties Wed May 27
22:14:12 2009
@@ -24,12 +24,13 @@
 ########################
 
 # Properties for testAddMavenTwoProject
-M2_POM_URL =https://svn.apache.org/repos/asf/continuum/sandbox/simple-example/pom.xml
-M2_PROJ_GRP_NAME=Continuum Simple Example Project
-M2_PROJ_GRP_ID=org.apache.continuum.examples
-M2_PROJ_GRP_DESCRIPTION=
+M2_POM_URL =https://svn.apache.org/repos/asf/continuum/sandbox/continuum-build-queue-test-data/pom.xml
+M2_PROJ_GRP_NAME=ContinuumBuildQueueTestData
+M2_PROJ_GRP_ID=org.apache.continuum
+M2_PROJ_GRP_DESCRIPTION=Project for testing continuum build queue
 M2_POM_USERNAME =
 M2_POM_PASSWORD =
+
 # SCM element is missing from pom
 NOT_SCM_POM_URL =http://svn.apache.org/repos/asf/continuum/trunk/continuum-webapp-test/src/test/resources/unit/maven-two-projects/missing-scm-element-pom.xml
 MISS_CONECT_POM_URL =http://svn.apache.org/repos/asf/continuum/trunk/continuum-webapp-test/src/test/resources/unit/maven-two-projects/missing-connection-element-pom.xml

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java?rev=779341&r1=779340&r2=779341&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/QueueTest.java
Wed May 27 22:14:12 2009
@@ -26,12 +26,14 @@
  * @author José Morales Martínez
  * @version $Id$
  */
-@Test( groups = { "queue" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
-public class QueueTest
-    extends AbstractBuildQueueTest
-{
 
-    public void testAddBuildQueue()
+
+@Test( groups = { "queue" }, dependsOnMethods = { "testWithCorrectUsernamePassword" } )
+    public class QueueTest
+        extends AbstractBuildQueueTest
+    {
+    
+	public void testAddBuildQueue()
     {
         setMaxBuildQueue( 2 );
         String BUILD_QUEUE_NAME = p.getProperty( "BUILD_QUEUE_NAME" );
@@ -55,7 +57,8 @@
         addBuildQueue( BUILD_QUEUE_NAME, false );
         assertTextPresent( "Build queue name already exists." );
     }
-
+    
+    //@Test( dependsOnMethods = { "testAddAlreadyExistBuildQueue" } )
     public void testAddEmptyBuildQueue()
     {
         setMaxBuildQueue( 3 );
@@ -69,15 +72,52 @@
         goToBuildQueuePage();
         String BUILD_QUEUE_NAME = p.getProperty( "BUILD_QUEUE_NAME" );
         removeBuildQueue( BUILD_QUEUE_NAME );
+        assertTextNotPresent( BUILD_QUEUE_NAME );
     }
-
-    public void testQueuePage()
+    
+       
+    @Test( dependsOnMethods = { "testAddMavenTwoProject" } )
+    public void testQueuePageWithProjectCurrentlyBuilding()
+        throws Exception
+    {   
+    	//build a project
+        String M2_PROJ_GRP_NAME = p.getProperty( "M2_PROJ_GRP_NAME" );
+        String M2_PROJ_GRP_ID = p.getProperty( "M2_PROJ_GRP_ID" );
+        String M2_PROJ_GRP_DESCRIPTION = p.getProperty( "M2_PROJ_GRP_DESCRIPTION" );
+        buildProjectForQueuePageTest( M2_PROJ_GRP_NAME, M2_PROJ_GRP_ID, M2_PROJ_GRP_DESCRIPTION,
M2_PROJ_GRP_NAME );
+        
+        //check queue page while building
+    	clickAndWait( "link=Queues" );
+	    assertPage( "Continuum - Build Queue" );
+	    assertTextPresent( "Current Build" );
+	    assertTextPresent( "Build Queue" );
+	    assertTextPresent( "Current Checkout" );
+	    assertTextPresent( "Checkout Queue " );
+	    assertTextPresent( "Current Prepare Build" );
+	    assertTextPresent( "Prepare Build Queue" );
+	    assertElementPresent("//table[@id='ec_table']/tbody/tr/td[4]");
+	    assertTextPresent( M2_PROJ_GRP_NAME );
+	    getSelenium().goBack();
+	    getSelenium().refresh();
+        waitPage();
+	    waitForElementPresent( "//img[@alt='Success']" );
+	    Thread.sleep( 10000 );
+    }
+    
+    //@Test( dependsOnMethods = { "testDeleteBuildQueue" } )
+    public void testQueuePageWithoutBuild()
     {
-        clickLinkWithText( "Queues" );
+        clickAndWait( "link=Queues"  );
         assertPage( "Continuum - Build Queue" );
+        assertTextPresent( "Nothing is building" );
+        assertTextNotPresent( "Project Name* Build Definition" );
         assertTextPresent( "Current Build" );
-        assertTextPresent( "Continuum - Build Queue" );
-        assertTextPresent( "Current Checkout" );
-        assertTextPresent( "Checkout Queue" );
-    }
+	    assertTextPresent( "Build Queue" );
+	    assertTextPresent( "Current Checkout" );
+	    assertTextPresent( "Checkout Queue " );
+	    assertTextPresent( "Current Prepare Build" );
+	    assertTextPresent( "Prepare Build Queue" );
+        
+    }    
+    
 }

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildQueueTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildQueueTest.java?rev=779341&r1=779340&r2=779341&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildQueueTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractBuildQueueTest.java
Wed May 27 22:14:12 2009
@@ -1,5 +1,7 @@
 package org.apache.continuum.web.test.parent;
 
+import org.testng.Assert;
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file
@@ -64,22 +66,34 @@
         assertButtonWithValuePresent( "Cancel" );
     }
 
-    public void addBuildQueue( String name, boolean success )
-    {
-        goToBuildQueuePage();
-        assertBuildQueuePage();
-        submit();
-        assertAddBuildQueuePage();
-        setFieldValue( "name", name );
-        submit();
-        if ( success )
-        {
-            assertBuildQueuePage();
-            assertTextPresent( name );
-        }
-        else
-        {
-            assertAddBuildQueuePage();
-        }
-    }
+	public void addBuildQueue( String name, boolean success )
+	{
+	    goToBuildQueuePage();
+	    assertBuildQueuePage();
+	    submit();
+	    assertAddBuildQueuePage();
+	    setFieldValue( "name", name );
+	    submit();
+	    if ( success )
+	    {
+	        assertBuildQueuePage();
+	        assertTextPresent( name );
+	    }
+	    else
+	    {
+	        assertAddBuildQueuePage();
+	    }
+	}
+	    
+	public void buildProjectForQueuePageTest( String projectGroupName, String groupId, String
description, String projectName )
+    throws Exception
+    {       
+        showProjectGroup( projectGroupName, groupId, description );
+        clickButtonWithValue( "Build all projects" );
+        waitForElementPresent( "//img[@alt='Building']" );
+        Thread.sleep( 10000 );
+               	
+     }
+	    
+	    
 }

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java?rev=779341&r1=779340&r2=779341&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractContinuumTest.java
Wed May 27 22:14:12 2009
@@ -752,7 +752,8 @@
     private void waitAddProject( String title )
         throws Exception
     {
-        Thread.sleep( 100 );
+    	
+    	Thread.sleep( 4000 ); 
         String condition = "selenium.browserbot.getCurrentWindow().document.title != ''";
         getSelenium().waitForCondition( condition, maxWaitTimeInMs );
         Thread.sleep( 1000 );

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java?rev=779341&r1=779340&r2=779341&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
(original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
Wed May 27 22:14:12 2009
@@ -361,4 +361,30 @@
     {
         Assert.assertFalse( getSelenium().isChecked( locator ) );
     }
-}
+    public void clickAndWait (String locator) 
+	{
+	  getSelenium().click(locator);
+	  getSelenium().waitForPageToLoad(maxWaitTimeInMs);
+	}
+    
+    public void waitForElementPresent(String locator) throws InterruptedException
+    {   
+    	getSelenium().waitForPageToLoad(maxWaitTimeInMs);
+    	for (int second = 0;; second++) {
+    		if (second >= 60) Assert.fail("timeout");
+    		try { if ( isElementPresent(locator)) break; } catch (Exception e) {}
+    		Thread.sleep(1000);
+    	}
+    }
+
+    public void waitForTextPresent(String text) throws InterruptedException
+    {   
+    	getSelenium().waitForPageToLoad(maxWaitTimeInMs);
+    	for (int second = 0;; second++) {
+    		if (second >= 60) Assert.fail( "Timeout" );
+    		try { if ( isTextPresent(text)) break; } catch (Exception e) {}
+    		Thread.sleep(1000);
+    	}
+    }
+    
+}
\ No newline at end of file



Mime
View raw message