]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1353] Build number is always 1 for SNAPSHOT artifacts uploaded via web upload...
authorMaria Odea B. Ching <oching@apache.org>
Sat, 1 May 2010 08:13:00 +0000 (08:13 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Sat, 1 May 2010 08:13:00 +0000 (08:13 +0000)
o added selenium test

git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@939944 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java

index a82a8f5849256e24457a9eb8b5ffd39d1aa5e416..7d9c27f94c6547c7e90c9f862f348a6ab278a978 100644 (file)
@@ -22,6 +22,7 @@ package org.apache.archiva.web.test;
 import java.io.File;
 
 import org.apache.archiva.web.test.parent.AbstractBrowseTest;
+import org.testng.Assert;
 import org.testng.annotations.Test;
 
 @Test( groups = { "browse" }, dependsOnMethods = { "testAddArtifactNullValues" } )
@@ -83,6 +84,43 @@ public class BrowseTest
         assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "continuum", "continuum-core", "1.0-SNAPSHOT", "jar" );
     }
 
+    // MRM-1353
+    @Test( groups = { "requiresUpload" } )
+    public void testBuildNumberOfSnapshotArtifact()
+    {
+        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-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo );
+        assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '"
+            + snapshotsRepo + "'" );
+
+        goToBrowsePage();
+        assertBrowsePage();
+        assertGroupsPage( "archiva/" );
+        assertArtifactsPage( "archiva-multiple-artifacts/" );
+        assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar" );
+
+
+        addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo );
+        assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '"
+            + snapshotsRepo + "'" );
+
+        goToBrowsePage();
+        assertBrowsePage();
+        assertGroupsPage( "archiva/" );
+        assertArtifactsPage( "archiva-multiple-artifacts/" );
+        assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar" );
+
+        String firstSnapshotVersion = getText( "//div[@id='tabArea']/table[@class='infoTable']/tbody/tr[6]/td/a[1]" );
+        Assert.assertTrue( firstSnapshotVersion.endsWith( "-1" ) );
+
+        String secondSnapshotVersion = getText( "//div[@id='tabArea']/table[@class='infoTable']/tbody/tr[6]/td/a[2]" );
+        Assert.assertTrue( secondSnapshotVersion.endsWith( "-2" ) );
+    }
+
     private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId,
                                          String artifactInfoArtifactId, String artifactInfoVersion, String artifactInfoPackaging )
     {
index d4d090a5bfae8a7337294e410d4152478911dd6b..888e89c4141572ef086d4234b3750c167d21c8b0 100644 (file)
@@ -152,6 +152,11 @@ public abstract class AbstractSeleniumTest {
        {
            return getSelenium().getHtmlSource();
        }
+
+    public String getText( String locator )
+    {
+        return getSelenium().getText( locator );
+    }
        
        public void assertTextPresent( String text )
        {