o added selenium test that uploads SNAPSHOT artifacts in releases and snapshots repositories and checks artifact info page for correct artifact information o refactored upload artifact methos in AbstractManagementTest, moved them over to AbstractArchivaTest to avoid repetition in other tests that uses it git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@882399 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.3
@@ -95,3 +95,7 @@ NETWORKPROXY_HOSTNAME= | |||
NETWORKPROXY_PORT=8080 | |||
NETWORKPROXY_USERNAME=admin | |||
NETWORKPROXY_PASSWORD=admin123 | |||
# Browse - MRM-1278 test | |||
SNAPSHOTS_REPOSITORY=snapshots | |||
RELEASES_REPOSITORY=releases |
@@ -19,6 +19,8 @@ package org.apache.archiva.web.test; | |||
* under the License. | |||
*/ | |||
import java.io.File; | |||
import org.apache.archiva.web.test.parent.AbstractBrowseTest; | |||
import org.testng.annotations.Test; | |||
@@ -42,4 +44,72 @@ public class BrowseTest | |||
assertTextPresent( "Artifacts" ); | |||
} | |||
// MRM-1278 | |||
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" ); | |||
//"src/test/it-resources/foo-bar-1.0-20091110.181459-4.jar" ); | |||
String releasesRepo = getProperty( "RELEASES_REPOSITORY" ); | |||
// create releases repository first | |||
goToRepositoriesPage(); | |||
clickLinkWithText( "Add" ); | |||
addManagedRepository( getProperty( "RELEASES_REPOSITORY" ), "Releases Repository", | |||
new File( getBasedir(), "target/repository/releases" ).getPath(), "", "Maven 2.x Repository", | |||
"0 0 * * * ?", "", "" ); | |||
assertTextPresent( "Releases Repository" ); | |||
String snapshotsRepo = getProperty( "SNAPSHOTS_REPOSITORY" ); | |||
// upload a snapshot artifact to repository 'releases' | |||
addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", artifact.getPath(), | |||
releasesRepo ); | |||
assertTextPresent( "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '" + releasesRepo + "'" ); | |||
goToBrowsePage(); | |||
assertBrowsePage(); | |||
assertGroupsPage( "archiva/" ); | |||
assertArtifactsPage( "archiva-webapp/" ); | |||
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 ); | |||
assertTextPresent( "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '" + snapshotsRepo + "'" ); | |||
goToBrowsePage(); | |||
assertBrowsePage(); | |||
assertGroupsPage( "continuum/" ); | |||
assertArtifactsPage( "continuum-core/" ); | |||
assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "continuum", "continuum-core", "1.0-SNAPSHOT", "jar" ); | |||
} | |||
private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId, | |||
String artifactInfoArtifactId, String artifactInfoVersion, String artifactInfoPackaging ) | |||
{ | |||
clickLinkWithText( version ); | |||
assertPage( "Apache Archiva \\ Browse Repository" ); | |||
assertTextPresent( artifactInfoRepositoryId ); | |||
assertTextPresent( artifactInfoGroupId ); | |||
assertTextPresent( artifactInfoArtifactId ); | |||
assertTextPresent( artifactInfoVersion ); | |||
assertTextPresent( artifactInfoPackaging ); | |||
} | |||
private void assertArtifactsPage( String artifactId ) | |||
{ | |||
clickLinkWithText( artifactId ); | |||
assertPage( "Apache Archiva \\ Browse Repository" ); | |||
assertTextPresent( "Versions" ); | |||
} | |||
private void assertGroupsPage( String groupId ) | |||
{ | |||
clickLinkWithText( groupId ); | |||
assertPage( "Apache Archiva \\ Browse Repository" ); | |||
assertTextPresent( "Artifacts" ); | |||
} | |||
} |
@@ -30,18 +30,18 @@ public class RepositoryTest | |||
public void testAddManagedRepoValidValues() | |||
{ | |||
goToRepositoriesPage(); | |||
clickLinkWithText( "Add" ); | |||
clickLinkWithLocator( "//div[@id='contentArea']/div/div/a[@href='/archiva/admin/addRepository.action']" ); | |||
addManagedRepository( "managedrepo1", "Managed Repository Sample 1" , getRepositoryDir() + "repository/" , "", "Maven 2.x Repository", "0 0 * * * ?", "", "" ); | |||
clickButtonWithValue( "Save" ); | |||
assertTextPresent( "Managed Repository Sample 1" ); | |||
assertTextPresent( "Managed Repository Sample 1" ); | |||
assertRepositoriesPage(); | |||
} | |||
@Test(dependsOnMethods = { "testAddManagedRepoValidValues" } ) | |||
public void testAddManagedRepoInvalidValues() | |||
{ | |||
//goToRepositoriesPage(); | |||
clickLinkWithText( "Add" ); | |||
{ | |||
assertRepositoriesPage(); | |||
clickLinkWithLocator( "//div[@id='contentArea']/div/div/a[@href='/archiva/admin/addRepository.action']" ); | |||
addManagedRepository( "", "" , "" , "", "Maven 2.x Repository", "", "", "" ); | |||
assertTextPresent( "You must enter a repository identifier." ); | |||
assertTextPresent( "You must enter a repository name." ); | |||
@@ -51,8 +51,7 @@ public class RepositoryTest | |||
@Test(dependsOnMethods = { "testAddManagedRepoInvalidValues" } ) | |||
public void testAddManagedRepoNoIdentifier() | |||
{ | |||
//goToRepositoriesPage(); | |||
{ | |||
addManagedRepository( "", "name" , "/home" , "/.index", "Maven 2.x Repository", "0 0 * * * ?", "", "" ); | |||
assertTextPresent( "You must enter a repository identifier." ); | |||
} | |||
@@ -104,11 +103,10 @@ public class RepositoryTest | |||
//assertTextNotPresent( "managedrepo" ); | |||
} | |||
@Test(dependsOnMethods = { "testAddManagedRepoValidValues" } ) | |||
@Test(dependsOnMethods = { "testAddRemoteRepoValidValues" } ) | |||
public void testAddRemoteRepoNullValues() | |||
{ | |||
//goToRepositoriesPage(); | |||
clickLinkWithLocator( "//div[@id='contentArea']/div/div[5]/a" ); | |||
{ | |||
clickLinkWithLocator( "//div[@id='contentArea']/div/div/a[@href='/archiva/admin/addRemoteRepository.action']" ); | |||
addRemoteRepository( "" , "" , "" , "" , "" , "" , "Maven 2.x Repository" ); | |||
assertTextPresent( "You must enter a repository identifier." ); | |||
assertTextPresent( "You must enter a repository name." ); | |||
@@ -136,11 +134,10 @@ public class RepositoryTest | |||
assertTextPresent( "You must enter a url." ); | |||
} | |||
@Test(dependsOnMethods = { "testAddManagedRepoValidValues" } ) | |||
@Test(dependsOnMethods = { "testDeleteManageRepo" } ) | |||
public void testAddRemoteRepoValidValues() | |||
{ | |||
goToRepositoriesPage(); | |||
clickLinkWithLocator( "//div[@id='contentArea']/div/div[5]/a" ); | |||
{ | |||
clickLinkWithLocator( "//div[@id='contentArea']/div/div/a[@href='/archiva/admin/addRemoteRepository.action']" ); | |||
addRemoteRepository( "remoterepo" , "Remote Repository Sample" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" ); | |||
assertTextPresent( "Remote Repository Sample" ); | |||
} |
@@ -40,7 +40,7 @@ public class VirtualRepositoryTest | |||
assertTextPresent( "testing" ); | |||
} | |||
//@Test(dependsOnMethods = { "testAddRepositoryValidValue" } ) | |||
@Test(dependsOnMethods = { "testAddRepositoryGroupValidValue" } ) | |||
public void testAddRepositoryToRepositoryGroup() | |||
{ | |||
addRepositoryToRepositoryGroup( "testing", "internal" ); | |||
@@ -51,15 +51,17 @@ public class VirtualRepositoryTest | |||
@Test(dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } ) | |||
public void testDeleteRepositoryOfRepositoryGroup() | |||
{ | |||
{ | |||
deleteRepositoryInRepositoryGroups(); | |||
assertTextPresent( "Repository Groups" ); | |||
assertTextNotPresent( "No Repository Groups Defined." ); | |||
waitPage(); | |||
} | |||
@Test(dependsOnMethods = { "testDeleteRepositoryOfRepositoryGroup" } ) | |||
public void testDeleteRepositoryGroup() | |||
{ | |||
{ | |||
assertRepositoryGroupsPage(); | |||
deleteRepositoryGroup( "testing" ); | |||
assertTextPresent( "No Repository Groups Defined." ); | |||
} |
@@ -449,25 +449,86 @@ public abstract class AbstractArchivaTest | |||
setFieldValue( "organisationLogo" , logoUrl ); | |||
clickButtonWithValue( "Save" ); | |||
} | |||
//Upload Artifact | |||
public void goToUploadArtifactPage() | |||
{ | |||
clickLinkWithText( "Upload Artifact" ); | |||
assertUploadArtifactPage(); | |||
} | |||
public void assertUploadArtifactPage() | |||
{ | |||
//assertPage( "Apache Archiva \\ Upload Artifact" ); | |||
String uploadArtifact = "Upload Artifact,Group Id*,Artifact Id*,Version*,Packaging*,Classifier,Generate Maven 2 POM,Artifact File*,POM File,Repository Id"; | |||
String[] arrayUploadArtifact = uploadArtifact.split( "," ); | |||
for ( String uploadartifact : arrayUploadArtifact ) | |||
assertTextPresent( uploadartifact ); | |||
String uploadElements = "groupId,artifactId,version,packaging,classifier,generatePom,artifact,pom,repositoryId"; | |||
String[] arrayUploadElements = uploadElements.split( "," ); | |||
for ( String uploadelements : arrayUploadElements ) | |||
assertElementPresent( uploadelements ); | |||
assertButtonWithValuePresent( "Submit" ); | |||
} | |||
// Upload Artifact | |||
public void goToAddArtifactPage() | |||
{ | |||
clickLinkWithText( "Upload Artifact" ); | |||
assertAddArtifactPage(); | |||
} | |||
public void assertAddArtifactPage() | |||
{ | |||
assertPage( "Apache Archiva \\ Upload Artifact" ); | |||
assertTextPresent( "Upload Artifact" ); | |||
String artifact = | |||
"Upload Artifact,Group Id*:,Artifact Id*:,Version*:,Packaging*:,Classifier:,Generate Maven 2 POM,Artifact File*:,POM File:,Repository Id:"; | |||
String[] arrayArtifact = artifact.split( "," ); | |||
for ( String arrayartifact : arrayArtifact ) | |||
assertTextPresent( arrayartifact ); | |||
String artifactElements = | |||
"upload_groupId,upload_artifactId,upload_version,upload_packaging,upload_classifier,upload_generatePom,upload_artifact,upload_pom,upload_repositoryId,upload_0"; | |||
String[] arrayArtifactElements = artifactElements.split( "," ); | |||
for ( String artifactelements : arrayArtifactElements ) | |||
assertElementPresent( artifactelements ); | |||
} | |||
public void addArtifact( String groupId, String artifactId, String version, String packaging, | |||
String artifactFilePath, String repositoryId ) | |||
{ | |||
addArtifact( groupId, artifactId, version, packaging, true, artifactFilePath, repositoryId ); | |||
} | |||
public void addArtifact( String groupId, String artifactId, String version, String packaging, boolean generatePom, | |||
String artifactFilePath, String repositoryId ) | |||
{ | |||
goToAddArtifactPage(); | |||
setFieldValue( "groupId", groupId ); | |||
setFieldValue( "artifactId", artifactId ); | |||
setFieldValue( "version", version ); | |||
setFieldValue( "packaging", packaging ); | |||
if ( generatePom ) | |||
{ | |||
checkField( "generatePom" ); | |||
} | |||
setFieldValue( "artifact", artifactFilePath ); | |||
setFieldValue( "repositoryId", repositoryId ); | |||
clickButtonWithValue( "Submit" ); | |||
} | |||
public void goToRepositoriesPage() | |||
{ | |||
clickLinkWithText( "Repositories" ); | |||
assertRepositoriesPage(); | |||
} | |||
public void assertRepositoriesPage() | |||
{ | |||
assertPage( "Apache Archiva \\ Administration - Repositories" ); | |||
assertTextPresent( "Administration - Repositories" ); | |||
assertTextPresent( "Managed Repositories" ); | |||
assertTextPresent( "Remote Repositories" ); | |||
} | |||
public void addManagedRepository( String identifier, String name, String directory, String indexDirectory, String type, String cron, | |||
String daysOlder, String retentionCount ) | |||
{ | |||
//goToRepositoriesPage(); | |||
//clickLinkWithText( "Add" ); | |||
setFieldValue( "repository.id" , identifier ); | |||
setFieldValue( "repository.name" , name ); | |||
setFieldValue( "repository.location" , directory ); | |||
setFieldValue( "repository.indexDir" , indexDirectory ); | |||
selectValue( "repository.layout", type ); | |||
setFieldValue( "repository.refreshCronExpression" , cron ); | |||
setFieldValue( "repository.daysOlder" , daysOlder ); | |||
setFieldValue( "repository.retentionCount" , retentionCount ); | |||
//TODO | |||
clickButtonWithValue( "Add Repository" ); | |||
} | |||
} |
@@ -43,42 +43,12 @@ public abstract class AbstractArtifactManagementTest | |||
return repositoryId; | |||
} | |||
public void goToAddArtifactPage() | |||
{ | |||
clickLinkWithText( "Upload Artifact" ); | |||
assertAddArtifactPage(); | |||
} | |||
public void goToDeleteArtifactPage() | |||
{ | |||
clickLinkWithText( "Delete Artifact" ); | |||
assertDeleteArtifactPage(); | |||
} | |||
public void addArtifact( String groupId, String artifactId, String version, String packaging, String artifactFilePath, String repositoryId ) | |||
{ | |||
addArtifact(groupId, artifactId, version, packaging, true, artifactFilePath, repositoryId); | |||
} | |||
public void addArtifact( String groupId, String artifactId, String version, String packaging, boolean generatePom, String artifactFilePath, String repositoryId) | |||
{ | |||
goToAddArtifactPage(); | |||
setFieldValue( "groupId" , groupId ); | |||
setFieldValue( "artifactId" , artifactId ); | |||
setFieldValue( "version" , version ); | |||
setFieldValue( "packaging" , packaging ); | |||
if ( generatePom ) | |||
{ | |||
checkField( "generatePom" ); | |||
} | |||
setFieldValue( "artifact" , artifactFilePath ); | |||
setFieldValue( "repositoryId" , repositoryId ); | |||
clickButtonWithValue( "Submit" ); | |||
} | |||
public void deleteArtifact( String groupId, String artifactId, String version, String repositoryId ) | |||
{ | |||
goToDeleteArtifactPage(); | |||
@@ -89,22 +59,6 @@ public abstract class AbstractArtifactManagementTest | |||
clickButtonWithValue( "Submit" ) ; | |||
} | |||
public void assertAddArtifactPage() | |||
{ | |||
assertPage( "Apache Archiva \\ Upload Artifact" ); | |||
assertTextPresent( "Upload Artifact" ); | |||
String artifact = "Upload Artifact,Group Id*:,Artifact Id*:,Version*:,Packaging*:,Classifier:,Generate Maven 2 POM,Artifact File*:,POM File:,Repository Id:"; | |||
String[] arrayArtifact = artifact.split( "," ); | |||
for ( String arrayartifact : arrayArtifact ) | |||
assertTextPresent( arrayartifact ); | |||
String artifactElements = "upload_groupId,upload_artifactId,upload_version,upload_packaging,upload_classifier,upload_generatePom,upload_artifact,upload_pom,upload_repositoryId,upload_0"; | |||
String[] arrayArtifactElements = artifactElements.split( "," ); | |||
for ( String artifactelements : arrayArtifactElements ) | |||
assertElementPresent( artifactelements ); | |||
} | |||
public void assertDeleteArtifactPage() | |||
{ | |||
assertPage( "Apache Archiva \\ Delete Artifact" ); |
@@ -212,23 +212,6 @@ public abstract class AbstractRepositoryTest | |||
clickButtonWithValue( "Delete" ); | |||
} | |||
/////////////////////////////// | |||
// repositories | |||
/////////////////////////////// | |||
public void goToRepositoriesPage() | |||
{ | |||
clickLinkWithText( "Repositories" ); | |||
assertRepositoriesPage(); | |||
} | |||
public void assertRepositoriesPage() | |||
{ | |||
assertPage( "Apache Archiva \\ Administration - Repositories" ); | |||
assertTextPresent( "Administration - Repositories" ); | |||
assertTextPresent( "Managed Repositories" ); | |||
assertTextPresent( "Remote Repositories" ); | |||
} | |||
// remote repositories | |||
public void assertAddRemoteRepository() | |||
{ | |||
@@ -283,23 +266,6 @@ public abstract class AbstractRepositoryTest | |||
clickButtonWithValue( "Update Repository" ); | |||
} | |||
// managed repositories | |||
public void addManagedRepository( String identifier, String name, String directory, String indexDirectory, String type, String cron, String daysOlder, String retentionCount ) | |||
{ | |||
//goToRepositoriesPage(); | |||
//clickLinkWithText( "Add" ); | |||
setFieldValue( "repository.id" , identifier ); | |||
setFieldValue( "repository.name" , name ); | |||
setFieldValue( "repository.location" , directory ); | |||
setFieldValue( "repository.indexDir" , indexDirectory ); | |||
selectValue( "repository.layout", type ); | |||
setFieldValue( "repository.refreshCronExpression" , cron ); | |||
setFieldValue( "repository.daysOlder" , daysOlder ); | |||
setFieldValue( "repository.retentionCount" , retentionCount ); | |||
//TODO | |||
clickButtonWithValue( "Add Repository" ); | |||
} | |||
public void editManagedRepository( String fieldName, String value ) | |||
{ | |||
//goToRepositoriesPage(); |