]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1362] Add simple 'CRUD' pages for project-level metadata along with a "generic...
authorMaria Odea B. Ching <oching@apache.org>
Mon, 7 Jun 2010 09:56:57 +0000 (09:56 +0000)
committerMaria Odea B. Ching <oching@apache.org>
Mon, 7 Jun 2010 09:56:57 +0000 (09:56 +0000)
o updated selenium test for deleting metadata
o added selenium tests for adding generic metadata property

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@952174 13f79535-47bb-0310-9956-ffa450edef68

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/parent/AbstractSeleniumTest.java

index 9018a4edaa09467af8c0495532adfeea659fd0b8..0b72095a2176409ab5be803acfc05f7d4e5af645 100644 (file)
@@ -139,84 +139,67 @@ public class BrowseTest
         Assert.assertTrue( secondSnapshotVersion.endsWith( "-2" ) );
     }
     
-    public void testMetadataPageDisplay()
+    public void testAddMetadataPropertyEmpty()
     {
         goToBrowsePage();
         clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
         clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
         clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" );
         clickLinkWithText( "Metadata" );
-        
-        assertMinimalMetadataDisplay();
-    }
-    
-    public void testDeleteMetadataDependency()
-    {
-        String depArtifactId = "testArtifactId";
-        
-        goToBrowsePage();
-        clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
-        clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
-        clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" );
-        clickLinkWithText( "Metadata" );
-        
-        assertMinimalMetadataDisplay();
-        assertTextPresent( "dependencies" );
-        assertTextPresent( depArtifactId );
-        
-        String xPath = "//li[contains(text(),'" + depArtifactId + "')]/a/img[contains(@src,'delete.gif')]";
-        clickLinkWithXPath( xPath );
-        
-        assertTextNotPresent( depArtifactId );
+
+        assertTextPresent( "No metadata content." );
+        assertButtonWithValuePresent( "Add" );
+
+        clickButtonWithValue( "Add" );
+
+        waitPage();
+
+        assertTextPresent( "Property Name and Property Value are required." );
     }
-    
-    public void testDeleteMetadataMailingList()
+
+    @Test( dependsOnMethods = { "testAddMetadataPropertyEmpty" } )
+    public void testAddMetadataProperty()
     {
-        String listName = "test user list";
-        
         goToBrowsePage();
         clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
         clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
         clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" );
         clickLinkWithText( "Metadata" );
-        
-        assertMinimalMetadataDisplay();
-        assertTextPresent( "mailingLists" );
-        assertTextPresent( listName );
-        
-        String xPath = "//li[contains(text(),'" + listName + "')]/a/img[contains(@src,'delete.gif')]";
-        clickLinkWithXPath( xPath );
-        
-        assertTextNotPresent( listName );
+
+        assertTextPresent( "No metadata content." );
+        assertButtonWithValuePresent( "Add" );
+
+        setFieldValue( "propertyName", "foo" );
+        setFieldValue( "propertyValue", "bar" );
+
+        clickButtonWithValue( "Add" );
+
+        waitPage();
+
+        assertTextNotPresent( "No metadata content." );
+        assertTextPresent( "foo=bar" );
     }
-    
-    public void testDeleteMetadataLicense()
+
+    @Test( dependsOnMethods = { "testAddMetadataProperty" } )
+    public void testDeleteMetadataProperty()
     {
-        String licenseName = "Test License";
-        
         goToBrowsePage();
         clickLinkWithText( getProperty( "ARTIFACT_GROUPID" ) + "/" );
         clickLinkWithText( getProperty( "ARTIFACT_ARTIFACTID" ) + "/" );
         clickLinkWithText( getProperty( "ARTIFACT_VERSION" ) + "/" );
         clickLinkWithText( "Metadata" );
-        
-        assertMinimalMetadataDisplay();
-        assertTextPresent( "licenses" );
-        assertTextPresent( licenseName );
-        
-        String xPath = "//li[contains(text(),'" + licenseName + "')]/a/img[contains(@src,'delete.gif')]";
-        clickLinkWithXPath( xPath );
-        
-        assertTextNotPresent( licenseName );
-        assertTextNotPresent( "licenses" );
-    }
-    
-    private void assertMinimalMetadataDisplay()
-    {
-        assertTextPresent( "project.metadata.id=" );
-        assertTextPresent( "project.url=" );
-        assertTextPresent( "project.name=" );
-        assertTextPresent( "project.description=" );
+
+        assertTextPresent( "foo=bar" );
+        assertButtonWithValuePresent( "Add" );
+
+        clickImgWithAlt( "Delete" );
+
+        waitPage();
+
+        assertTextNotPresent( "foo=bar" );
+        assertTextPresent( "Property successfully deleted." );
+        assertImgWithAltNotPresent( "Delete" );
+        assertTextPresent( "No metadata content." );
     }
 
     private void assertArtifactInfoPage( String version, String artifactInfoRepositoryId, String artifactInfoGroupId,
index 6d93f71a4faa0503d078913b2c1265a18b3bcbc3..61ec5e137a99656cccac9d8e35b67c67e820e829 100644 (file)
@@ -201,6 +201,11 @@ public abstract class AbstractSeleniumTest
 
         assertElementPresent( locator );
     }
+    
+    public void assertImgWithAltNotPresent( String alt )
+    {
+        assertElementNotPresent( "/¯img[@alt='" + alt + "']" );
+    }
 
     public void assertCellValueFromTable( String expected, String tableElement, int row, int column )
     {