[MRM-1353] Build number is always 1 for SNAPSHOT artifacts uploaded via web upload form

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
This commit is contained in:
Maria Odea B. Ching 2010-05-01 08:13:00 +00:00
parent d06b48b52d
commit 90a86e31c1
2 changed files with 43 additions and 0 deletions

View 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 )
{

View 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 )
{