diff options
author | Xisco Fauli <xiscofauli@libreoffice.org> | 2020-05-21 19:32:58 +0200 |
---|---|---|
committer | Xisco Faulí <xiscofauli@libreoffice.org> | 2020-05-22 20:05:06 +0200 |
commit | 4534d8146f383f75df5f6f4ba2cfe547bcf66a4b (patch) | |
tree | 27e9c5998a1400141ffabbe5a7ac4524acc2a0bd /uitest/uitest | |
parent | 2674248307e11e113f28680c2a13be0c8103be24 (diff) |
uitest: Add wait methods for slow elements
some elements take some time to be updated, specially
with slow machines or ASan+UBSan builds
Use the same time based approach used for launching the dialogs
also reintroduce 634ce6f2d87a30b8abd2e8c67668e3bb5d87406b
Change-Id: Ia1cca74474ef65578bbc60a53a8a511402a082b6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94648
Tested-by: Xisco Faulí <xiscofauli@libreoffice.org>
Reviewed-by: Xisco Faulí <xiscofauli@libreoffice.org>
Diffstat (limited to 'uitest/uitest')
-rw-r--r-- | uitest/uitest/test.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/uitest/uitest/test.py b/uitest/uitest/test.py index f0cc1747b02e..ab8f650d548d 100644 --- a/uitest/uitest/test.py +++ b/uitest/uitest/test.py @@ -48,6 +48,24 @@ class UITest(object): if component is not None: return component + def wait_until_child_is_available(self, parent, childName): + time_ = 0 + while time_ < MAX_WAIT: + if childName in parent.getChildren(): + break + else: + time_ += DEFAULT_SLEEP + time.sleep(DEFAULT_SLEEP) + + def wait_until_property_is_updated(self, element, propertyName, value): + time_ = 0 + while time_ < MAX_WAIT: + if get_state_as_dict(element)[propertyName] == value: + break + else: + time_ += DEFAULT_SLEEP + time.sleep(DEFAULT_SLEEP) + def load_file(self, url): desktop = self.get_desktop() with EventListener(self._xContext, "OnLoad") as event: |