]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1394] - Replace the use of clickLinkWithText() with getSelenium().open() for...
authorJevica Arianne B. Zurbano <jzurbano@apache.org>
Sun, 4 Jul 2010 11:27:10 +0000 (11:27 +0000)
committerJevica Arianne B. Zurbano <jzurbano@apache.org>
Sun, 4 Jul 2010 11:27:10 +0000 (11:27 +0000)
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

archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/AuditLogsReportTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/RepositoryScanningTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/VirtualRepositoryTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArchivaTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactManagementTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractArtifactReportsTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractBrowseTest.java
archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractRepositoryTest.java

index a99c44325a4e41bca8d9f034c0e747d490f06800..5754a2347f973b040cb72bfaee6806b48c0a94c2 100644 (file)
@@ -28,7 +28,7 @@ public class AuditLogsReportTest
 {
     private void goToAuditLogReports()
     {
-        clickLinkWithText( "Audit Log Report" );
+        getSelenium().open( "/archiva/report/queryAuditLogReport.action" );
     }
 
     private void assertAuditLogsReportPage()
@@ -188,4 +188,4 @@ public class AuditLogsReportTest
         assertTextPresent( expectedArtifact );
         assertTextPresent( repositoryId );
     }
-}
\ No newline at end of file
+}
index c5fde87df0e83f0d83181546c9f78e6f3d41c6c8..52af8a375a31c41e483c775b7cd519dfed0e47ae 100644 (file)
@@ -50,6 +50,7 @@ public class BrowseTest
         assertBrowsePage();
     }
 
+    @Test( dependsOnMethods = { "testAddArtifactValidValues" } )
     public void testClickArtifactFromBrowse()
     {
         goToBrowsePage();
index 64559dec29eb3c728660a308a3e70c959de2929c..82ff698f22aae08922501c7f7f413db61a58238d 100644 (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" ), "" );
     }
 
@@ -184,5 +184,17 @@ 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 );
+    }
 
-}
\ No newline at end of file
+}
index 7054c495e07ead38fb52da14430f2acdb85ac2e5..40a1182209f6ea648740838f781db4ee64fa9c6b 100644 (file)
@@ -51,6 +51,7 @@ public class VirtualRepositoryTest
     @Test( dependsOnMethods = { "testAddRepositoryToRepositoryGroup" } )
     public void testDeleteRepositoryOfRepositoryGroup()
     {
+        goToRepositoryGroupsPage();
         deleteRepositoryInRepositoryGroups();
         assertTextPresent( "Repository Groups" );
         assertTextNotPresent( "No Repository Groups Defined." );
@@ -65,4 +66,4 @@ public class VirtualRepositoryTest
         assertTextPresent( "No Repository Groups Defined." );
     }
 
-}
\ No newline at end of file
+}
index af29cadcbe4a38eeea29c6a57f5b4e1f0a9bded4..815895875203342f0d99da89f6acca672925816a 100644 (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();
     }
@@ -570,4 +570,4 @@ public abstract class AbstractArchivaTest
         assertLinkNotPresent( "Logout" );
         assertLinkPresent( "Login" );
     }
-}
\ No newline at end of file
+}
index e73e0800963f294c011dc2ab6690d7b96575ac4d..c82ac31752669e0e1c823665bed7a8812bfc8fe8 100644 (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();
     }
 
@@ -130,4 +130,4 @@ public abstract class AbstractArtifactManagementTest
             assertElementPresent( arrayelement );
         assertButtonWithValuePresent( "Add Legacy Artifact Path" );
     }
-}
\ No newline at end of file
+}
index ce5ad2aa00f1c116dd91fd8e4e9846fc58e94afb..e026f78057a52f041c371b26bb843a65010b4915 100644 (file)
@@ -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 abstract class AbstractArtifactReportsTest
         clickButtonWithValue( "View Statistics" );
     }
 
-}
\ No newline at end of file
+}
index 3de6c4fd6f50254e4315cb2e1e778bbab68233c7..2b4fc1194abb23a27e9f78db835678804c90231c 100644 (file)
@@ -26,7 +26,7 @@ public abstract class AbstractBrowseTest
     // Browse
     public void goToBrowsePage()
     {
-        clickLinkWithText( "Browse" );
+        getSelenium().open( "/archiva/browse" );
         assertBrowsePage();
     }
 
@@ -37,4 +37,4 @@ public abstract class AbstractBrowseTest
         assertTextPresent( "Groups" );
     }
 
-}
\ No newline at end of file
+}
index 2ac76bd81345e5dae88a82f5c7677bc13c07fd73..2dce7f1ee69f7b5d1902fee4f69ba3bf5ad0f119 100644 (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();
     }
@@ -383,4 +383,4 @@ public abstract class AbstractRepositoryTest
         assertTextPresent( "Database - Unprocessed Artifacts Scanning" );
         assertTextPresent( "Database - Artifact Cleanup Scanning" );
     }
-}
\ No newline at end of file
+}