mirror of
https://github.com/apache/archiva.git
synced 2025-02-13 13:36:15 +00:00
[MRM-1394] - Replace the use of clickLinkWithText() with getSelenium().open() for accessing navigation menu pages
* replaced clickLinkWithText() with getSelenium().open() * added clickAddIcon() and clickDeleteIcon() to be used instead of clickLinkWithXPath() in RepositoryScanningTest * added dependsOnMethods in testClickArtifactFromBrowse of BrowseTest git-svn-id: https://svn.apache.org/repos/asf/archiva/branches/archiva-1.3.x@960311 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e54ea0a252
commit
e95e243324
@ -28,7 +28,7 @@ public class AuditLogsReportTest
|
||||
{
|
||||
private void goToAuditLogReports()
|
||||
{
|
||||
clickLinkWithText( "Audit Log Report" );
|
||||
getSelenium().open( "/archiva/report/queryAuditLogReport.action" );
|
||||
}
|
||||
|
||||
private void assertAuditLogsReportPage()
|
||||
|
@ -36,6 +36,7 @@ public void testBrowseArtifact()
|
||||
assertBrowsePage();
|
||||
}
|
||||
|
||||
@Test( dependsOnMethods = { "testAddArtifactValidValues" } )
|
||||
public void testClickArtifactFromBrowse()
|
||||
{
|
||||
goToBrowsePage();
|
||||
|
@ -30,7 +30,7 @@ public class RepositoryScanningTest
|
||||
public void testAddArtifactFileType_NullValue()
|
||||
{
|
||||
goToRepositoryScanningPage();
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_0" );
|
||||
assertTextPresent( "Unable to process blank pattern." );
|
||||
}
|
||||
|
||||
@ -38,7 +38,7 @@ public void testAddArtifactFileType_NullValue()
|
||||
public void testAddArtifactFileType()
|
||||
{
|
||||
setFieldValue( "newpattern_0" , "**/*.dll" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_0" );
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "**/*.dll" );
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ public void testAddArtifactFileType()
|
||||
public void testAddArtifactFileType_ExistingValue()
|
||||
{
|
||||
setFieldValue( "newpattern_0" , "**/*.zip" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[15]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_0" );
|
||||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.zip\" to filetype artifacts as it already exists." );
|
||||
}
|
||||
|
||||
@ -54,7 +54,7 @@ public void testAddArtifactFileType_ExistingValue()
|
||||
public void testDeleteArtifactFileType()
|
||||
{
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "**/*.dll" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[1]/table/tbody/tr[14]/td[2]/a/img" );
|
||||
clickDeleteIcon( "**/*.dll" );
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[1]/table.13.0"), "" );
|
||||
}
|
||||
|
||||
@ -62,7 +62,7 @@ public void testDeleteArtifactFileType()
|
||||
public void testAddAutoRemove_NullValue()
|
||||
{
|
||||
setFieldValue( "newpattern_1" , "" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_1" );
|
||||
assertTextPresent( "Unable to process blank pattern." );
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public void testAddAutoRemove_NullValue()
|
||||
public void testAddAutoRemove_ExistingValue()
|
||||
{
|
||||
setFieldValue( "newpattern_1" , "**/*-" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_1" );
|
||||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*-\" to filetype auto-remove as it already exists." );
|
||||
}
|
||||
|
||||
@ -78,7 +78,7 @@ public void testAddAutoRemove_ExistingValue()
|
||||
public void testAddAutoRemove()
|
||||
{
|
||||
setFieldValue( "newpattern_1" , "**/*.test" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_1" );
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "**/*.test" );
|
||||
}
|
||||
|
||||
@ -86,7 +86,7 @@ public void testAddAutoRemove()
|
||||
public void testDeleteAutoRemove()
|
||||
{
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "**/*.test" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[2]/table/tbody/tr[4]/td[2]/a/img" );
|
||||
clickDeleteIcon( "**/*.test" );
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[2]/table.3.0"), "" );
|
||||
}
|
||||
|
||||
@ -94,7 +94,7 @@ public void testDeleteAutoRemove()
|
||||
public void testAddIgnoredArtifacts_NullValue()
|
||||
{
|
||||
setFieldValue( "newpattern_2" , "" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_2" );
|
||||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." );
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ public void testAddIgnoredArtifacts_NullValue()
|
||||
public void testAddIgnoredArtifacts_ExistingValue()
|
||||
{
|
||||
setFieldValue( "newpattern_2" , "**/*.sh" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_2" );
|
||||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.sh\" to filetype ignored as it already exists." );
|
||||
}
|
||||
|
||||
@ -110,7 +110,7 @@ public void testAddIgnoredArtifacts_ExistingValue()
|
||||
public void testAddIgnoredArtifacts()
|
||||
{
|
||||
setFieldValue( "newpattern_2" , "**/*.log" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_2" );
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "**/*.log" );
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ public void testAddIgnoredArtifacts()
|
||||
public void testDeleteIgnoredArtifacts()
|
||||
{
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "**/*.log" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[3]/table/tbody/tr[7]/td[2]/a/img" );
|
||||
clickDeleteIcon( "**/*.log" );
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[3]/table.6.0"), "" );
|
||||
}
|
||||
|
||||
@ -127,7 +127,7 @@ public void testDeleteIgnoredArtifacts()
|
||||
public void testAddIndexableContent_NullValue()
|
||||
{
|
||||
setFieldValue( "newpattern_3" , "" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_3" );
|
||||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Unable to process blank pattern." );
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ public void testAddIndexableContent_NullValue()
|
||||
public void testAddIndexableContent_ExistingValue()
|
||||
{
|
||||
setFieldValue( "newpattern_3" , "**/*.xml" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_3" );
|
||||
Assert.assertEquals(getSelenium().getText("//span[@class='errorMessage']"), "Not adding pattern \"**/*.xml\" to filetype indexable-content as it already exists." );
|
||||
}
|
||||
|
||||
@ -143,7 +143,7 @@ public void testAddIndexableContent_ExistingValue()
|
||||
public void testAddIndexableContent()
|
||||
{
|
||||
setFieldValue( "newpattern_3" , "**/*.html" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
|
||||
clickAddIcon( "newpattern_3" );
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "**/*.html" );
|
||||
}
|
||||
|
||||
@ -151,7 +151,7 @@ public void testAddIndexableContent()
|
||||
public void testDeleteIndexableContent()
|
||||
{
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "**/*.html" );
|
||||
clickLinkWithXPath( "//div[@id='contentArea']/div/div[4]/table/tbody/tr[10]/td[2]/a/img" );
|
||||
clickDeleteIcon( "**/*.html" );
|
||||
Assert.assertEquals(getSelenium().getTable("//div[@id='contentArea']/div/div[4]/table.9.0"), "" );
|
||||
}
|
||||
|
||||
@ -180,4 +180,16 @@ public void testUpdateConsumers_UnsetAll()
|
||||
assertPage( "Apache Archiva \\ Administration - Repository Scanning" );
|
||||
}
|
||||
|
||||
private void clickAddIcon( String fieldId )
|
||||
{
|
||||
String xPath = "//preceding::td/input[@id='" + fieldId + "']//following::td/a/img";
|
||||
clickLinkWithLocator( xPath );
|
||||
}
|
||||
|
||||
private void clickDeleteIcon( String pattern )
|
||||
{
|
||||
String xPath = "//preceding::td/code[contains(text(),'" + pattern + "')]//following::td/a/img";
|
||||
clickLinkWithLocator( xPath );
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public class RepositoryTest
|
||||
public void testAddManagedRepoValidValues()
|
||||
{
|
||||
goToRepositoriesPage();
|
||||
clickLinkWithLocator( "//div[@id='contentArea']/div/div/a[@href='/archiva/admin/addRepository.action']" );
|
||||
getSelenium().open( "/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" );
|
||||
@ -40,7 +40,7 @@ public void testAddManagedRepoValidValues()
|
||||
public void testAddManagedRepoInvalidValues()
|
||||
{
|
||||
goToRepositoriesPage();
|
||||
clickLinkWithLocator( "//div[@id='contentArea']/div/div/a[@href='/archiva/admin/addRepository.action']" );
|
||||
getSelenium().open( "/archiva/admin/addRepository.action" ); ;
|
||||
addManagedRepository( "", "" , "" , "", "Maven 2.x Repository", "", "", "" );
|
||||
assertTextPresent( "You must enter a repository identifier." );
|
||||
assertTextPresent( "You must enter a repository name." );
|
||||
@ -105,7 +105,7 @@ public void testDeleteManageRepo()
|
||||
@Test(dependsOnMethods = { "testAddRemoteRepoValidValues" } )
|
||||
public void testAddRemoteRepoNullValues()
|
||||
{
|
||||
clickLinkWithLocator( "//div[@id='contentArea']/div/div/a[@href='/archiva/admin/addRemoteRepository.action']" );
|
||||
getSelenium().open( "/archiva/admin/addRemoteRepository.action" );
|
||||
addRemoteRepository( "" , "" , "" , "" , "" , "" , "Maven 2.x Repository" );
|
||||
assertTextPresent( "You must enter a repository identifier." );
|
||||
assertTextPresent( "You must enter a repository name." );
|
||||
@ -136,7 +136,7 @@ public void testAddRemoteRepoNullURL()
|
||||
@Test(dependsOnMethods = { "testDeleteManageRepo" } )
|
||||
public void testAddRemoteRepoValidValues()
|
||||
{
|
||||
clickLinkWithLocator( "//div[@id='contentArea']/div/div/a[@href='/archiva/admin/addRemoteRepository.action']" );
|
||||
getSelenium().open( "/archiva/admin/addRemoteRepository.action" );
|
||||
addRemoteRepository( "remoterepo" , "Remote Repository Sample" , "http://repository.codehaus.org/org/codehaus/mojo/" , "" , "" , "" , "Maven 2.x Repository" );
|
||||
assertTextPresent( "Remote Repository Sample" );
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ public void testAddRepositoryToRepositoryGroup()
|
||||
@Test(dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } )
|
||||
public void testDeleteRepositoryOfRepositoryGroup()
|
||||
{
|
||||
goToRepositoryGroupsPage();
|
||||
deleteRepositoryInRepositoryGroups();
|
||||
assertTextPresent( "Repository Groups" );
|
||||
assertTextNotPresent( "No Repository Groups Defined." );
|
||||
|
@ -146,7 +146,7 @@ public void assertLoginPage()
|
||||
//User Management
|
||||
public void goToUserManagementPage()
|
||||
{
|
||||
clickLinkWithText( "User Management" );
|
||||
getSelenium().open( "/archiva/security/userlist.action" );
|
||||
assertUserManagementPage();
|
||||
}
|
||||
|
||||
@ -216,7 +216,7 @@ public void createUser( String userName, String fullName, String email, String p
|
||||
private void createUser( String userName, String fullName, String emailAd, String password, String confirmPassword, boolean valid )
|
||||
{
|
||||
//login( getAdminUsername() , getAdminPassword() );
|
||||
clickLinkWithText( "User Management" );
|
||||
getSelenium().open( "/archiva/security/userlist.action" );
|
||||
clickButtonWithValue( "Create New User" );
|
||||
assertCreateUserPage();
|
||||
setFieldValue( "user.username", userName );
|
||||
@ -409,7 +409,7 @@ else if ( role.equals( "Global Repository Manager" ) || role.equals( "Repository
|
||||
//Find Artifact
|
||||
public void goToFindArtifactPage()
|
||||
{
|
||||
clickLinkWithText( "Find Artifact" );
|
||||
getSelenium().open( "/archiva/findArtifact.action" );
|
||||
assertFindArtifactPage();
|
||||
}
|
||||
|
||||
@ -426,7 +426,7 @@ public void assertFindArtifactPage()
|
||||
//Appearance
|
||||
public void goToAppearancePage()
|
||||
{
|
||||
clickLinkWithText( "Appearance" );
|
||||
getSelenium().open( "/archiva/admin/configureAppearance.action" );
|
||||
assertAppearancePage();
|
||||
}
|
||||
|
||||
@ -452,7 +452,7 @@ public void addEditAppearance( String name, String url, String logoUrl )
|
||||
// Upload Artifact
|
||||
public void goToAddArtifactPage()
|
||||
{
|
||||
clickLinkWithText( "Upload Artifact" );
|
||||
getSelenium().open( "/archiva/upload.action" );
|
||||
assertAddArtifactPage();
|
||||
}
|
||||
|
||||
@ -522,7 +522,7 @@ public void goToRepositoriesPage()
|
||||
{
|
||||
if( !getTitle().equals( "Apache Archiva \\ Administration - Repositories" ) )
|
||||
{
|
||||
clickLinkWithText( "Repositories" );
|
||||
getSelenium().open( "/archiva/admin/repositories.action" );
|
||||
}
|
||||
assertRepositoriesPage();
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ public String getRepositoryId()
|
||||
public void goToDeleteArtifactPage()
|
||||
{
|
||||
login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
|
||||
clickLinkWithText( "Delete Artifact" );
|
||||
getSelenium().open( "/archiva/deleteArtifact.action" );
|
||||
assertDeleteArtifactPage();
|
||||
}
|
||||
|
||||
@ -74,7 +74,7 @@ public void assertDeleteArtifactPage()
|
||||
// Legacy Support
|
||||
public void goToLegacySupportPage()
|
||||
{
|
||||
clickLinkWithText( "Legacy Support" );
|
||||
getSelenium().open( "/archiva/admin/legacyArtifactPath.action" );
|
||||
assertLegacySupportPage();
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public abstract class AbstractArtifactReportsTest
|
||||
//Reports
|
||||
public void goToReportsPage()
|
||||
{
|
||||
clickLinkWithText( "Reports" );
|
||||
getSelenium().open( "/archiva/report/pickReport.action" );
|
||||
assertReportsPage();
|
||||
}
|
||||
|
||||
@ -77,4 +77,4 @@ public void compareRepositories( String labelSelected, String startDate, String
|
||||
clickButtonWithValue( "View Statistics" );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public abstract class AbstractBrowseTest
|
||||
//Browse
|
||||
public void goToBrowsePage()
|
||||
{
|
||||
clickLinkWithText( "Browse" );
|
||||
getSelenium().open( "/archiva/browse" );
|
||||
assertBrowsePage();
|
||||
}
|
||||
|
||||
@ -37,4 +37,4 @@ public void assertBrowsePage()
|
||||
assertTextPresent( "Groups" );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public void goToRepositoryGroupsPage()
|
||||
{
|
||||
if( !getTitle().equals( "Apache Archiva \\ Administration - Repository Groups" ) )
|
||||
{
|
||||
clickLinkWithText( "Repository Groups" );
|
||||
getSelenium().open( "/archiva/admin/repositoryGroups.action" );
|
||||
}
|
||||
assertRepositoryGroupsPage();
|
||||
}
|
||||
@ -67,7 +67,7 @@ public void assertDeleteRepositoryGroupPage( String repositoryName)
|
||||
assertPage( "Apache Archiva \\ Admin: Delete Repository Group" );
|
||||
assertTextPresent( "WARNING: This operation can not be undone." );
|
||||
assertTextPresent( "Are you sure you want to delete the following repository group?" );
|
||||
assertTextPresent( "ID: " + repositoryName );
|
||||
assertElementPresent( "//preceding::td[text()='ID:']//following::td/code[text()='" + repositoryName + "']" );
|
||||
assertButtonWithValuePresent( "Confirm" );
|
||||
assertButtonWithValuePresent( "Cancel" );
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user