uitest/writer_tests8/customizeDialog.py |   17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

New commits:
commit b98eec284718e91d85cb0f4003e1fac7869e2185
Author:     Xisco Fauli <xiscofa...@libreoffice.org>
AuthorDate: Tue Apr 21 12:55:06 2020 +0200
Commit:     Xisco FaulĂ­ <xiscofa...@libreoffice.org>
CommitDate: Tue Apr 21 15:07:00 2020 +0200

    uitest: use while loop instead of time.sleep
    
    Execution times goes from 3.807 to 2.718 for me
    
    Change-Id: I9c93417d2678c64a8d9a90b0a18b4d1210c8fdd2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92624
    Tested-by: Jenkins
    Reviewed-by: Xisco FaulĂ­ <xiscofa...@libreoffice.org>

diff --git a/uitest/writer_tests8/customizeDialog.py 
b/uitest/writer_tests8/customizeDialog.py
index fa187c36ac35..92fddfdff3b4 100644
--- a/uitest/writer_tests8/customizeDialog.py
+++ b/uitest/writer_tests8/customizeDialog.py
@@ -10,7 +10,6 @@ from uitest.framework import UITestCase
 from libreoffice.uno.propertyvalue import mkPropertyValues
 from uitest.uihelper.common import get_state_as_dict
 from uitest.uihelper.common import select_pos
-from uitest.debug import sleep
 
 class ConfigureDialog(UITestCase):
 
@@ -39,17 +38,25 @@ class ConfigureDialog(UITestCase):
         xSearch.executeAction("SET", mkPropertyValues({"TEXT":"format"}))
 
         # Wait for the search/filter op to be completed
-        time.sleep(1)
+        timeout = time.time() + 1
+        while time.time() < timeout:
+            filteredEntryCount = get_state_as_dict(xfunc)["Children"]
+            if filteredEntryCount != initialEntryCount:
+                break
+            time.sleep(0.1)
 
-        filteredEntryCount = get_state_as_dict(xfunc)["Children"]
         self.assertTrue(filteredEntryCount < initialEntryCount)
 
         xSearch.executeAction("CLEAR", tuple())
 
         # Wait for the search/filter op to be completed
-        time.sleep(1)
+        timeout = time.time() + 1
+        while time.time() < timeout:
+            finalEntryCount = get_state_as_dict(xfunc)["Children"]
+            if finalEntryCount != filteredEntryCount:
+                break
+            time.sleep(0.1)
 
-        finalEntryCount = get_state_as_dict(xfunc)["Children"]
         self.assertEqual(initialEntryCount, finalEntryCount)
 
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to