diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2021-06-23 16:11:27 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2021-06-23 23:16:11 +0200 |
commit | 39605d175bc0fe52c904d4b41a184d7e2691f2dc (patch) | |
tree | 4b9fdb3b63260256bf3a5f7b497f43f5421dfaba /uitest | |
parent | d81775f5b12080676ebaf659c5a4c10d64a9074b (diff) |
Introduce wait_for_top_focus_window to fix UITest_calc_tests9
...which I had seen hang at least once, and after a manual `kill -9` of the hung
soffice.bin process (still yielding in UI loop from within executing a dialog),
it failed with
> ======================================================================
> ERROR: test_tdf57841 (tdf57841.Tdf57841)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
> File "sc/qa/uitest/calc_tests9/tdf57841.py", line 27, in test_tdf57841
> self.assertEqual('true', get_state_as_dict(xDialog.getChild("tab"))['Selected'])
> uno.com.sun.star.uno.RuntimeException: Could not find child with id: tab vcl/source/uitest/uiobject.cxx:467
(The subtle difference in naming is that wait_for_top_focus_window waits
indefinitely, while its sister wait_until_* functions (like
wait_until_child_is_available) can time out. There is no good reason here to
allow for timing out.)
Change-Id: I3e4dc68871f42d64160d8e411fe9a661bbaec192
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117739
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'uitest')
-rw-r--r-- | uitest/uitest/test.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index 723878a34e3c..29af1e0899c2 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -49,6 +49,13 @@ class UITest(object): if component is not None: return component + def wait_for_top_focus_window(self, id): + while True: + win = self._xUITest.getTopFocusWindow() + if get_state_as_dict(win)['ID'] == id: + return win + time.sleep(DEFAULT_SLEEP) + def wait_until_child_is_available(self, childName): time_ = 0 xChild = None |