From: Brett Porter Date: Fri, 12 Feb 2010 13:47:29 +0000 (+0000) Subject: merge -r909353:909402 from MRM-1025 branch, fixes for Selenium tests X-Git-Tag: archiva-1.4-M1~1023 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=e295629858e7efeafac0a92ecea1958b963f9aad;p=archiva.git merge -r909353:909402 from MRM-1025 branch, fixes for Selenium tests git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@909410 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml index 060823d68..a1548bb1d 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/pom.xml +++ b/archiva-modules/archiva-web/archiva-webapp-test/pom.xml @@ -148,9 +148,20 @@ org.apache.maven.plugins maven-surefire-plugin - - src/test/testng/config/testng.xml - + + + + listener + org.apache.archiva.web.test.listener.CaptureScreenShotsListener + + + excludegroups + + ${excluded.groups} + + @@ -165,7 +176,7 @@ browser ${selenium.browser} - + baseUrl ${baseUrl} @@ -404,6 +415,7 @@ *firefox + @@ -416,6 +428,7 @@ *iexplore + requiresUpload @@ -428,6 +441,7 @@ *safari + requiresUpload @@ -440,6 +454,7 @@ *custom ${browserPath} + requiresUpload diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml deleted file mode 100644 index e8607fb3b..000000000 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/config/testng.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java index 1f60076bc..4eb22b172 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/ArtifactManagementTest.java @@ -83,24 +83,22 @@ public class ArtifactManagementTest 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 diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java index 0f3dcc6c4..2b5e4abd9 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java @@ -68,8 +68,7 @@ public class AuditLogsReportTest } // 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 @@ public class AuditLogsReportTest } // 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 @@ public class AuditLogsReportTest } // 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 @@ public class AuditLogsReportTest assertTextPresent( "admin" ); } - @Test (dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" }, enabled = false ) + @Test (dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" }, groups = "requiresUpload") public void testViewAuditLogsViewAuditEventsForManageableRepositoriesOnly() { String groupId = getProperty( "SNAPSHOT_GROUPID" ); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java index c9c60ecce..a82a8f584 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java @@ -45,13 +45,9 @@ public class BrowseTest } // 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 @@ public class BrowseTest 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 @@ public class BrowseTest 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(); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java index 947d7cbf3..8ee826394 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/listener/CaptureScreenShotsListener.java @@ -75,7 +75,7 @@ public class CaptureScreenShotsListener { selenium.windowMaximize(); File fileName = new File( targetPath, fileBaseName + ".png" ); - selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "" ); + selenium.captureEntirePageScreenshot( fileName.getAbsolutePath(), "background=#FFFFFF" ); } catch ( RuntimeException e ) { diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java index 9209d6f60..11e7d084c 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java @@ -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 @@ public abstract class AbstractArchivaTest 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" ); diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java index cf03765b0..29486cd10 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java @@ -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 abstract class AbstractArtifactManagementTest 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()