diff options
-rw-r--r-- | tests/shell.py | 6 | ||||
-rw-r--r-- | tests/tree.py | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/tests/shell.py b/tests/shell.py index c02b5f5..03d4036 100644 --- a/tests/shell.py +++ b/tests/shell.py @@ -53,6 +53,12 @@ def launch_and_stop_activity(activity_name): stop_button = activity.find_child(name="Stop", role_name="push button") stop_button.do_action("click") + activity = root.find_child(name="sugar-activity", + role_name="application", + expect_none=True) + if activity is not None: + raise RuntimeError + def go_to_list_view(): root = tree.get_root() shell = root.find_child(name="sugar-session", role_name="application") diff --git a/tests/tree.py b/tests/tree.py index fe6d24f..414a900 100644 --- a/tests/tree.py +++ b/tests/tree.py @@ -17,7 +17,9 @@ def retry_find(func): kwargs.get("role_name", None)) result = func(*args, **kwargs) - if result: + expect_none = kwargs.get("expect_none", False) + if (not expect_none and result) or \ + (expect_none and not result): return result time.sleep(5) @@ -43,7 +45,7 @@ class Node: return True @retry_find - def find_child(self, name=None, role_name=None): + def find_child(self, name=None, role_name=None, expect_none=False): def predicate(accessible): return self._predicate(accessible, name, role_name) |