[jbosstools-commits] JBoss Tools SVN: r42715 - trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Jul 25 13:07:55 EDT 2012


Author: vpakan at redhat.com
Date: 2012-07-25 13:07:55 -0400 (Wed, 25 Jul 2012)
New Revision: 42715

Modified:
   trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java
Log:
Added method waitForToolbarButtonWithTooltipIsFound().

Modified: trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java
===================================================================
--- trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java	2012-07-25 15:12:16 UTC (rev 42714)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java	2012-07-25 17:07:55 UTC (rev 42715)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Copyright (c) 2007-2012 Red Hat, Inc.
  * Distributed under license by Red Hat, Inc. All rights reserved.
  * This program is made available under the terms of the
  * Eclipse Public License v1.0 which accompanies this distribution,
@@ -962,5 +962,37 @@
       },
       timeout);
     }
-
+    /**
+     * Waits until toolbarButton is with tooltip is found with timeout  
+     * @param tooltip
+     * @param timeout
+     */
+    public void waitForToolbarButtonWithTooltipIsFound (final String tooltip, final long timeout) {
+      bot.waitUntil(new ICondition() {
+        
+        @Override
+        public boolean test() throws Exception {
+          boolean toolbarButtonIsFound = false;
+          try {
+            bot.toolbarButtonWithTooltip(tooltip);
+            toolbarButtonIsFound = true;
+          }
+          catch (WidgetNotFoundException wnfe){
+            toolbarButtonIsFound = false;
+          }
+          return toolbarButtonIsFound;
+        }
+        
+        @Override
+        public void init(SWTBot bot) {
+        }
+        
+        @Override
+        public String getFailureMessage() {
+          return "Tooolbar button with tooltip " + tooltip +
+              " was not available " + timeout + " miliseconds";
+        }
+      },
+      timeout);
+    }
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list