From acc258f5a3de57c7c59c7b67ab34680bc1ec8e5e Mon Sep 17 00:00:00 2001 From: Daniel Narvaez Date: Sat, 30 Jun 2012 19:53:45 +0000 Subject: Handle Read object chooser --- (limited to 'tests') diff --git a/tests/shell.py b/tests/shell.py index 3d2215b..1b94044 100644 --- a/tests/shell.py +++ b/tests/shell.py @@ -1,6 +1,11 @@ from dogtail import tree from dogtail import predicate +class Activity: + def __init__(self, name=None, icon=None): + self.name = name + self.icon = icon + shell = tree.root.child(name="sugar-session", roleName="application") # Complete the intro screen @@ -11,14 +16,24 @@ done_button.click() radio_button = shell.child(name="List view", roleName="radio button") radio_button.click() -# Start and stop all the activities in the table +# Make a list of activities by iterating the table +activities = [] + table = shell.child(name="", roleName="table") cells = table.findChildren(predicate.GenericPredicate(roleName="table cell")) - for row in [cells[i:i+5] for i in range(0, len(cells), 5)]: - print "Launching %s" % row[2].text + activities.append(Activity(name=row[2].text, icon=row[1])) + +# Launch and close all the activities +for activity in activities: + print "Launching %s" % activity.name + + activity.icon.click() - row[1].click() + # Read displays an object chooser, let's close it + if activity.name == "Read": + close_button = shell.child(name="Close", roleName="push button") + close_button.click() activity = tree.root.child(name="sugar-activity", roleName="application") stop_button = activity.child(name="Stop", roleName="push button") -- cgit v0.9.1