[jbosstools-commits] JBoss Tools SVN: r42834 - 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
Thu Aug 2 07:38:50 EDT 2012


Author: vpakan at redhat.com
Date: 2012-08-02 07:38:49 -0400 (Thu, 02 Aug 2012)
New Revision: 42834

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

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-08-02 11:25:51 UTC (rev 42833)
+++ trunk/tests/plugins/org.jboss.tools.ui.bot.ext/src/org/jboss/tools/ui/bot/ext/SWTUtilExt.java	2012-08-02 11:38:49 UTC (rev 42834)
@@ -1077,4 +1077,37 @@
       },
       timeout);
     }
+    /**
+     * Waits until toolbarButton with mnemonicText is found with timeout  
+     * @param text
+     * @param timeout
+     */
+    public void waitForButtonIsFound (final String text, final long timeout) {
+      bot.waitUntil(new ICondition() {
+        
+        @Override
+        public boolean test() throws Exception {
+          boolean buttonIsFound = false;
+          try {
+            bot.button(text);
+            buttonIsFound = true;
+          }
+          catch (WidgetNotFoundException wnfe){
+            buttonIsFound = false;
+          }
+          return buttonIsFound;
+        }
+        
+        @Override
+        public void init(SWTBot bot) {
+        }
+        
+        @Override
+        public String getFailureMessage() {
+          return "Button with text " + text +
+              " was not available " + timeout + " miliseconds";
+        }
+      },
+      timeout);
+    }
 }
\ No newline at end of file



More information about the jbosstools-commits mailing list