for some tests which are only javascript validation : no need to wait the response: improve tests speed

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1172552 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-19 10:09:31 +00:00
parent 4ff75a4b90
commit b296aef2e4
6 changed files with 100 additions and 83 deletions

View File

@ -27,7 +27,7 @@ public class ArtifactManagementTest
extends AbstractArtifactManagementTest extends AbstractArtifactManagementTest
{ {
@Test( alwaysRun = true, dependsOnGroups = "about") @Test( alwaysRun = true, dependsOnGroups = "about" )
public void testAddArtifactNullValues() public void testAddArtifactNullValues()
{ {
goToAddArtifactPage(); goToAddArtifactPage();
@ -43,7 +43,8 @@ public class ArtifactManagementTest
@Test( dependsOnMethods = { "testAddArtifactNullValues" }, alwaysRun = true ) @Test( dependsOnMethods = { "testAddArtifactNullValues" }, alwaysRun = true )
public void testAddArtifactNoGroupId() public void testAddArtifactNoGroupId()
{ {
addArtifact( " ", getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() ); addArtifact( " ", getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId(),
false );
assertTextPresent( "You must enter a groupId." ); assertTextPresent( "You must enter a groupId." );
} }
@ -51,35 +52,38 @@ public class ArtifactManagementTest
public void testAddArtifactNoArtifactId() public void testAddArtifactNoArtifactId()
{ {
addArtifact( getGroupId(), " ", getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() ); addArtifact( getGroupId(), " ", getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId(), false );
assertTextPresent( "You must enter an artifactId." ); assertTextPresent( "You must enter an artifactId." );
} }
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true ) @Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
public void testAddArtifactNoVersion() public void testAddArtifactNoVersion()
{ {
addArtifact( getGroupId(), getArtifactId(), " ", getPackaging(), getArtifactFilePath(), getRepositoryId() ); addArtifact( getGroupId(), getArtifactId(), " ", getPackaging(), getArtifactFilePath(), getRepositoryId(),
false );
assertTextPresent( "You must enter a version." ); assertTextPresent( "You must enter a version." );
} }
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true ) @Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
public void testAddArtifactInvalidVersion() public void testAddArtifactInvalidVersion()
{ {
addArtifact( getGroupId(), getArtifactId(), "asdf", getPackaging(), getArtifactFilePath(), getRepositoryId() ); addArtifact( getGroupId(), getArtifactId(), "asdf", getPackaging(), getArtifactFilePath(), getRepositoryId(),
true );
assertTextPresent( "Invalid version." ); assertTextPresent( "Invalid version." );
} }
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true ) @Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
public void testAddArtifactNoPackaging() public void testAddArtifactNoPackaging()
{ {
addArtifact( getGroupId(), getArtifactId(), getVersion(), " ", getArtifactFilePath(), getRepositoryId() ); addArtifact( getGroupId(), getArtifactId(), getVersion(), " ", getArtifactFilePath(), getRepositoryId(),
false );
assertTextPresent( "You must enter a packaging." ); assertTextPresent( "You must enter a packaging." );
} }
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true ) @Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
public void testAddArtifactNoFilePath() public void testAddArtifactNoFilePath()
{ {
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), " ", getRepositoryId() ); addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), " ", getRepositoryId(), false );
assertTextPresent( "Please add a file to upload." ); assertTextPresent( "Please add a file to upload." );
} }
@ -89,7 +93,8 @@ public class ArtifactManagementTest
String groupId = getProperty( "VALIDARTIFACT_GROUPID" ); String groupId = getProperty( "VALIDARTIFACT_GROUPID" );
String artifactId = getProperty( "VALIDARTIFACT_ARTIFACTID" ); String artifactId = getProperty( "VALIDARTIFACT_ARTIFACTID" );
addArtifact( groupId, artifactId, getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() ); addArtifact( groupId, artifactId, getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId(),
true );
assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion() assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion()
+ "' was successfully deployed to repository 'internal'" ); + "' was successfully deployed to repository 'internal'" );
} }
@ -101,7 +106,7 @@ public class ArtifactManagementTest
String artifactId = getProperty( "ARTIFACTID_DOTNETARTIFACT" ); String artifactId = getProperty( "ARTIFACTID_DOTNETARTIFACT" );
String packaging = getProperty( "PACKAGING_DOTNETARTIFACT" ); String packaging = getProperty( "PACKAGING_DOTNETARTIFACT" );
addArtifact( groupId, artifactId, getVersion(), packaging, getArtifactFilePath(), getRepositoryId() ); addArtifact( groupId, artifactId, getVersion(), packaging, getArtifactFilePath(), getRepositoryId(), false );
assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion() assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + getVersion()
+ "' was successfully deployed to repository 'internal'" ); + "' was successfully deployed to repository 'internal'" );
getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() ); getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() );
@ -121,7 +126,7 @@ public class ArtifactManagementTest
public void testAddArtifactBlockRedeployments() public void testAddArtifactBlockRedeployments()
{ {
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(), addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(),
getRepositoryId() ); getRepositoryId(), false );
assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." ); assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
} }
@ -135,7 +140,7 @@ public class ArtifactManagementTest
String packaging = getProperty( "PACKAGING1" ); String packaging = getProperty( "PACKAGING1" );
String repositoryId = getProperty( "REPOSITORYID1" ); String repositoryId = getProperty( "REPOSITORYID1" );
// TODO: do this differently as it only works in Firefox's chrome mode // TODO: do this differently as it only works in Firefox's chrome mode
addArtifact( groupId, artifactId, version, packaging, getArtifactFilePath(), repositoryId ); addArtifact( groupId, artifactId, version, packaging, getArtifactFilePath(), repositoryId, false );
assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deployed to repository 'internal'" ); assertTextPresent( "Artifact 'delete:delete:1.0' was successfully deployed to repository 'internal'" );
deleteArtifact( "delete", "delete", "1.0", "internal" ); deleteArtifact( "delete", "delete", "1.0", "internal" );
@ -176,13 +181,15 @@ public class ArtifactManagementTest
public void testDeleteArtifactInvalidValues() public void testDeleteArtifactInvalidValues()
{ {
deleteArtifact( "<> \\/~+[ ]'\"", "<> \\/~+[ ]'\"", "<>", "internal" ); deleteArtifact( "<> \\/~+[ ]'\"", "<> \\/~+[ ]'\"", "<>", "internal" );
assertTextPresent( "Invalid version." );
assertTextPresent( assertTextPresent(
"Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); "Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
assertTextPresent( assertTextPresent(
"Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." ); "Artifact id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
// as it's a validation on server side it's not available here but tested in testDeleteArtifactInvalidVersion
//assertTextPresent( "Invalid version." );
} }
@Test( alwaysRun = true, dependsOnMethods = { "testAddArtifactNullValues" } ) @Test( alwaysRun = true, dependsOnMethods = { "testAddArtifactNullValues" } )
public void testDeleteArtifactInvalidGroupId() public void testDeleteArtifactInvalidGroupId()
{ {

View File

@ -81,8 +81,9 @@ public class AuditLogsReportTest
assertAuditLogsReportPage(); assertAuditLogsReportPage();
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." assertTextPresent(
+ getProperty( "ARTIFACT_PACKAGING" ) ); getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + getProperty(
"ARTIFACT_PACKAGING" ) );
assertTextPresent( "Uploaded File" ); assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" ); assertTextPresent( "internal" );
assertTextPresent( "admin" ); assertTextPresent( "admin" );
@ -103,8 +104,9 @@ public class AuditLogsReportTest
assertTextPresent( "If you specify an artifact ID, you must specify a group ID" ); assertTextPresent( "If you specify an artifact ID, you must specify a group ID" );
assertTextNotPresent( "Results" ); assertTextNotPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextNotPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." assertTextNotPresent(
+ getProperty( "ARTIFACT_PACKAGING" ) ); getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + getProperty(
"ARTIFACT_PACKAGING" ) );
assertTextNotPresent( "Uploaded File" ); assertTextNotPresent( "Uploaded File" );
} }
@ -121,14 +123,16 @@ public class AuditLogsReportTest
assertAuditLogsReportPage(); assertAuditLogsReportPage();
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." assertTextPresent(
+ getProperty( "ARTIFACT_PACKAGING" ) ); getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + getProperty(
"ARTIFACT_PACKAGING" ) );
assertTextPresent( "Uploaded File" ); assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" ); assertTextPresent( "internal" );
assertTextPresent( "admin" ); assertTextPresent( "admin" );
} }
@Test( dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" }, groups = "requiresUpload" ) @Test( dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" },
groups = "requiresUpload" )
public void testViewAuditLogsViewAuditEventsForManageableRepositoriesOnly() public void testViewAuditLogsViewAuditEventsForManageableRepositoriesOnly()
{ {
String groupId = getProperty( "SNAPSHOT_GROUPID" ); String groupId = getProperty( "SNAPSHOT_GROUPID" );
@ -137,9 +141,10 @@ public class AuditLogsReportTest
String repo = getProperty( "SNAPSHOT_REPOSITORYID" ); String repo = getProperty( "SNAPSHOT_REPOSITORYID" );
String packaging = getProperty( "SNAPSHOT_PACKAGING" ); String packaging = getProperty( "SNAPSHOT_PACKAGING" );
addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repo ); addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repo, true );
assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + version assertTextPresent(
+ "' was successfully deployed to repository '" + repo + "'" ); "Artifact '" + groupId + ":" + artifactId + ":" + version + "' was successfully deployed to repository '"
+ repo + "'" );
clickLinkWithText( "Logout" ); clickLinkWithText( "Logout" );
@ -154,8 +159,8 @@ public class AuditLogsReportTest
assertAuditLogsReportPage(); assertAuditLogsReportPage();
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextNotPresent( "No audit logs found." ); assertTextNotPresent( "No audit logs found." );
assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." assertTextPresent(
+ packaging ); getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + packaging );
assertTextPresent( "Uploaded File" ); assertTextPresent( "Uploaded File" );
assertTextPresent( "internal" ); assertTextPresent( "internal" );
assertTextPresent( "admin" ); assertTextPresent( "admin" );
@ -176,7 +181,8 @@ public class AuditLogsReportTest
String repositoryId = getProperty( "REPOSITORYID" ); String repositoryId = getProperty( "REPOSITORYID" );
String expectedArtifact = getProperty( "AUDITLOG_EXPECTED_ARTIFACT" ); String expectedArtifact = getProperty( "AUDITLOG_EXPECTED_ARTIFACT" );
addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repositoryId ); addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repositoryId,
true );
goToAuditLogReports(); goToAuditLogReports();

View File

@ -19,12 +19,12 @@ package org.apache.archiva.web.test;
* under the License. * under the License.
*/ */
import java.io.File;
import org.apache.archiva.web.test.parent.AbstractBrowseTest; import org.apache.archiva.web.test.parent.AbstractBrowseTest;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.io.File;
@Test( groups = { "browse" }, dependsOnMethods = { "testAddArtifactNullValues" } ) @Test( groups = { "browse" }, dependsOnMethods = { "testAddArtifactNullValues" } )
public class BrowseTest public class BrowseTest
extends AbstractBrowseTest extends AbstractBrowseTest
@ -35,7 +35,7 @@ public class BrowseTest
clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" ); clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" ); clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" ); clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" );
assertTextPresent( "Info" ); assertTextPresent( "Info" );
assertTextPresent( "Dependencies" ); assertTextPresent( "Dependencies" );
assertTextPresent( "Dependency Tree" ); assertTextPresent( "Dependency Tree" );
@ -80,9 +80,10 @@ public class BrowseTest
"src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar"; "src/test/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) // TODO: do this differently as uploading doesn't work on browsers other than *chrome (below as well)
// upload a snapshot artifact to repository 'releases' // upload a snapshot artifact to repository 'releases'
addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", path, releasesRepo ); addArtifact( "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar", path, releasesRepo, true );
assertTextPresent( "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '" assertTextPresent(
+ releasesRepo + "'" ); "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '" + releasesRepo
+ "'" );
goToBrowsePage(); goToBrowsePage();
assertBrowsePage(); assertBrowsePage();
@ -91,9 +92,10 @@ public class BrowseTest
assertArtifactInfoPage( "1.0-SNAPSHOT/", releasesRepo, "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar" ); assertArtifactInfoPage( "1.0-SNAPSHOT/", releasesRepo, "archiva", "archiva-webapp", "1.0-SNAPSHOT", "jar" );
// upload a snapshot artifact to repository 'snapshots' // upload a snapshot artifact to repository 'snapshots'
addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", path, snapshotsRepo ); addArtifact( "continuum", "continuum-core", "1.0-SNAPSHOT", "jar", path, snapshotsRepo, true );
assertTextPresent( "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '" assertTextPresent(
+ snapshotsRepo + "'" ); "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '" + snapshotsRepo
+ "'" );
goToBrowsePage(); goToBrowsePage();
assertBrowsePage(); assertBrowsePage();
@ -112,26 +114,29 @@ public class BrowseTest
"src/test/resources/snapshots/org/apache/maven/archiva/web/test/foo-bar/1.0-SNAPSHOT/foo-bar-1.0-SNAPSHOT.jar"; "src/test/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) // TODO: do this differently as uploading doesn't work on browsers other than *chrome (below as well)
// upload a snapshot artifact to repository 'releases' // upload a snapshot artifact to repository 'releases'
addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo ); addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo, true );
assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '" assertTextPresent(
+ snapshotsRepo + "'" ); "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '"
+ snapshotsRepo + "'" );
goToBrowsePage(); goToBrowsePage();
assertBrowsePage(); assertBrowsePage();
assertGroupsPage( "archiva/" ); assertGroupsPage( "archiva/" );
assertArtifactsPage( "archiva-multiple-artifacts/" ); assertArtifactsPage( "archiva-multiple-artifacts/" );
assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar" ); assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT",
"jar" );
addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo, true );
addArtifact( "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar", path, snapshotsRepo ); assertTextPresent(
assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '" "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '"
+ snapshotsRepo + "'" ); + snapshotsRepo + "'" );
goToBrowsePage(); goToBrowsePage();
assertBrowsePage(); assertBrowsePage();
assertGroupsPage( "archiva/" ); assertGroupsPage( "archiva/" );
assertArtifactsPage( "archiva-multiple-artifacts/" ); assertArtifactsPage( "archiva-multiple-artifacts/" );
assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT", "jar" ); assertArtifactInfoPage( "1.0-SNAPSHOT/", snapshotsRepo, "archiva", "archiva-multiple-artifacts", "1.0-SNAPSHOT",
"jar" );
String firstSnapshotVersion = getText( "//div[@id='download']/div[@id='accordion']/p[2]/a/" ); String firstSnapshotVersion = getText( "//div[@id='download']/div[@id='accordion']/p[2]/a/" );
Assert.assertTrue( firstSnapshotVersion.endsWith( "-1" ) ); Assert.assertTrue( firstSnapshotVersion.endsWith( "-1" ) );
@ -139,7 +144,7 @@ public class BrowseTest
String secondSnapshotVersion = getText( "//div[@id='download']/div[@id='accordion']/p[1]/a/" ); String secondSnapshotVersion = getText( "//div[@id='download']/div[@id='accordion']/p[1]/a/" );
Assert.assertTrue( secondSnapshotVersion.endsWith( "-2" ) ); Assert.assertTrue( secondSnapshotVersion.endsWith( "-2" ) );
} }
public void testAddMetadataPropertyEmpty() public void testAddMetadataPropertyEmpty()
{ {
goToBrowsePage(); goToBrowsePage();
@ -163,20 +168,20 @@ public class BrowseTest
{ {
addMetadataProperty(); addMetadataProperty();
} }
@Test( dependsOnMethods = { "testAddMetadataProperty" } ) @Test( dependsOnMethods = { "testAddMetadataProperty" } )
public void testDeleteMetadataProperty() public void testDeleteMetadataProperty()
{ {
deleteMetadataProperty(); deleteMetadataProperty();
} }
@Test( dependsOnMethods = { "testDeleteMetadataProperty" }) @Test( dependsOnMethods = { "testDeleteMetadataProperty" } )
public void testMetadataAccessWithRepositoryObserverRole() public void testMetadataAccessWithRepositoryObserverRole()
{ {
addMetadataProperty(); addMetadataProperty();
logout(); logout();
goToBrowsePage(); goToBrowsePage();
clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" ); clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" ); clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
@ -184,17 +189,17 @@ public class BrowseTest
clickLinkWithText( "Metadata" ); clickLinkWithText( "Metadata" );
waitPage(); waitPage();
assertTextNotPresent( "No metadata content." ); assertTextNotPresent( "No metadata content." );
assertButtonWithValueNotPresent( "Add" ); assertButtonWithValueNotPresent( "Add" );
assertTextNotPresent( "Add Property" ); assertTextNotPresent( "Add Property" );
assertImgWithAltNotPresent( "Delete" ); assertImgWithAltNotPresent( "Delete" );
login( getAdminUsername(), getAdminPassword() ); login( getAdminUsername(), getAdminPassword() );
deleteMetadataProperty(); deleteMetadataProperty();
} }
private void addMetadataProperty() private void addMetadataProperty()
{ {
goToBrowsePage(); goToBrowsePage();
@ -217,7 +222,7 @@ public class BrowseTest
assertTextNotPresent( "No metadata content." ); assertTextNotPresent( "No metadata content." );
assertTextPresent( "foo=bar" ); assertTextPresent( "foo=bar" );
} }
private void deleteMetadataProperty() private void deleteMetadataProperty()
{ {
goToBrowsePage(); goToBrowsePage();
@ -238,7 +243,7 @@ public class BrowseTest
assertTextPresent( "Property successfully deleted." ); assertTextPresent( "Property successfully deleted." );
assertImgWithAltNotPresent( "Delete" ); assertImgWithAltNotPresent( "Delete" );
assertTextPresent( "No metadata content." ); assertTextPresent( "No metadata content." );
} }
private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId, private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId,
String artifactInfoArtifactId, String artifactInfoVersion, String artifactInfoArtifactId, String artifactInfoVersion,

View File

@ -41,7 +41,7 @@ public class MergingRepositoriesTest
public void testAddArtifactToStagingRepository() public void testAddArtifactToStagingRepository()
{ {
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(), addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
"merging-repo-stage" ); "merging-repo-stage", true );
assertTextPresent( "Artifact '" + getGroupId() + ":" + getArtifactId() + ":" + getVersion() + assertTextPresent( "Artifact '" + getGroupId() + ":" + getArtifactId() + ":" + getVersion() +
"' was successfully deployed to repository 'merging-repo-stage'" ); "' was successfully deployed to repository 'merging-repo-stage'" );
} }
@ -93,7 +93,7 @@ public class MergingRepositoriesTest
{ {
editManagedRepository(); editManagedRepository();
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(), addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
"merging-repo-stage" ); "merging-repo-stage", true );
assertTextPresent( assertTextPresent(
"Overwriting released artifacts in repository '" + "merging-repo-stage" + "' is not allowed." ); "Overwriting released artifacts in repository '" + "merging-repo-stage" + "' is not allowed." );
} }

View File

@ -19,17 +19,15 @@ package org.apache.archiva.web.test;
* under the License. * under the License.
*/ */
import java.io.File;
import org.apache.archiva.web.test.parent.AbstractSearchTest; import org.apache.archiva.web.test.parent.AbstractSearchTest;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Test( groups = { "search" }, dependsOnGroups = {"about"}, sequential = true) @Test( groups = { "search" }, dependsOnGroups = { "about" }, sequential = true )
public class SearchTest public class SearchTest
extends AbstractSearchTest extends AbstractSearchTest
{ {
@Test(alwaysRun = true) @Test( alwaysRun = true )
public void testSearchNonExistingArtifact() public void testSearchNonExistingArtifact()
throws Exception throws Exception
{ {
@ -39,7 +37,7 @@ public class SearchTest
} }
// TODO: make search tests more robust especially when comparing/asserting number of hits // TODO: make search tests more robust especially when comparing/asserting number of hits
@Test(alwaysRun = true) @Test( alwaysRun = true )
public void testSearchExistingArtifact() public void testSearchExistingArtifact()
{ {
searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) ); searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
@ -49,7 +47,7 @@ public class SearchTest
assertLinkPresent( "test" ); assertLinkPresent( "test" );
} }
@Test(alwaysRun = true) @Test( alwaysRun = true )
public void testViewSearchedArtifact() public void testViewSearchedArtifact()
{ {
searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) ); searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
@ -60,7 +58,7 @@ public class SearchTest
assertPage( "Apache Archiva \\ Browse Repository" ); assertPage( "Apache Archiva \\ Browse Repository" );
} }
@Test(alwaysRun = true) @Test( alwaysRun = true )
public void testSearchWithMultipleKeywords() public void testSearchWithMultipleKeywords()
{ {
String groupId = getProperty( "ADD_REMOVE_GROUPID" ); String groupId = getProperty( "ADD_REMOVE_GROUPID" );
@ -68,38 +66,38 @@ public class SearchTest
String packaging = getProperty( "SNAPSHOT_PACKAGING" ); String packaging = getProperty( "SNAPSHOT_PACKAGING" );
String filePath = getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ); String filePath = getProperty( "SNAPSHOT_ARTIFACTFILEPATH" );
String repoId = getProperty( "SNAPSHOT_REPOSITORYID" ); String repoId = getProperty( "SNAPSHOT_REPOSITORYID" );
String existingArtifactId = getProperty( "ADD_REMOVE_ARTIFACTID" ); String existingArtifactId = getProperty( "ADD_REMOVE_ARTIFACTID" );
String multiKeywords = existingArtifactId.replace( "-", " " ); String multiKeywords = existingArtifactId.replace( "-", " " );
addArtifact( groupId, existingArtifactId, version, packaging, filePath, repoId ); addArtifact( groupId, existingArtifactId, version, packaging, filePath, repoId, true );
// verify artifact is existing // verify artifact is existing
searchForArtifact( existingArtifactId ); searchForArtifact( existingArtifactId );
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextPresent( "Hits: 1 to 1 of 1" ); assertTextPresent( "Hits: 1 to 1 of 1" );
assertLinkPresent( existingArtifactId ); assertLinkPresent( existingArtifactId );
// search for existing artifact using multiple keywords // search for existing artifact using multiple keywords
searchForArtifact( multiKeywords ); searchForArtifact( multiKeywords );
assertTextPresent( "No results found" ); assertTextPresent( "No results found" );
} }
@Test(alwaysRun = true) @Test( alwaysRun = true )
public void testSearchNonExistingArtifactInAdvancedSearch() public void testSearchNonExistingArtifactInAdvancedSearch()
{ {
searchForArtifactAdvancedSearch( null, getProperty( "SEARCH_BAD_ARTIFACT" ), null, null, null, null ); searchForArtifactAdvancedSearch( null, getProperty( "SEARCH_BAD_ARTIFACT" ), null, null, null, null );
assertTextPresent( "No results found" ); assertTextPresent( "No results found" );
} }
@Test(alwaysRun = true) @Test( alwaysRun = true )
public void testSearchNoSearchCriteriaSpecifiedInAdvancedSearch() public void testSearchNoSearchCriteriaSpecifiedInAdvancedSearch()
{ {
searchForArtifactAdvancedSearch( null, null, null, null, null, null ); searchForArtifactAdvancedSearch( null, null, null, null, null, null );
assertTextPresent( "Advanced Search - At least one search criteria must be provided." ); assertTextPresent( "Advanced Search - At least one search criteria must be provided." );
} }
@Test(alwaysRun = true) @Test( alwaysRun = true )
public void testSearchExistingArtifactUsingAdvancedSearchArtifactId() public void testSearchExistingArtifactUsingAdvancedSearchArtifactId()
{ {
searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null,
@ -109,7 +107,7 @@ public class SearchTest
assertLinkPresent( "test" ); assertLinkPresent( "test" );
} }
@Test(alwaysRun = true) @Test( alwaysRun = true )
public void testSearchExistingArtifactUsingAdvancedSearchGroupId() public void testSearchExistingArtifactUsingAdvancedSearchGroupId()
{ {
searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), null, null, getProperty( "REPOSITORYID" ), null, searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), null, null, getProperty( "REPOSITORYID" ), null,
@ -119,17 +117,18 @@ public class SearchTest
assertLinkPresent( "test" ); assertLinkPresent( "test" );
} }
@Test(alwaysRun = true) @Test( alwaysRun = true )
public void testSearchExistingArtifactAllCriteriaSpecifiedInAdvancedSearch() public void testSearchExistingArtifactAllCriteriaSpecifiedInAdvancedSearch()
{ {
searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), getProperty( "ARTIFACT_ARTIFACTID" ) , getProperty( "ARTIFACT_VERSION" ), searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), getProperty( "ARTIFACT_ARTIFACTID" ),
getProperty( "REPOSITORYID" ), getProperty( "ARTIFACT_CLASSNAME" ), null ); getProperty( "ARTIFACT_VERSION" ), getProperty( "REPOSITORYID" ),
getProperty( "ARTIFACT_CLASSNAME" ), null );
assertTextPresent( "Results" ); assertTextPresent( "Results" );
assertTextPresent( "Hits: 1 to 1 of 1" ); assertTextPresent( "Hits: 1 to 1 of 1" );
assertLinkPresent( "test" ); assertLinkPresent( "test" );
} }
@Test(alwaysRun = true) @Test( alwaysRun = true )
public void testSearchExistingArtifactUsingAdvancedSearchNotInRepository() public void testSearchExistingArtifactUsingAdvancedSearchNotInRepository()
{ {
searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, "snapshots", null, null ); searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, "snapshots", null, null );

View File

@ -524,13 +524,13 @@ public abstract class AbstractArchivaTest
} }
public void addArtifact( String groupId, String artifactId, String version, String packaging, public void addArtifact( String groupId, String artifactId, String version, String packaging,
String artifactFilePath, String repositoryId ) String artifactFilePath, String repositoryId, boolean wait )
{ {
addArtifact( groupId, artifactId, version, packaging, true, artifactFilePath, repositoryId ); addArtifact( groupId, artifactId, version, packaging, true, artifactFilePath, repositoryId, wait );
} }
public void addArtifact( String groupId, String artifactId, String version, String packaging, boolean generatePom, public void addArtifact( String groupId, String artifactId, String version, String packaging, boolean generatePom,
String artifactFilePath, String repositoryId ) String artifactFilePath, String repositoryId, boolean wait )
{ {
login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) ); login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
goToAddArtifactPage(); goToAddArtifactPage();
@ -566,7 +566,7 @@ public abstract class AbstractArchivaTest
selectValue( "upload_repositoryId", repositoryId ); selectValue( "upload_repositoryId", repositoryId );
//clickButtonWithValue( "Submit" ); //clickButtonWithValue( "Submit" );
clickButtonWithLocator( "uploadSubmit" ); clickButtonWithLocator( "uploadSubmit", wait );
} }
public void goToRepositoriesPage() public void goToRepositoriesPage()