From: Maria Odea B. Ching Date: Mon, 7 Jun 2010 09:56:57 +0000 (+0000) Subject: [MRM-1362] Add simple 'CRUD' pages for project-level metadata along with a "generic... X-Git-Tag: archiva-1.4-M1~923 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a15932eb45a38b894dcc3ab488a24369b86a49eb;p=archiva.git [MRM-1362] Add simple 'CRUD' pages for project-level metadata along with a "generic metadata" plugin 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 --- diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java index 9018a4eda..0b72095a2 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/BrowseTest.java @@ -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, diff --git a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java index 6d93f71a4..61ec5e137 100644 --- a/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java +++ b/archiva-modules/archiva-web/archiva-webapp-test/src/test/testng/org/apache/archiva/web/test/parent/AbstractSeleniumTest.java @@ -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 ) {