directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seelm...@apache.org
Subject [directory-studio] branch master updated: Need to wait until item is in tree
Date Sun, 20 May 2018 14:19:34 GMT
This is an automated email from the ASF dual-hosted git repository.

seelmann pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/directory-studio.git


The following commit(s) were added to refs/heads/master by this push:
     new 632c199  Need to wait until item is in tree
632c199 is described below

commit 632c199f21c1d846328b819cf929c15490d15c4d
Author: Stefan Seelmann <mail@stefan-seelmann.de>
AuthorDate: Sun May 20 16:19:25 2018 +0200

    Need to wait until item is in tree
---
 .../test/integration/ui/bots/BrowserWidgetBot.java | 37 ++++++++++++++++++----
 1 file changed, 30 insertions(+), 7 deletions(-)

diff --git a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
index fe265c8..d42bb9f 100644
--- a/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
+++ b/tests/test.integration.ui/src/main/java/org/apache/directory/studio/test/integration/ui/bots/BrowserWidgetBot.java
@@ -136,10 +136,7 @@ class BrowserWidgetBot
             }
             else
             {
-                // adjust current path, because the label is decorated with the
-                // number of children
-                node = adjustNodeName( entry, node );
-                entry = entry.getNode( node );
+                entry = getChild(entry, node);
             }
 
             if ( !pathList.isEmpty() )
@@ -211,9 +208,35 @@ class BrowserWidgetBot
     }
 
 
-    private String adjustNodeName( SWTBotTreeItem child, String nodeName )
+    private SWTBotTreeItem getChild( SWTBotTreeItem entry, String nodeName )
     {
-        List<String> nodes = child.getNodes();
+        // adjust current path, because the label is decorated with the number of children
+        bot.waitUntil( new DefaultCondition()
+        {
+
+            @Override
+            public boolean test() throws Exception
+            {
+                String adjustedNodeName = adjustNodeName( entry, nodeName );
+                return adjustedNodeName != null;
+            }
+
+
+            @Override
+            public String getFailureMessage()
+            {
+                return "Node " + nodeName + " not found";
+            }
+        } );
+
+        String adjustedNodeName = adjustNodeName( entry, nodeName );
+        return entry.getNode( adjustedNodeName );
+    }
+
+
+    private String adjustNodeName( SWTBotTreeItem entry, String nodeName )
+    {
+        List<String> nodes = entry.getNodes();
         for ( String node : nodes )
         {
             if ( node.toUpperCase().startsWith( nodeName.toUpperCase() ) )
@@ -221,7 +244,7 @@ class BrowserWidgetBot
                 return node;
             }
         }
-        return nodeName;
+        return null;
     }
 
 

-- 
To stop receiving notification emails like this one, please contact
seelmann@apache.org.

Mime
View raw message