You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by br...@apache.org on 2012/11/21 08:41:11 UTC

svn commit: r1412000 - in /continuum/trunk: continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/ continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/ continuum-webapp/src/main/webapp/WEB-INF/jsp/components/

Author: brett
Date: Wed Nov 21 07:41:10 2012
New Revision: 1412000

URL: http://svn.apache.org/viewvc?rev=1412000&view=rev
Log:
make the build definition test able to run again

More precise selection of the build definition to delete so that subsequent runs still pass after more are added

Modified:
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java
    continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
    continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/buildDefinitionSummaryComponent.jsp

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java?rev=1412000&r1=1411999&r2=1412000&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/BuildDefinitionTest.java Wed Nov 21 07:41:10 2012
@@ -19,11 +19,15 @@ package org.apache.continuum.web.test;
  * under the License.
  */
 
+import junit.framework.Assert;
 import org.apache.continuum.web.test.parent.AbstractAdminTest;
 import org.testng.annotations.BeforeClass;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 /**
  * @author José Morales Martínez
  * @version $Id$
@@ -55,6 +59,8 @@ public class BuildDefinitionTest
 
     private String projectName;
 
+    private String buildDefinitionId;
+
     @BeforeClass
     public void createProject()
     {
@@ -208,6 +214,11 @@ public class BuildDefinitionTest
         clickLinkWithXPath( "//input[contains(@id,'buildDefinition')]" );
         addEditGroupBuildDefinition( null, buildDefinitionPomName, buildDefinitionGoals, buildDefinitionArguments,
                                      buildDefinitionDescription, false, false, false );
+        String value = getSelenium().getAttribute(
+            "xpath=(//a[contains(@href,'removeProjectBuildDefinition')])[last()]/@href" );
+        Matcher m = Pattern.compile( "^.*buildDefinitionId=([0-9]+).*$" ).matcher( value );
+        Assert.assertTrue( m.matches() );
+        buildDefinitionId = m.group( 1 );
     }
 
     public void testAddNotDefaultProjectBuildDefinitionWithLongMavenGoal()
@@ -225,7 +236,7 @@ public class BuildDefinitionTest
     {
         goToProjectInformationPage( projectGroupName, projectName );
         // Click in Delete Image
-        clickLinkWithXPath( "(//a[contains(@href,'removeProjectBuildDefinition')])//img" );
+        clickLinkWithLocator( "id=remove-build-definition-" + buildDefinitionId );
         assertDeleteBuildDefinitionPage( buildDefinitionDescription, buildDefinitionGoals );
         clickButtonWithValue( "Delete" );
         assertProjectInformationPage();

Modified: continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java?rev=1412000&r1=1411999&r2=1412000&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java (original)
+++ continuum/trunk/continuum-webapp-test/src/test/testng/org/apache/continuum/web/test/parent/AbstractSeleniumTest.java Wed Nov 21 07:41:10 2012
@@ -314,7 +314,7 @@ public abstract class AbstractSeleniumTe
         clickLinkWithLocator( "xpath=" + xpath, wait );
     }
 
-    void clickLinkWithLocator( String locator )
+    protected void clickLinkWithLocator( String locator )
     {
         clickLinkWithLocator( locator, true );
     }

Modified: continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/buildDefinitionSummaryComponent.jsp
URL: http://svn.apache.org/viewvc/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/buildDefinitionSummaryComponent.jsp?rev=1412000&r1=1411999&r2=1412000&view=diff
==============================================================================
--- continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/buildDefinitionSummaryComponent.jsp (original)
+++ continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/buildDefinitionSummaryComponent.jsp Wed Nov 21 07:41:10 2012
@@ -109,7 +109,8 @@
                 <s:param name="struts.token.name">struts.token</s:param>
                 <s:param name="struts.token"><s:property value="struts.token"/></s:param>
               </s:url>
-              <s:a href="%{removeUrl}"><img src="<s:url value='/images/delete.gif' includeParams="none"/>" alt="<s:text name='delete'/>" title="<s:text name='delete'/>" border="0"></s:a>
+              <s:set id="removeId">remove-build-definition-${pageScope.buildDefinitionSummary.id}</s:set>
+              <s:a href="%{removeUrl}" id="%{removeId}"><img src="<s:url value='/images/delete.gif' includeParams="none"/>" alt="<s:text name='delete'/>" title="<s:text name='delete'/>" border="0"></s:a>
             </redback:ifAuthorized>
             <redback:elseAuthorized>
               <img src="<s:url value='/images/delete_disabled.gif' includeParams="none"/>" alt="<s:text name='delete'/>" title="<s:text name='delete'/>" border="0" />