[MRM-1394] - Replace the use of clickLinkWithText() with getSelenium().open() for accessing navigation menu pages

merge -r 960310:960311 from 1.3.x branch



git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@960322 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jevica Arianne B. Zurbano 2010-07-04 11:27:10 +00:00
parent 78d78de276
commit 8cfd3806cc
9 changed files with 50 additions and 36 deletions

View File

@ -28,7 +28,7 @@ public class AuditLogsReportTest
{
private void goToAuditLogReports()
{
clickLinkWithText( "Audit Log Report" );
getSelenium().open( "/archiva/report/queryAuditLogReport.action" );
}
private void assertAuditLogsReportPage()

View File

@ -50,6 +50,7 @@ public class BrowseTest
assertBrowsePage();
}
@Test( dependsOnMethods = { "testAddArtifactValidValues" } )
public void testClickArtifactFromBrowse()
{
goToBrowsePage();

View File

@ -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 class RepositoryScanningTest
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 class RepositoryScanningTest
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." );
}
@ -55,7 +55,7 @@ public class RepositoryScanningTest
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" ), "" );
}
@ -63,7 +63,7 @@ public class RepositoryScanningTest
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." );
}
@ -71,7 +71,7 @@ public class RepositoryScanningTest
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." );
}
@ -80,7 +80,7 @@ public class RepositoryScanningTest
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" );
}
@ -88,7 +88,7 @@ public class RepositoryScanningTest
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" ), "" );
}
@ -96,7 +96,7 @@ public class RepositoryScanningTest
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." );
}
@ -105,7 +105,7 @@ public class RepositoryScanningTest
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." );
}
@ -114,7 +114,7 @@ public class RepositoryScanningTest
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" );
}
@ -122,7 +122,7 @@ public class RepositoryScanningTest
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" ), "" );
}
@ -131,7 +131,7 @@ public class RepositoryScanningTest
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." );
}
@ -140,7 +140,7 @@ public class RepositoryScanningTest
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." );
}
@ -149,7 +149,7 @@ public class RepositoryScanningTest
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" );
}
@ -157,7 +157,7 @@ public class RepositoryScanningTest
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" ), "" );
}
@ -185,4 +185,16 @@ public class RepositoryScanningTest
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 );
}
}

View File

@ -51,6 +51,7 @@ public class VirtualRepositoryTest
@Test( dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } )
public void testDeleteRepositoryOfRepositoryGroup()
{
goToRepositoryGroupsPage();
deleteRepositoryInRepositoryGroups();
assertTextPresent( "Repository Groups" );
assertTextNotPresent( "No Repository Groups Defined." );

View File

@ -147,7 +147,7 @@ public abstract class AbstractArchivaTest
// User Management
public void goToUserManagementPage()
{
clickLinkWithText( "User Management" );
getSelenium().open( "/archiva/security/userlist.action" );
assertUserManagementPage();
}
@ -216,7 +216,7 @@ public abstract class AbstractArchivaTest
boolean valid )
{
// login( getAdminUsername() , getAdminPassword() );
clickLinkWithText( "User Management" );
getSelenium().open( "/archiva/security/userlist.action" );
clickButtonWithValue( "Create New User" );
assertCreateUserPage();
setFieldValue( "user.username", userName );
@ -418,7 +418,7 @@ public abstract class AbstractArchivaTest
// Find Artifact
public void goToFindArtifactPage()
{
clickLinkWithText( "Find Artifact" );
getSelenium().open( "/archiva/findArtifact.action" );
assertFindArtifactPage();
}
@ -435,7 +435,7 @@ public abstract class AbstractArchivaTest
// Appearance
public void goToAppearancePage()
{
clickLinkWithText( "Appearance" );
getSelenium().open( "/archiva/admin/configureAppearance.action" );
assertAppearancePage();
}
@ -462,7 +462,7 @@ public abstract class AbstractArchivaTest
// Upload Artifact
public void goToAddArtifactPage()
{
clickLinkWithText( "Upload Artifact" );
getSelenium().open( "/archiva/upload.action" );
assertAddArtifactPage();
}
@ -532,7 +532,7 @@ public abstract class AbstractArchivaTest
{
if ( !getTitle().equals( "Apache Archiva \\ Administration - Repositories" ) )
{
clickLinkWithText( "Repositories" );
getSelenium().open( "/archiva/admin/repositories.action" );
}
assertRepositoriesPage();
}

View File

@ -61,7 +61,7 @@ public abstract class AbstractArtifactManagementTest
public void goToDeleteArtifactPage()
{
login( getProperty( "ADMIN_USERNAME" ), getProperty( "ADMIN_PASSWORD" ) );
clickLinkWithText( "Delete Artifact" );
getSelenium().open( "/archiva/deleteArtifact.action" );
assertDeleteArtifactPage();
}
@ -93,7 +93,7 @@ public abstract class AbstractArtifactManagementTest
// Legacy Support
public void goToLegacySupportPage()
{
clickLinkWithText( "Legacy Support" );
getSelenium().open( "/archiva/admin/legacyArtifactPath.action" );
assertLegacySupportPage();
}

View File

@ -26,7 +26,7 @@ public abstract class AbstractArtifactReportsTest
// Reports
public void goToReportsPage()
{
clickLinkWithText( "Reports" );
getSelenium().open( "/archiva/report/pickReport.action" );
assertReportsPage();
}

View File

@ -26,7 +26,7 @@ public abstract class AbstractBrowseTest
// Browse
public void goToBrowsePage()
{
clickLinkWithText( "Browse" );
getSelenium().open( "/archiva/browse" );
assertBrowsePage();
}

View File

@ -30,7 +30,7 @@ public abstract class AbstractRepositoryTest
{
if ( !getTitle().equals( "Apache Archiva \\ Administration - Repository Groups" ) )
{
clickLinkWithText( "Repository Groups" );
getSelenium().open( "/archiva/admin/repositoryGroups.action" );
}
assertRepositoryGroupsPage();
}