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." );
}
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" );
}
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." );
}
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" ), "" );
}
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." );
}
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." );
}
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" );
}
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" ), "" );
}
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." );
}
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." );
}
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" );
}
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" ), "" );
}
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." );
}
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." );
}
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" );
}
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" ), "" );
}
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 );
+ }
-}
\ No newline at end of file
+}
// User Management
public void goToUserManagementPage()
{
- clickLinkWithText( "User Management" );
+ getSelenium().open( "/archiva/security/userlist.action" );
assertUserManagementPage();
}
boolean valid )
{
// login( getAdminUsername() , getAdminPassword() );
- clickLinkWithText( "User Management" );
+ getSelenium().open( "/archiva/security/userlist.action" );
clickButtonWithValue( "Create New User" );
assertCreateUserPage();
setFieldValue( "user.username", userName );
// Find Artifact
public void goToFindArtifactPage()
{
- clickLinkWithText( "Find Artifact" );
+ getSelenium().open( "/archiva/findArtifact.action" );
assertFindArtifactPage();
}
// Appearance
public void goToAppearancePage()
{
- clickLinkWithText( "Appearance" );
+ getSelenium().open( "/archiva/admin/configureAppearance.action" );
assertAppearancePage();
}
// Upload Artifact
public void goToAddArtifactPage()
{
- clickLinkWithText( "Upload Artifact" );
+ getSelenium().open( "/archiva/upload.action" );
assertAddArtifactPage();
}
{
if ( !getTitle().equals( "Apache Archiva \\ Administration - Repositories" ) )
{
- clickLinkWithText( "Repositories" );
+ getSelenium().open( "/archiva/admin/repositories.action" );
}
assertRepositoriesPage();
}
assertLinkNotPresent( "Logout" );
assertLinkPresent( "Login" );
}
-}
\ No newline at end of file
+}