[pitivi] dogtail tests: Set the typingDelay back to defaults and improve the prefs test



commit 86a787a6d3133375165479d1838a5aada93914e1
Author: Jean-FranÃois Fortin Tam <nekohayo gmail com>
Date:   Mon Nov 12 23:14:05 2012 -0500

    dogtail tests: Set the typingDelay back to defaults and improve the prefs test
    
    By default, dogtail uses a typingDelay of 0.075 seconds, which is fast enough.
    Setting it too low will make it type the characters in a random order,
    as observed in https://fedorahosted.org/dogtail/ticket/23

 tests/dogtail_scripts/test_base.py          |    5 +++--
 tests/dogtail_scripts/test_dialogs_prefs.py |   21 ++++++++-------------
 2 files changed, 11 insertions(+), 15 deletions(-)
---
diff --git a/tests/dogtail_scripts/test_base.py b/tests/dogtail_scripts/test_base.py
index cbdc1fb..38e35a3 100644
--- a/tests/dogtail_scripts/test_base.py
+++ b/tests/dogtail_scripts/test_base.py
@@ -11,10 +11,11 @@ class BaseDogTail(unittest.TestCase):
         # Force the locale/language to English.
         # Otherwise we won't be able to grab the right widgets.
         os.environ["LC_ALL"] = 'C'
-        # Try to speed up UI interaction a little
+        # Try to speed up UI interaction a little.
+        # Do not change "typingDelay" from its default (0.075 secs);
+        # Setting it too low makes dogtail type characters in random order!
         from dogtail.config import config
         config.load({'actionDelay': 0.1,
-                     'typingDelay': 0.02,
                      'runTimeout': 1,
                      'searchCutoffCount': 5,
                      'defaultDelay': 0.1})
diff --git a/tests/dogtail_scripts/test_dialogs_prefs.py b/tests/dogtail_scripts/test_dialogs_prefs.py
index 42cc6d8..8f945d6 100644
--- a/tests/dogtail_scripts/test_dialogs_prefs.py
+++ b/tests/dogtail_scripts/test_dialogs_prefs.py
@@ -10,22 +10,17 @@ class DialogsPreferencesTest(HelpFunc):
         dogtail.rawinput.pressKey("Esc")
         self.menubar.menu("Edit").click()
         self.menubar.menuItem("Preferences").click()
-        dialog = self.pitivi.child(name="Preferences", roleName="dialog")
+        dialog = self.pitivi.child(name="Preferences", roleName="dialog", recursive=False)
         dialog.child("Reset to Factory Settings", roleName="push button").click()
 
         # Set a different font
         dialog.child(name="Sans", roleName="push button").click()
-        fontchooser = self.pitivi.child(name="Pick a Font", roleName="dialog")
-        # Perf hack: do a search to reduce the amount of table cells displayed,
-        # otherwise dogtail will take ages to search for it.
-        # But even if the search entry is focused by default, you can't do
-        # dogtail.rawinput.typeText("cantarell bold")
-        # Because it types randomized letters (in dogtail 0.8.1).
-        # So here's a positional hack:
-        search_entry = fontchooser.children[0].children[0].children[0].children[4]
-        # Search for a very specific font, to avoid scrolling, which would
-        # make it impossible to click the first item in the search results
-        search_entry.text = "cantarell bold"
+        fontchooser = self.pitivi.child(name="Pick a Font", roleName="dialog", recursive=False)
+        # Perf hack: do a search to reduce the amount of table cells displayed
+        # (otherwise dogtail will take ages to search for it) and to prevent
+        # scrolling (so we can just click the first item in the search results).
+        # Since the search entry is focused by default, just start typing:
+        dogtail.rawinput.typeText("cantarell bold")
         # Ideally I'd search the child table cells, but this is way too slow,
         # so let's just pick the first item in the search results:
         fontchooser.child(roleName="table cell").click()
@@ -47,7 +42,7 @@ class DialogsPreferencesTest(HelpFunc):
         dogtail.rawinput.pressKey("Esc")
         self.menubar.menu("Edit").click()
         self.menubar.menuItem("Preferences").click()
-        dialog = self.pitivi.child(name="Preferences", roleName="dialog")
+        dialog = self.pitivi.child(name="Preferences", roleName="dialog", recursive=False)
 
         # Check if the previous values were correctly saved
         # In the case of the font, just search if such an item exists:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]