[embjopr-commits] EMBJOPR SVN: r917 - branches/EmbJopr-1.4.0-SN-EAP5/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util.

embjopr-commits at lists.jboss.org embjopr-commits at lists.jboss.org
Thu Apr 8 13:36:57 EDT 2010


Author: ozizka at redhat.com
Date: 2010-04-08 13:36:56 -0400 (Thu, 08 Apr 2010)
New Revision: 917

Modified:
   branches/EmbJopr-1.4.0-SN-EAP5/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
Log:
* Workaround for HTMLUnit XPath bug - this time for the "Next" button in JMS tests.

Modified: branches/EmbJopr-1.4.0-SN-EAP5/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java
===================================================================
--- branches/EmbJopr-1.4.0-SN-EAP5/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java	2010-04-08 17:35:37 UTC (rev 916)
+++ branches/EmbJopr-1.4.0-SN-EAP5/jsfunit/src/test/java/org/jboss/jopr/jsfunit/util/EmbJoprTestToolkit.java	2010-04-08 17:36:56 UTC (rev 917)
@@ -1071,8 +1071,11 @@
 					currentPage++ < 20
 					// Pagination is not rendered if not needed.
 					&& null != getTabMenu().getTabContentBox().getPagination().findPageContols()
+					// Check that there is a "Next" button
+					&& null != getTabMenu().getTabContentBox().getPagination().getGoSpan("Next")
 					// goNext() returns true if there's a next page to go.
 					&& getTabMenu().getTabContentBox().getPagination().goNext()
+
 			);
 
 			return row;
@@ -1831,6 +1834,7 @@
 			// So if their number is the same, return null, which means
 			List allElems    = div.getByXPath("*");
 			List scriptElems = div.getByXPath("script");
+			log.debug("Page controls: all / script elements: "+allElems+" / "+scriptElems);///
 			if( allElems.size() == scriptElems.size() )
 				return null;
 
@@ -1882,11 +1886,11 @@
 		}
 
 		protected HtmlSpan getGoSpan( String spanLabel ) throws HtmlElementNotFoundException {
-			String xPath = ".//span[normalize-space() = '"+spanLabel+"']";
+			String xPath = ".//*[name()='span' and normalize-space() = '"+spanLabel+"']";
 			HtmlSpan span = getPageContols().getFirstByXPath(xPath);
 			if( null == span )
 				throw new HtmlElementNotFoundException(
-								"Span with '"+spanLabel+"' not found using XPath '"+xPath+"'");
+								"Span with '"+spanLabel+"' not found using XPath '"+xPath+"'", currentTest);
 			return span;
 		}
 
@@ -1895,7 +1899,7 @@
 			HtmlElement td = getPageContols().getFirstByXPath(xPath);
 			if( null == td )
 				throw new HtmlElementNotFoundException(
-								"Page number "+pageNumber+" not found. Try 1 - "+this.getPageCount());
+								"Page number "+pageNumber+" not found. Try 1 - "+this.getPageCount(), currentTest);
 			return (HtmlTableCell) td;
 		}
 
@@ -1913,7 +1917,8 @@
 			return !"".equals( ((HtmlTableCell)goSpan.getParentNode()).getOnClickAttribute() );
 		}
 
-		/** Clicks the "Next" link of the pagination controls.
+		/**
+		 * Clicks the "Next" link of the pagination controls.
 		 * @returns true if the "Next" link will not bring us to a new page (has no onClick handler).
 		 */
 		public boolean goNext() throws IOException, HtmlElementNotFoundException{



More information about the embjopr-commits mailing list