From 3eb071ea41d7f064fb92ce76c865d99d3cb55fdd Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Wed, 07 Nov 2012 13:25:39 +0000 Subject: Rework tests to be based on pyatspi only dogtail is not packaged for ubuntu at the moment and dogtail adds another layer which can make it difficult to debug intermittent failures. We might switch back at some point but for now I think it's easier to stay lower level and try to figure out how to improve reliability there. --- (limited to 'tests/shell.py') diff --git a/tests/shell.py b/tests/shell.py index ee190dd..034e316 100644 --- a/tests/shell.py +++ b/tests/shell.py @@ -1,21 +1,19 @@ import sys from time import sleep -from dogtail import tree -from dogtail import predicate -from dogtail import dump +import tree ACTIVITIES_WITH_OBJECT_CHOOSER = ["Read", "Jukebox"] ACTIVITIES_TO_IGNORE = ["Pippy"] def build_activities_list(): - shell = tree.root.child(name="sugar-session", roleName="application") + root = tree.get_root() + shell = root.find_child(name="sugar-session", role_name="application") activities = [] - table = shell.child(name="", roleName="table") - pred = predicate.GenericPredicate(roleName="table cell") - cells = table.findChildren(pred) + table = shell.find_child(role_name="table") + cells = table.find_children(role_name="table cell") for row in [cells[i:i+5] for i in range(0, len(cells), 5)]: activity_name = row[2].text @@ -27,11 +25,11 @@ def build_activities_list(): return activities def launch_and_stop_activity(activity_name): - shell = tree.root.child(name="sugar-session", roleName="application") + root = tree.get_root() + shell = root.find_child(name="sugar-session", role_name="application") - table = shell.child(name="", roleName="table") - pred = predicate.GenericPredicate(roleName="table cell") - cells = table.findChildren(pred) + table = shell.find_child(role_name="table") + cells = table.find_children(role_name="table cell") for row in [cells[i:i+5] for i in range(0, len(cells), 5)]: name = row[2].name @@ -47,26 +45,27 @@ def launch_and_stop_activity(activity_name): print "Stopping %s" % activity_name if activity_name in ACTIVITIES_WITH_OBJECT_CHOOSER: - close_button = shell.child(name="Close", - roleName="push button") - close_button.click() + close_button = shell.find_child(name="Close", + role_name="push button") + close_button.do_action("click") - activity = tree.root.child(name="sugar-activity", - roleName="application") + activity = root.find_child(name="sugar-activity", + role_name="application") - stop_button = activity.child(name="Stop", roleName="push button") - stop_button.click() + stop_button = activity.find_child(name="Stop", role_name="push button") + stop_button.do_action("click") def go_to_list_view(): - shell = tree.root.child(name="sugar-session", roleName="application") + root = tree.get_root() + shell = root.find_child(name="sugar-session", role_name="application") - done_button = shell.child(name="Done", roleName="push button") - done_button.click() + done_button = shell.find_child(name="Done", role_name="push button") + done_button.do_action("click") sleep(10) - radio_button = shell.child(name="List view", roleName="radio button") - radio_button.click() + radio_button = shell.find_child(name="List view", role_name="radio button") + radio_button.do_action("click") def main(): go_to_list_view() @@ -75,9 +74,4 @@ def main(): sleep(10) launch_and_stop_activity(activity) -try: - main() -except tree.SearchError: - print "\nDumping the accessible tree\n" - dump.plain(tree.root) - sys.exit(1) +main() -- cgit v0.9.1