You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@archiva.apache.org by br...@apache.org on 2010/02/12 14:47:29 UTC

svn commit: r909410 - in /archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test: ./ src/test/testng/config/ src/test/testng/org/apache/archiva/web/test/ src/test/testng/org/apache/archiva/web/test/listener/ src/test/testng/org/apache/archiva/we...

Author: brett
Date: Fri Feb 12 13:47:29 2010
New Revision: 909410

URL: http://svn.apache.org/viewvc?rev=909410&view=rev
Log:
merge -r909353:909402 from MRM-1025 branch, fixes for Selenium tests

Removed:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/
Modified:
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/   (props changed)
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
    archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java

Propchange: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Fri Feb 12 13:47:29 2010
@@ -0,0 +1,5 @@
+/archiva/branches/MRM-1025/archiva-modules/archiva-web/archiva-webapp-test:882046,882457,884741,885313-885314,892686,909354-909403
+/archiva/branches/MRM-541/archiva-modules/archiva-web/archiva-webapp-test:686983-687034
+/archiva/branches/archiva-search-improvements/archiva-modules/archiva-web/archiva-webapp-test:723609-726925
+/archiva/branches/archiva-struts2/archiva-modules/archiva-web/archiva-webapp-test:699795-705848
+/archiva/tags/archiva-1.3/archiva-modules/archiva-web/archiva-webapp-test:898632

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/pom.xml
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/pom.xml?rev=909410&r1=909409&r2=909410&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/pom.xml (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/pom.xml Fri Feb 12 13:47:29 2010
@@ -148,9 +148,20 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
-          <suiteXmlFiles>
-            <suiteXmlFile>src/test/testng/config/testng.xml</suiteXmlFile>
-          </suiteXmlFiles>
+          <properties>
+            <!--
+              Use this instead of suiteXmlFiles so that we can add the exclusion, as it is only accepted without suiteXmlFiles
+            -->
+            <property>
+              <name>listener</name>
+              <value>org.apache.archiva.web.test.listener.CaptureScreenShotsListener</value>
+            </property>
+            <property>
+              <name>excludegroups</name>
+              <!-- Exclude on all browsers but Firefox, as it is the only one that Selenium supports file uploads on -->
+              <value>${excluded.groups}</value>
+            </property>
+          </properties>
         </configuration>
         <executions>
           <execution>
@@ -165,7 +176,7 @@
                   <name>browser</name>
                   <value>${selenium.browser}</value>
                 </property>
-		<property>
+		            <property>
                   <name>baseUrl</name>
                   <value>${baseUrl}</value>
                 </property>
@@ -404,6 +415,7 @@
       </activation>
       <properties>
         <selenium.browser>*firefox</selenium.browser>
+        <excluded.groups />
       </properties>
     </profile>
     <profile>
@@ -416,6 +428,7 @@
       </activation>
       <properties>
         <selenium.browser>*iexplore</selenium.browser>
+        <excluded.groups>requiresUpload</excluded.groups>
       </properties>
     </profile>
     <profile>
@@ -428,6 +441,7 @@
       </activation>
       <properties>
         <selenium.browser>*safari</selenium.browser>
+        <excluded.groups>requiresUpload</excluded.groups>
       </properties>
     </profile>
     <profile>
@@ -440,6 +454,7 @@
       </activation>
       <properties>
         <selenium.browser>*custom ${browserPath}</selenium.browser>
+        <excluded.groups>requiresUpload</excluded.groups>
       </properties>
     </profile>
     <profile>

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java?rev=909410&r1=909409&r2=909410&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java Fri Feb 12 13:47:29 2010
@@ -83,24 +83,22 @@
 		assertTextPresent( "Please add a file to upload." );
 	}
 	
-    @Test( enabled = false )
+    @Test(groups = "requiresUpload")
 	public void testAddArtifactValidValues()
 	{
-		// TODO: disable test on non *chrome browsers, there is no way to do file uploads (SEL-63)
 		addArtifact( getGroupId() , "testAddArtifactValidValues", getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
-		assertTextPresent( "Artifact 'test:test:1.0' was successfully deployed to repository 'internal'" );
+		assertTextPresent( "Artifact 'test:testAddArtifactValidValues:1.0' was successfully deployed to repository 'internal'" );
 	}
 		
 	//MRM-747
-    @Test( enabled = false )
+    @Test(groups = "requiresUpload")
 	public void testAddArtifactBlockRedeployments()
 	{
-            // TODO: disable test on non *chrome browsers, there is no way to do file uploads (SEL-63)
             addArtifact( getGroupId() , getArtifactId(), getVersion(), getPackaging() , getArtifactFilePath(), getRepositoryId() );
             assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
 	}
 	
-    @Test( enabled = false )
+    @Test(groups = "requiresUpload")
 	public void testDeleteArtifact()
 	{
 		//prep

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java?rev=909410&r1=909409&r2=909410&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java Fri Feb 12 13:47:29 2010
@@ -68,8 +68,7 @@
     }    
     
     // TODO: add test for adding via WebDAV
-    // TODO: disable if not running on *chrome
-    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, enabled = false )
+    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, groups = "requiresUpload")
     public void testViewAuditLogsDataFound()
     {
         goToAuditLogReports();        
@@ -89,8 +88,7 @@
     }
     
     // TODO: add test for adding via WebDAV
-    // TODO: disable if not running on *chrome
-    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, enabled = false )
+    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, groups = "requiresUpload")
     public void testViewAuditLogsOnlyArtifactIdIsSpecified()
     {
         goToAuditLogReports();        
@@ -110,8 +108,7 @@
     }
     
     // TODO: add test for adding via WebDAV
-    // TODO: disable if not running on *chrome
-    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, enabled = false )
+    @Test (dependsOnMethods = { "testAddArtifactValidValues" }, groups = "requiresUpload")
     public void testViewAuditLogsForAllRepositories()
     {
         goToAuditLogReports();        
@@ -129,7 +126,7 @@
         assertTextPresent( "admin" );
     }
     
-    @Test (dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" }, enabled = false )
+    @Test (dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" }, groups = "requiresUpload")
     public void testViewAuditLogsViewAuditEventsForManageableRepositoriesOnly()
     {
         String groupId = getProperty( "SNAPSHOT_GROUPID" );

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java?rev=909410&r1=909409&r2=909410&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java Fri Feb 12 13:47:29 2010
@@ -45,13 +45,9 @@
 	}
 
     // MRM-1278
-    @Test( enabled = false )
+    @Test(groups = {"requiresUpload"})
     public void testCorrectRepositoryInBrowse()
     {
-        File artifact =
-            new File( getBasedir(),
-                      "/src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar" );                     
-                
         String releasesRepo = getProperty( "RELEASES_REPOSITORY" );
         
         // create releases repository first
@@ -64,10 +60,10 @@
         
         String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" );
 
+        String path = "src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
         // TODO: do this differently as uploading doesn't work on browsers other than *chrome (below as well)
         // upload a snapshot artifact to repository 'releases'        
-        addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", artifact.getPath(),
-                     releasesRepo );
+        addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", path, releasesRepo );
         assertTextPresent( "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '" + releasesRepo + "'" );
 
         goToBrowsePage();
@@ -77,8 +73,7 @@
         assertArtifactInfoPage( "1.0-SNAPSHOT/", releasesRepo, "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar" );
 
         // upload a snapshot artifact to repository 'snapshots'        
-        addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", artifact.getPath(),
-                     snapshotsRepo );
+        addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", path, snapshotsRepo );
         assertTextPresent( "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '" + snapshotsRepo + "'" );
 
         goToBrowsePage();

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java?rev=909410&r1=909409&r2=909410&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java Fri Feb 12 13:47:29 2010
@@ -75,7 +75,7 @@
         {
             selenium.windowMaximize();
             File fileName = new File( targetPath, fileBaseName + ".png" );
-            selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "" );
+            selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" );
         }
         catch ( RuntimeException e )
         {

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java?rev=909410&r1=909409&r2=909410&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java Fri Feb 12 13:47:29 2010
@@ -1,6 +1,7 @@
 package org.apache.archiva.web.test.parent;
 
 import java.io.File;
+import java.io.IOException;
 
 import org.apache.archiva.web.test.XPathExpressionUtil;
 
@@ -495,7 +496,25 @@
             checkField( "generatePom" );
         }
 
-        setFieldValue( "artifact", artifactFilePath );
+        String path;
+        if ( artifactFilePath != null && artifactFilePath.trim().length() > 0 )
+        {
+            File f = new File( artifactFilePath );
+            try
+            {
+                path = f.getCanonicalPath();
+            }
+            catch ( IOException e )
+            {
+                path = f.getAbsolutePath();
+            }
+        }
+        else
+        {
+            path = artifactFilePath;
+        }
+
+        setFieldValue( "artifact", path );
         setFieldValue( "repositoryId", repositoryId );
 
         clickButtonWithValue( "Submit" );

Modified: archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java
URL: http://svn.apache.org/viewvc/archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java?rev=909410&r1=909409&r2=909410&view=diff
==============================================================================
--- archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java (original)
+++ archiva/trunk/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java Fri Feb 12 13:47:29 2010
@@ -1,8 +1,6 @@
 package org.apache.archiva.web.test.parent;
 
-import java.io.File;
-
-public abstract class AbstractArtifactManagementTest 
+public abstract class AbstractArtifactManagementTest
 	extends AbstractArchivaTest
 {
 	
@@ -32,9 +30,7 @@
 	
 	public String getArtifactFilePath()
 	{
-		File f = new File( "" );
-		String artifactFilePath = f.getAbsolutePath();
-		return artifactFilePath + "/src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar" ;
+		return "src/test/it-resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar";
 	}
 	
 	public String getRepositoryId()