[jbosstools-commits] JBoss Tools SVN: r43105 - in branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser: portlet and 1 other directory.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Mon Aug 20 04:03:37 EDT 2012


Author: ljelinko
Date: 2012-08-20 04:03:37 -0400 (Mon, 20 Aug 2012)
New Revision: 43105

Modified:
   branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/PageSourceMatcher.java
   branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/portlet/PortletLoadsInJBPortalMatcher.java
Log:
Changed simple string to regex (to match on Windows)

Modified: branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/PageSourceMatcher.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/PageSourceMatcher.java	2012-08-17 23:18:58 UTC (rev 43104)
+++ branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/PageSourceMatcher.java	2012-08-20 08:03:37 UTC (rev 43105)
@@ -1,5 +1,8 @@
 package org.jboss.tools.portlet.ui.bot.matcher.browser;
 
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
 import org.eclipse.swtbot.swt.finder.waits.DefaultCondition;
 import org.eclipse.swtbot.swt.finder.widgets.TimeoutException;
 import org.hamcrest.Description;
@@ -76,7 +79,10 @@
 			if ("".equals(expectedText)){
 				return pageText.equals(expectedText);
 			}
-			return pageText.contains(expectedText);
+			System.out.println(pageText);
+			Pattern p = Pattern.compile(expectedText, Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
+	        Matcher m = p.matcher(pageText);
+			return m.matches();
 		}
 
 		@Override

Modified: branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/portlet/PortletLoadsInJBPortalMatcher.java
===================================================================
--- branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/portlet/PortletLoadsInJBPortalMatcher.java	2012-08-17 23:18:58 UTC (rev 43104)
+++ branches/jbosstools-3.3.x/portlet/tests/org.jboss.tools.portlet.ui.bot.test/src/org/jboss/tools/portlet/ui/bot/matcher/browser/portlet/PortletLoadsInJBPortalMatcher.java	2012-08-20 08:03:37 UTC (rev 43105)
@@ -28,7 +28,7 @@
 	public boolean matchesSafely(PortletDefinition portletTitle) {
 		pageMatcher = new PageSourceMatcher(PORTAL_URL + portletTitle.getPage(), duration);
 		pageMatcher.setBot(getBot());
-		return pageMatcher.matchesSafely("<span class=\"portlet-titlebar-title\">" + portletTitle.getDisplayName() + "</span>");
+		return pageMatcher.matchesSafely(".*<span class=(.?\")?portlet-titlebar-title(.?\")?>" + portletTitle.getDisplayName() + "</span>.*");
 	}
 
 	@Override



More information about the jbosstools-commits mailing list