mirror of https://github.com/apache/archiva.git
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:
parent
4ff75a4b90
commit
b296aef2e4
|
@ -27,7 +27,7 @@ public class ArtifactManagementTest
|
|||
extends AbstractArtifactManagementTest
|
||||
{
|
||||
|
||||
@Test( alwaysRun = true, dependsOnGroups = "about")
|
||||
@Test( alwaysRun = true, dependsOnGroups = "about" )
|
||||
public void testAddArtifactNullValues()
|
||||
{
|
||||
goToAddArtifactPage();
|
||||
|
@ -43,7 +43,8 @@ public class ArtifactManagementTest
|
|||
@Test( dependsOnMethods = { "testAddArtifactNullValues" }, alwaysRun = true )
|
||||
public void testAddArtifactNoGroupId()
|
||||
{
|
||||
addArtifact( " ", getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() );
|
||||
addArtifact( " ", getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId(),
|
||||
false );
|
||||
assertTextPresent( "You must enter a groupId." );
|
||||
}
|
||||
|
||||
|
@ -51,35 +52,38 @@ public class ArtifactManagementTest
|
|||
public void testAddArtifactNoArtifactId()
|
||||
{
|
||||
|
||||
addArtifact( getGroupId(), " ", getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId() );
|
||||
addArtifact( getGroupId(), " ", getVersion(), getPackaging(), getArtifactFilePath(), getRepositoryId(), false );
|
||||
assertTextPresent( "You must enter an artifactId." );
|
||||
}
|
||||
|
||||
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
|
||||
public void testAddArtifactNoVersion()
|
||||
{
|
||||
addArtifact( getGroupId(), getArtifactId(), " ", getPackaging(), getArtifactFilePath(), getRepositoryId() );
|
||||
addArtifact( getGroupId(), getArtifactId(), " ", getPackaging(), getArtifactFilePath(), getRepositoryId(),
|
||||
false );
|
||||
assertTextPresent( "You must enter a version." );
|
||||
}
|
||||
|
||||
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
|
||||
public void testAddArtifactInvalidVersion()
|
||||
{
|
||||
addArtifact( getGroupId(), getArtifactId(), "asdf", getPackaging(), getArtifactFilePath(), getRepositoryId() );
|
||||
addArtifact( getGroupId(), getArtifactId(), "asdf", getPackaging(), getArtifactFilePath(), getRepositoryId(),
|
||||
true );
|
||||
assertTextPresent( "Invalid version." );
|
||||
}
|
||||
|
||||
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
|
||||
public void testAddArtifactNoPackaging()
|
||||
{
|
||||
addArtifact( getGroupId(), getArtifactId(), getVersion(), " ", getArtifactFilePath(), getRepositoryId() );
|
||||
addArtifact( getGroupId(), getArtifactId(), getVersion(), " ", getArtifactFilePath(), getRepositoryId(),
|
||||
false );
|
||||
assertTextPresent( "You must enter a packaging." );
|
||||
}
|
||||
|
||||
@Test( dependsOnMethods = { "testAddArtifactNoGroupId" }, alwaysRun = true )
|
||||
public void testAddArtifactNoFilePath()
|
||||
{
|
||||
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), " ", getRepositoryId() );
|
||||
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), " ", getRepositoryId(), false );
|
||||
assertTextPresent( "Please add a file to upload." );
|
||||
}
|
||||
|
||||
|
@ -89,7 +93,8 @@ public class ArtifactManagementTest
|
|||
String groupId = getProperty( "VALIDARTIFACT_GROUPID" );
|
||||
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()
|
||||
+ "' was successfully deployed to repository 'internal'" );
|
||||
}
|
||||
|
@ -101,7 +106,7 @@ public class ArtifactManagementTest
|
|||
String artifactId = getProperty( "ARTIFACTID_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()
|
||||
+ "' was successfully deployed to repository 'internal'" );
|
||||
getSelenium().open( baseUrl + "/browse/" + groupId + "/" + artifactId + "/" + getVersion() );
|
||||
|
@ -121,7 +126,7 @@ public class ArtifactManagementTest
|
|||
public void testAddArtifactBlockRedeployments()
|
||||
{
|
||||
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getArtifactFilePath(),
|
||||
getRepositoryId() );
|
||||
getRepositoryId(), false );
|
||||
assertTextPresent( "Overwriting released artifacts in repository '" + getRepositoryId() + "' is not allowed." );
|
||||
}
|
||||
|
||||
|
@ -135,7 +140,7 @@ public class ArtifactManagementTest
|
|||
String packaging = getProperty( "PACKAGING1" );
|
||||
String repositoryId = getProperty( "REPOSITORYID1" );
|
||||
// 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'" );
|
||||
|
||||
deleteArtifact( "delete", "delete", "1.0", "internal" );
|
||||
|
@ -176,13 +181,15 @@ public class ArtifactManagementTest
|
|||
public void testDeleteArtifactInvalidValues()
|
||||
{
|
||||
deleteArtifact( "<> \\/~+[ ]'\"", "<> \\/~+[ ]'\"", "<>", "internal" );
|
||||
assertTextPresent( "Invalid version." );
|
||||
assertTextPresent(
|
||||
"Group id must only contain alphanumeric characters, underscores(_), dots(.), and dashes(-)." );
|
||||
assertTextPresent(
|
||||
"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" } )
|
||||
public void testDeleteArtifactInvalidGroupId()
|
||||
{
|
||||
|
|
|
@ -81,8 +81,9 @@ public class AuditLogsReportTest
|
|||
assertAuditLogsReportPage();
|
||||
assertTextPresent( "Results" );
|
||||
assertTextNotPresent( "No audit logs found." );
|
||||
assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
|
||||
+ getProperty( "ARTIFACT_PACKAGING" ) );
|
||||
assertTextPresent(
|
||||
getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + getProperty(
|
||||
"ARTIFACT_PACKAGING" ) );
|
||||
assertTextPresent( "Uploaded File" );
|
||||
assertTextPresent( "internal" );
|
||||
assertTextPresent( "admin" );
|
||||
|
@ -103,8 +104,9 @@ public class AuditLogsReportTest
|
|||
assertTextPresent( "If you specify an artifact ID, you must specify a group ID" );
|
||||
assertTextNotPresent( "Results" );
|
||||
assertTextNotPresent( "No audit logs found." );
|
||||
assertTextNotPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
|
||||
+ getProperty( "ARTIFACT_PACKAGING" ) );
|
||||
assertTextNotPresent(
|
||||
getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + getProperty(
|
||||
"ARTIFACT_PACKAGING" ) );
|
||||
assertTextNotPresent( "Uploaded File" );
|
||||
}
|
||||
|
||||
|
@ -121,14 +123,16 @@ public class AuditLogsReportTest
|
|||
assertAuditLogsReportPage();
|
||||
assertTextPresent( "Results" );
|
||||
assertTextNotPresent( "No audit logs found." );
|
||||
assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
|
||||
+ getProperty( "ARTIFACT_PACKAGING" ) );
|
||||
assertTextPresent(
|
||||
getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + getProperty(
|
||||
"ARTIFACT_PACKAGING" ) );
|
||||
assertTextPresent( "Uploaded File" );
|
||||
assertTextPresent( "internal" );
|
||||
assertTextPresent( "admin" );
|
||||
}
|
||||
|
||||
@Test( dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" }, groups = "requiresUpload" )
|
||||
@Test( dependsOnMethods = { "testAddArtifactValidValues", "testUserWithRepoManagerInternalRole" },
|
||||
groups = "requiresUpload" )
|
||||
public void testViewAuditLogsViewAuditEventsForManageableRepositoriesOnly()
|
||||
{
|
||||
String groupId = getProperty( "SNAPSHOT_GROUPID" );
|
||||
|
@ -137,9 +141,10 @@ public class AuditLogsReportTest
|
|||
String repo = getProperty( "SNAPSHOT_REPOSITORYID" );
|
||||
String packaging = getProperty( "SNAPSHOT_PACKAGING" );
|
||||
|
||||
addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repo );
|
||||
assertTextPresent( "Artifact '" + groupId + ":" + artifactId + ":" + version
|
||||
+ "' was successfully deployed to repository '" + repo + "'" );
|
||||
addArtifact( groupId, artifactId, version, packaging, getProperty( "SNAPSHOT_ARTIFACTFILEPATH" ), repo, true );
|
||||
assertTextPresent(
|
||||
"Artifact '" + groupId + ":" + artifactId + ":" + version + "' was successfully deployed to repository '"
|
||||
+ repo + "'" );
|
||||
|
||||
clickLinkWithText( "Logout" );
|
||||
|
||||
|
@ -154,8 +159,8 @@ public class AuditLogsReportTest
|
|||
assertAuditLogsReportPage();
|
||||
assertTextPresent( "Results" );
|
||||
assertTextNotPresent( "No audit logs found." );
|
||||
assertTextPresent( getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "."
|
||||
+ packaging );
|
||||
assertTextPresent(
|
||||
getProperty( "VALIDARTIFACT_ARTIFACTID" ) + "-" + getProperty( "ARTIFACT_VERSION" ) + "." + packaging );
|
||||
assertTextPresent( "Uploaded File" );
|
||||
assertTextPresent( "internal" );
|
||||
assertTextPresent( "admin" );
|
||||
|
@ -176,7 +181,8 @@ public class AuditLogsReportTest
|
|||
String repositoryId = getProperty( "REPOSITORYID" );
|
||||
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();
|
||||
|
||||
|
|
|
@ -19,12 +19,12 @@ package org.apache.archiva.web.test;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.archiva.web.test.parent.AbstractBrowseTest;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Test( groups = { "browse" }, dependsOnMethods = { "testAddArtifactNullValues" } )
|
||||
public class BrowseTest
|
||||
extends AbstractBrowseTest
|
||||
|
@ -35,7 +35,7 @@ public class BrowseTest
|
|||
clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
|
||||
clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
|
||||
clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" );
|
||||
|
||||
|
||||
assertTextPresent( "Info" );
|
||||
assertTextPresent( "Dependencies" );
|
||||
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";
|
||||
// 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", path, releasesRepo );
|
||||
assertTextPresent( "Artifact 'archiva:archiva-webapp:1.0-SNAPSHOT' was successfully deployed to repository '"
|
||||
+ 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 '" + releasesRepo
|
||||
+ "'" );
|
||||
|
||||
goToBrowsePage();
|
||||
assertBrowsePage();
|
||||
|
@ -91,9 +92,10 @@ 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", path, snapshotsRepo );
|
||||
assertTextPresent( "Artifact 'continuum:continuum-core:1.0-SNAPSHOT' was successfully deployed to repository '"
|
||||
+ 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 '" + snapshotsRepo
|
||||
+ "'" );
|
||||
|
||||
goToBrowsePage();
|
||||
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";
|
||||
// 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 + "'" );
|
||||
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 '"
|
||||
+ snapshotsRepo + "'" );
|
||||
|
||||
goToBrowsePage();
|
||||
assertBrowsePage();
|
||||
assertGroupsPage( "archiva/" );
|
||||
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 );
|
||||
assertTextPresent( "Artifact 'archiva:archiva-multiple-artifacts:1.0-SNAPSHOT' was successfully deployed to repository '"
|
||||
+ 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 '"
|
||||
+ snapshotsRepo + "'" );
|
||||
|
||||
goToBrowsePage();
|
||||
assertBrowsePage();
|
||||
assertGroupsPage( "archiva/" );
|
||||
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/" );
|
||||
Assert.assertTrue( firstSnapshotVersion.endsWith( "-1" ) );
|
||||
|
@ -139,7 +144,7 @@ public class BrowseTest
|
|||
String secondSnapshotVersion = getText( "//div[@id='download']/div[@id='accordion']/p[1]/a/" );
|
||||
Assert.assertTrue( secondSnapshotVersion.endsWith( "-2" ) );
|
||||
}
|
||||
|
||||
|
||||
public void testAddMetadataPropertyEmpty()
|
||||
{
|
||||
goToBrowsePage();
|
||||
|
@ -163,20 +168,20 @@ public class BrowseTest
|
|||
{
|
||||
addMetadataProperty();
|
||||
}
|
||||
|
||||
|
||||
@Test( dependsOnMethods = { "testAddMetadataProperty" } )
|
||||
public void testDeleteMetadataProperty()
|
||||
{
|
||||
deleteMetadataProperty();
|
||||
}
|
||||
|
||||
@Test( dependsOnMethods = { "testDeleteMetadataProperty" })
|
||||
|
||||
@Test( dependsOnMethods = { "testDeleteMetadataProperty" } )
|
||||
public void testMetadataAccessWithRepositoryObserverRole()
|
||||
{
|
||||
{
|
||||
addMetadataProperty();
|
||||
|
||||
|
||||
logout();
|
||||
|
||||
|
||||
goToBrowsePage();
|
||||
clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
|
||||
clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
|
||||
|
@ -184,17 +189,17 @@ public class BrowseTest
|
|||
clickLinkWithText( "Metadata" );
|
||||
|
||||
waitPage();
|
||||
|
||||
|
||||
assertTextNotPresent( "No metadata content." );
|
||||
assertButtonWithValueNotPresent( "Add" );
|
||||
assertTextNotPresent( "Add Property" );
|
||||
assertImgWithAltNotPresent( "Delete" );
|
||||
|
||||
|
||||
login( getAdminUsername(), getAdminPassword() );
|
||||
|
||||
|
||||
deleteMetadataProperty();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addMetadataProperty()
|
||||
{
|
||||
goToBrowsePage();
|
||||
|
@ -217,7 +222,7 @@ public class BrowseTest
|
|||
assertTextNotPresent( "No metadata content." );
|
||||
assertTextPresent( "foo=bar" );
|
||||
}
|
||||
|
||||
|
||||
private void deleteMetadataProperty()
|
||||
{
|
||||
goToBrowsePage();
|
||||
|
@ -238,7 +243,7 @@ public class BrowseTest
|
|||
assertTextPresent( "Property successfully deleted." );
|
||||
assertImgWithAltNotPresent( "Delete" );
|
||||
assertTextPresent( "No metadata content." );
|
||||
}
|
||||
}
|
||||
|
||||
private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId,
|
||||
String artifactInfoArtifactId, String artifactInfoVersion,
|
||||
|
|
|
@ -41,7 +41,7 @@ public class MergingRepositoriesTest
|
|||
public void testAddArtifactToStagingRepository()
|
||||
{
|
||||
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
|
||||
"merging-repo-stage" );
|
||||
"merging-repo-stage", true );
|
||||
assertTextPresent( "Artifact '" + getGroupId() + ":" + getArtifactId() + ":" + getVersion() +
|
||||
"' was successfully deployed to repository 'merging-repo-stage'" );
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class MergingRepositoriesTest
|
|||
{
|
||||
editManagedRepository();
|
||||
addArtifact( getGroupId(), getArtifactId(), getVersion(), getPackaging(), getValidArtifactFilePath(),
|
||||
"merging-repo-stage" );
|
||||
"merging-repo-stage", true );
|
||||
assertTextPresent(
|
||||
"Overwriting released artifacts in repository '" + "merging-repo-stage" + "' is not allowed." );
|
||||
}
|
||||
|
|
|
@ -19,17 +19,15 @@ package org.apache.archiva.web.test;
|
|||
* under the License.
|
||||
*/
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.apache.archiva.web.test.parent.AbstractSearchTest;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
@Test( groups = { "search" }, dependsOnGroups = {"about"}, sequential = true)
|
||||
@Test( groups = { "search" }, dependsOnGroups = { "about" }, sequential = true )
|
||||
public class SearchTest
|
||||
extends AbstractSearchTest
|
||||
{
|
||||
|
||||
@Test(alwaysRun = true)
|
||||
@Test( alwaysRun = true )
|
||||
public void testSearchNonExistingArtifact()
|
||||
throws Exception
|
||||
{
|
||||
|
@ -39,7 +37,7 @@ public class SearchTest
|
|||
}
|
||||
|
||||
// TODO: make search tests more robust especially when comparing/asserting number of hits
|
||||
@Test(alwaysRun = true)
|
||||
@Test( alwaysRun = true )
|
||||
public void testSearchExistingArtifact()
|
||||
{
|
||||
searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
|
||||
|
@ -49,7 +47,7 @@ public class SearchTest
|
|||
assertLinkPresent( "test" );
|
||||
}
|
||||
|
||||
@Test(alwaysRun = true)
|
||||
@Test( alwaysRun = true )
|
||||
public void testViewSearchedArtifact()
|
||||
{
|
||||
searchForArtifact( getProperty( "ARTIFACT_ARTIFACTID" ) );
|
||||
|
@ -60,7 +58,7 @@ public class SearchTest
|
|||
assertPage( "Apache Archiva \\ Browse Repository" );
|
||||
}
|
||||
|
||||
@Test(alwaysRun = true)
|
||||
@Test( alwaysRun = true )
|
||||
public void testSearchWithMultipleKeywords()
|
||||
{
|
||||
String groupId = getProperty( "ADD_REMOVE_GROUPID" );
|
||||
|
@ -68,38 +66,38 @@ public class SearchTest
|
|||
String packaging = getProperty( "SNAPSHOT_PACKAGING" );
|
||||
String filePath = getProperty( "SNAPSHOT_ARTIFACTFILEPATH" );
|
||||
String repoId = getProperty( "SNAPSHOT_REPOSITORYID" );
|
||||
|
||||
|
||||
String existingArtifactId = getProperty( "ADD_REMOVE_ARTIFACTID" );
|
||||
String multiKeywords = existingArtifactId.replace( "-", " " );
|
||||
|
||||
addArtifact( groupId, existingArtifactId, version, packaging, filePath, repoId );
|
||||
|
||||
|
||||
addArtifact( groupId, existingArtifactId, version, packaging, filePath, repoId, true );
|
||||
|
||||
// verify artifact is existing
|
||||
searchForArtifact( existingArtifactId );
|
||||
assertTextPresent( "Results" );
|
||||
assertTextPresent( "Hits: 1 to 1 of 1" );
|
||||
assertLinkPresent( existingArtifactId );
|
||||
|
||||
|
||||
// search for existing artifact using multiple keywords
|
||||
searchForArtifact( multiKeywords );
|
||||
assertTextPresent( "No results found" );
|
||||
}
|
||||
|
||||
@Test(alwaysRun = true)
|
||||
@Test( alwaysRun = true )
|
||||
public void testSearchNonExistingArtifactInAdvancedSearch()
|
||||
{
|
||||
searchForArtifactAdvancedSearch( null, getProperty( "SEARCH_BAD_ARTIFACT" ), null, null, null, null );
|
||||
assertTextPresent( "No results found" );
|
||||
}
|
||||
|
||||
@Test(alwaysRun = true)
|
||||
@Test( alwaysRun = true )
|
||||
public void testSearchNoSearchCriteriaSpecifiedInAdvancedSearch()
|
||||
{
|
||||
searchForArtifactAdvancedSearch( null, null, null, null, null, null );
|
||||
assertTextPresent( "Advanced Search - At least one search criteria must be provided." );
|
||||
}
|
||||
|
||||
@Test(alwaysRun = true)
|
||||
@Test( alwaysRun = true )
|
||||
public void testSearchExistingArtifactUsingAdvancedSearchArtifactId()
|
||||
{
|
||||
searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null,
|
||||
|
@ -109,7 +107,7 @@ public class SearchTest
|
|||
assertLinkPresent( "test" );
|
||||
}
|
||||
|
||||
@Test(alwaysRun = true)
|
||||
@Test( alwaysRun = true )
|
||||
public void testSearchExistingArtifactUsingAdvancedSearchGroupId()
|
||||
{
|
||||
searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), null, null, getProperty( "REPOSITORYID" ), null,
|
||||
|
@ -119,17 +117,18 @@ public class SearchTest
|
|||
assertLinkPresent( "test" );
|
||||
}
|
||||
|
||||
@Test(alwaysRun = true)
|
||||
@Test( alwaysRun = true )
|
||||
public void testSearchExistingArtifactAllCriteriaSpecifiedInAdvancedSearch()
|
||||
{
|
||||
searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), getProperty( "ARTIFACT_ARTIFACTID" ) , getProperty( "ARTIFACT_VERSION" ),
|
||||
getProperty( "REPOSITORYID" ), getProperty( "ARTIFACT_CLASSNAME" ), null );
|
||||
searchForArtifactAdvancedSearch( getProperty( "GROUPID" ), getProperty( "ARTIFACT_ARTIFACTID" ),
|
||||
getProperty( "ARTIFACT_VERSION" ), getProperty( "REPOSITORYID" ),
|
||||
getProperty( "ARTIFACT_CLASSNAME" ), null );
|
||||
assertTextPresent( "Results" );
|
||||
assertTextPresent( "Hits: 1 to 1 of 1" );
|
||||
assertLinkPresent( "test" );
|
||||
}
|
||||
|
||||
@Test(alwaysRun = true)
|
||||
@Test( alwaysRun = true )
|
||||
public void testSearchExistingArtifactUsingAdvancedSearchNotInRepository()
|
||||
{
|
||||
searchForArtifactAdvancedSearch( null, getProperty( "ARTIFACT_ARTIFACTID" ), null, "snapshots", null, null );
|
||||
|
|
|
@ -524,13 +524,13 @@ public abstract class AbstractArchivaTest
|
|||
}
|
||||
|
||||
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,
|
||||
String artifactFilePath, String repositoryId )
|
||||
String artifactFilePath, String repositoryId, boolean wait )
|
||||
{
|
||||
login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
|
||||
goToAddArtifactPage();
|
||||
|
@ -566,7 +566,7 @@ public abstract class AbstractArchivaTest
|
|||
selectValue( "upload_repositoryId", repositoryId );
|
||||
|
||||
//clickButtonWithValue( "Submit" );
|
||||
clickButtonWithLocator( "uploadSubmit" );
|
||||
clickButtonWithLocator( "uploadSubmit", wait );
|
||||
}
|
||||
|
||||
public void goToRepositoriesPage()
|
||||
|
|
Loading…
Reference in New Issue