Ejemplo n.º 1
0
    def test_activity_list_palette(self):
        with self.run_view("activitieslist"):
            root = uitree.get_root()

            for name in ["Make favorite", "Erase", "Start new"]:
                node = root.find_child(name=name, role_name="label")
                self.assertIsNotNone(node)
 def test_add_button(self):
     with self.run_activity():
         root = uitree.get_root()
         activity = root.find_child(name="HelloWorld Activity",
                                    role_name="frame")
         label = activity.find_child(name="Hello World!", role_name="label")
         self.assertEqual(label.text, "Hello World!")
 def test_speak(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         all_push_buttons = activity.find_children(role_name="push button")
         uitree.drag(0.05*self.screen_width,
                     0.08*self.screen_height,
                     0.1*self.screen_width,
                     0.1*self.screen_height)
         speak_button = all_push_buttons[5]
         speak_button.click()
         time.sleep(1)
         all_toolbar = activity.find_children(role_name="tool bar")
         speak_toolbar = all_toolbar[1]
         play_button = speak_toolbar.find_child(role_name="toggle button")
         stop_button = speak_toolbar.find_child(role_name="push button")
         play_button.click()
         time.sleep(3)
         self.assertIsNotNone(play_button)
         self.assertIsNotNone(stop_button)
Ejemplo n.º 4
0
def launch_and_stop_activity(activity_name):
    logging.info("Launching %s" % activity_name)

    root = uitree.get_root()
    shell = root.find_child(name="main.py", role_name="application")

    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
        icon = row[1]

        if name == activity_name:
            icon.do_action("activate")

            logging.info("Stopping %s" % activity_name)

            activity = root.find_child(name="sugar-activity",
                                       role_name="application")

            stop_buttons = activity.find_children(name="Stop",
                                                  role_name="push button")
            stop_buttons[-1].do_action("click")

            activity = root.find_child(name="sugar-activity",
                                       role_name="application",
                                       expect_none=True)
            if activity is not None:
                raise RuntimeError
 def test_orignal_size(self):
     uri = os.getcwd() + '/tests/integration/test.png'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Image Viewer Activity",
                                    role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         zoom_out_button = activity.find_child(name="Zoom out",
                                               role_name="push button")
         orignal_size = activity.find_child(name="Original size",
                                            role_name="push button")
         count = 5
         while count:
             zoom_out_button.click()
             time.sleep(0.25)
             count -= 1
         orignal_size.click()
         time.sleep(0.5)
         self.assertIsNotNone(zoom_out_button)
         self.assertIsNotNone(orignal_size)
         time.sleep(1.5)
Ejemplo n.º 6
0
def launch_and_stop_activity(activity_name):
    logging.info("Launching %s" % activity_name)

    root = uitree.get_root()
    shell = root.find_child(name="main.py", role_name="application")

    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
        icon = row[1]

        if name == activity_name:
            icon.do_action("activate")

            logging.info("Stopping %s" % activity_name)

            activity = root.find_child(name="sugar-activity",
                                       role_name="application")

            stop_buttons = activity.find_children(name="Stop",
                                                  role_name="push button")
            stop_buttons[-1].do_action("click")

            activity = root.find_child(name="sugar-activity",
                                       role_name="application",
                                       expect_none=True)
            if activity is not None:
                raise RuntimeError
Ejemplo n.º 7
0
    def test_webaccount(self):
        with self.run_view("webaccount"):
            root = uitree.get_root()

            for name in [ACCOUNT_NAME]:
                node = root.find_child(name=name, role_name='label')
                self.assertIsNotNone(node)
    def test_detail_toolbox(self):
        with self.run_view("journal_detailstoolbox"):
            root = uitree.get_root()

            for name in ['Clipboard', ACCOUNT_NAME]:
                node = root.find_child(name=name, role_name='menu item')
                self.assertIsNotNone(node)
Ejemplo n.º 9
0
 def test_orignal_size(self):
     uri = os.getcwd() + '/tests/integration/test.png'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Image Viewer Activity",
                                    role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         zoom_out_button = activity.find_child(name="Zoom out",
                                               role_name="push button")
         orignal_size = activity.find_child(name="Original size",
                                            role_name="push button")
         count = 5
         while count:
             zoom_out_button.click()
             time.sleep(0.25)
             count -= 1
         orignal_size.click()
         time.sleep(0.5)
         self.assertIsNotNone(zoom_out_button)
         self.assertIsNotNone(orignal_size)
         time.sleep(1.5)
Ejemplo n.º 10
0
 def test_speak(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         all_push_buttons = activity.find_children(role_name="push button")
         uitree.drag(0.05 * self.screen_width, 0.08 * self.screen_height,
                     0.1 * self.screen_width, 0.1 * self.screen_height)
         speak_button = all_push_buttons[5]
         speak_button.click()
         time.sleep(1)
         all_toolbar = activity.find_children(role_name="tool bar")
         speak_toolbar = all_toolbar[1]
         play_button = speak_toolbar.find_child(role_name="toggle button")
         stop_button = speak_toolbar.find_child(role_name="push button")
         play_button.click()
         time.sleep(3)
         self.assertIsNotNone(play_button)
         self.assertIsNotNone(stop_button)
Ejemplo n.º 11
0
    def test_detail_toolbox(self):
        with self.run_view("journal_detailstoolbox"):
            root = uitree.get_root()

            for name in ['Clipboard', ACCOUNT_NAME]:
                node = root.find_child(name=name, role_name='menu item')
                self.assertIsNotNone(node)
Ejemplo n.º 12
0
    def test_webaccount(self):
        with self.run_view("webaccount"):
            root = uitree.get_root()

            for name in [ACCOUNT_NAME]:
                node = root.find_child(name=name, role_name="label")
                self.assertIsNotNone(node)
Ejemplo n.º 13
0
    def _check_activities_palette(self):
        from sugar3.test import uitree

        root = uitree.get_root()

        for name in ["Make favorite", "Erase", "Start new"]:
            node = root.find_child(name=name, role_name="label")
            self.assertIsNotNone(node)
Ejemplo n.º 14
0
    def _check_activities_palette(self):
        from sugar3.test import uitree

        root = uitree.get_root()

        for name in ["Make favorite", "Erase", "Start new"]:
            node = root.find_child(name=name, role_name="label")
            self.assertIsNotNone(node)
Ejemplo n.º 15
0
    def run_view(self, name):
        view_path = os.path.join("views", "%s.py" % name)
        process = subprocess.Popen(["python", view_path])

        try:
            yield
        except:
            logging.debug(uitree.get_root().dump())
            raise
        finally:
            process.terminate()
Ejemplo n.º 16
0
    def run_view(self, name):
        view_path = os.path.join("views", "%s.py" % name)
        process = subprocess.Popen(["python3", view_path])

        try:
            yield
        except BaseException:
            logging.debug(uitree.get_root().dump())
            raise
        finally:
            process.terminate()
    def test_tree(self):
        process = subprocess.Popen(["python", __file__, "show_window1"])

        try:
            root = uitree.get_root()
            window = root.find_child(name="window1", role_name="frame")
            button = window.find_child(name="button1", role_name="push button")
        finally:
            process.terminate()

        self.assertIsNotNone(button)
Ejemplo n.º 18
0
    def test_tree(self):
        process = subprocess.Popen(["python3", __file__, "show_window1"])

        try:
            root = uitree.get_root()
            window = root.find_child(name="window1", role_name="frame")
            button = window.find_child(name="button1", role_name="push button")
        finally:
            process.terminate()

        self.assertIsNotNone(button)
 def get_activity(self):
     root = uitree.get_root()
     #activity = root.find_child(name="Calculate Activity",
     #                           role_name="frame")
     activity = root.find_child(name="Calculate Activity",
                                role_name="frame")
     '''sec = []        
     for i in activity:
         sec.append(i.role_name)        
     return sec'''
     return activity
     '''a = root.find_children()
Ejemplo n.º 20
0
    def run_activity(self):
        if self.bundle_id is not None:
            process = subprocess.Popen(["sugar-launch", self.bundle_id])
        else:
            print "No bundle_id specified."
            return

        try:
            yield
        except:
            logging.debug(uitree.get_root().dump())
            raise
        finally:
            process.terminate()
Ejemplo n.º 21
0
    def run_activity(self):
        if self.bundle_id is not None:
            process = subprocess.Popen(["sugar-launch", self.bundle_id])
        else:
            print "No bundle_id specified."
            return

        try:
            yield
        except:
            logging.debug(uitree.get_root().dump())
            raise
        finally:
            process.terminate()
 def test_zoom(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         time.sleep(2)
         all_push_buttons = activity.find_children(role_name="push button")
         zoom_buttons = all_push_buttons[2]
         zoom_buttons.click()
         zoom_in = activity.find_child(name="Zoom in",
                                       role_name="push button")
         zoom_out = activity.find_child(name="Zoom out",
                                        role_name="push button")
         zoom_width = activity.find_child(name="Zoom to width",
                                          role_name="push button")
         zoom_fit = activity.find_child(name="Zoom to fit",
                                        role_name="push button")
         actual_size = activity.find_child(name="Actual size",
                                           role_name="push button")
         fullscreen = activity.find_child(name="Fullscreen",
                                          role_name="push button")
         rotate_left = activity.find_child(name="Rotate left",
                                           role_name="push button")
         rotate_right = activity.find_child(name="Rotate right",
                                            role_name="push button")
         count = 10
         while count:
             zoom_in.click()
             time.sleep(0.25)
             count -= 1
         count = 5
         while count:
             zoom_out.click()
             time.sleep(0.25)
             count -= 1
         self.assertIsNotNone(zoom_in)
         self.assertIsNotNone(zoom_out)
         self.assertIsNotNone(zoom_width)
         self.assertIsNotNone(zoom_fit)
         self.assertIsNotNone(actual_size)
         self.assertIsNotNone(fullscreen)
         self.assertIsNotNone(rotate_left)
         self.assertIsNotNone(rotate_right)
Ejemplo n.º 23
0
 def test_zoom(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         time.sleep(2)
         all_push_buttons = activity.find_children(role_name="push button")
         zoom_buttons = all_push_buttons[2]
         zoom_buttons.click()
         zoom_in = activity.find_child(name="Zoom in",
                                       role_name="push button")
         zoom_out = activity.find_child(name="Zoom out",
                                        role_name="push button")
         zoom_width = activity.find_child(name="Zoom to width",
                                          role_name="push button")
         zoom_fit = activity.find_child(name="Zoom to fit",
                                        role_name="push button")
         actual_size = activity.find_child(name="Actual size",
                                           role_name="push button")
         fullscreen = activity.find_child(name="Fullscreen",
                                          role_name="push button")
         rotate_left = activity.find_child(name="Rotate left",
                                           role_name="push button")
         rotate_right = activity.find_child(name="Rotate right",
                                            role_name="push button")
         count = 10
         while count:
             zoom_in.click()
             time.sleep(0.25)
             count -= 1
         count = 5
         while count:
             zoom_out.click()
             time.sleep(0.25)
             count -= 1
         self.assertIsNotNone(zoom_in)
         self.assertIsNotNone(zoom_out)
         self.assertIsNotNone(zoom_width)
         self.assertIsNotNone(zoom_fit)
         self.assertIsNotNone(actual_size)
         self.assertIsNotNone(fullscreen)
         self.assertIsNotNone(rotate_left)
         self.assertIsNotNone(rotate_right)
Ejemplo n.º 24
0
 def test_open_file(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         stop_button = activity.find_child(name="Stop",
                                           role_name="push button")
         stop_button.click()
         self.assertIsNotNone(stop_button)
 def test_open_file(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         stop_button = activity.find_child(name="Stop",
                                           role_name="push button")
         stop_button.click()
         self.assertIsNotNone(stop_button)
Ejemplo n.º 26
0
    def _run_activity(self, options=None):
        if self.bundle_id is not None:
            cmd = ["sugar-launch", self.bundle_id]
            if options is not None:
                cmd += options
            process = subprocess.Popen(cmd)
        else:
            print("No bundle_id specified.")
            return

        try:
            yield
        except BaseException:
            logging.debug(uitree.get_root().dump())
            raise
        finally:
            process.terminate()
Ejemplo n.º 27
0
 def test_bookmarks(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         print activity.dump()
         toggle_buttons = activity.find_children(role_name="toggle button")
         bookmark_button = toggle_buttons[0]
         bookmark_button.click()
         time.sleep(1)
         self.assertIsNotNone(bookmark_button)
 def test_bookmarks(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         print activity.dump()
         toggle_buttons = activity.find_children(role_name="toggle button")
         bookmark_button = toggle_buttons[0]
         bookmark_button.click()
         time.sleep(1)
         self.assertIsNotNone(bookmark_button)
Ejemplo n.º 29
0
    def _run_activity(self, options=None):
        if self.bundle_id is not None:
            cmd = ["sugar-launch", self.bundle_id]
            if options is not None:
                cmd += options
            process = subprocess.Popen(cmd)
        else:
            print("No bundle_id specified.")
            return

        try:
            yield
        except BaseException:
            logging.debug(uitree.get_root().dump())
            raise
        finally:
            process.terminate()
 def test_search(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         all_push_buttons = activity.find_children(role_name="push button")
         edit_buttons = all_push_buttons[1]
         edit_buttons.click()
         time.sleep(0.25)
         all_panels = activity.find_children(role_name="panel")
         search_panel = all_panels[20]
         search_box = search_panel.find_child(role_name="text")
         search_box.click(1,
                          0.04*self.screen_width,
                          0.02*self.screen_height)
         time.sleep(0.5)
         uitree.type_text('t')
         time.sleep(1)
         backward_panel = all_panels[21]
         forward_panel = all_panels[22]
         hlight_panel = all_panels[24]
         forward_button = forward_panel.find_child(role_name="push button")
         back_button = backward_panel.find_child(role_name="push button")
         hlight_button = hlight_panel.find_child(role_name="toggle button")
         count = 2
         while count:
             forward_button.click()
             time.sleep(1)
             count -= 1
         hlight_button.click()
         count = 2
         while count:
             back_button.click()
             time.sleep(1)
             count -= 1
         self.assertIsNotNone(forward_button)
         self.assertIsNotNone(back_button)
         self.assertIsNotNone(hlight_button)
         self.assertIsNotNone(search_box)
 def test_check_file(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         all_push_buttons = activity.find_children(role_name="push button")
         activity_buttons = all_push_buttons[0]
         activity_buttons.click()
         time.sleep(1)
         all_content = activity.find_children(role_name="text")
         activity_name = all_content[1].text.strip()
         self.assertEqual(activity_name, "Read Activity")
Ejemplo n.º 32
0
 def test_check_file(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         all_push_buttons = activity.find_children(role_name="push button")
         activity_buttons = all_push_buttons[0]
         activity_buttons.click()
         time.sleep(1)
         all_content = activity.find_children(role_name="text")
         activity_name = all_content[1].text.strip()
         self.assertEqual(activity_name, "Read Activity")
Ejemplo n.º 33
0
 def test_search(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         all_push_buttons = activity.find_children(role_name="push button")
         edit_buttons = all_push_buttons[1]
         edit_buttons.click()
         time.sleep(0.25)
         all_panels = activity.find_children(role_name="panel")
         search_panel = all_panels[20]
         search_box = search_panel.find_child(role_name="text")
         search_box.click(1, 0.04 * self.screen_width,
                          0.02 * self.screen_height)
         time.sleep(0.5)
         uitree.type_text('t')
         time.sleep(1)
         backward_panel = all_panels[21]
         forward_panel = all_panels[22]
         hlight_panel = all_panels[24]
         forward_button = forward_panel.find_child(role_name="push button")
         back_button = backward_panel.find_child(role_name="push button")
         hlight_button = hlight_panel.find_child(role_name="toggle button")
         count = 2
         while count:
             forward_button.click()
             time.sleep(1)
             count -= 1
         hlight_button.click()
         count = 2
         while count:
             back_button.click()
             time.sleep(1)
             count -= 1
         self.assertIsNotNone(forward_button)
         self.assertIsNotNone(back_button)
         self.assertIsNotNone(hlight_button)
         self.assertIsNotNone(search_box)
 def test_check_activity(self):
     uri = os.getcwd() + '/tests/integration/test.png'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Image Viewer Activity",
                                    role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         all_buttons = activity.find_children(role_name="push button")
         activity_button = all_buttons[0]
         activity_button.click()
         time.sleep(0.25)
         activity_name = activity.find_child(role_name="text")
         self.assertEqual(activity_name.text, "Image Viewer Activity")
         time.sleep(1.5)
Ejemplo n.º 35
0
 def test_check_activity(self):
     uri = os.getcwd() + '/tests/integration/test.png'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Image Viewer Activity",
                                    role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         all_buttons = activity.find_children(role_name="push button")
         activity_button = all_buttons[0]
         activity_button.click()
         time.sleep(0.25)
         activity_name = activity.find_child(role_name="text")
         self.assertEqual(activity_name.text, "Image Viewer Activity")
         time.sleep(1.5)
 def test_open_file(self):
     uri = os.getcwd() + '/tests/integration/test.png'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Image Viewer Activity",
                                    role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         stop_button = activity.find_child(name="Stop",
                                           role_name="push button")
         full_screen = activity.find_child(name="Fullscreen",
                                           role_name="push button")
         stop_button.click()
         self.assertIsNotNone(stop_button)
         self.assertIsNotNone(full_screen)
         time.sleep(1.5)
Ejemplo n.º 37
0
 def test_open_file(self):
     uri = os.getcwd() + '/tests/integration/test.png'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Image Viewer Activity",
                                    role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         stop_button = activity.find_child(name="Stop",
                                           role_name="push button")
         full_screen = activity.find_child(name="Fullscreen",
                                           role_name="push button")
         stop_button.click()
         self.assertIsNotNone(stop_button)
         self.assertIsNotNone(full_screen)
         time.sleep(1.5)
Ejemplo n.º 38
0
 def test_rotate_aclockwise(self):
     uri = os.getcwd() + '/tests/integration/test.png'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Image Viewer Activity",
                                    role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         rotate_aclock = activity.find_child(name="Rotate anticlockwise",
                                             role_name="push button")
         count = 4
         while count:
             rotate_aclock.click()
             time.sleep(0.25)
             count -= 1
         self.assertIsNotNone(rotate_aclock)
         time.sleep(1.5)
Ejemplo n.º 39
0
 def test_change_pages(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         forward_button = activity.find_child(name="Forward",
                                              role_name="push button")
         backward_button = activity.find_child(name="Back",
                                               role_name="push button")
         forward_button.click()
         time.sleep(1)
         backward_button.click()
         time.sleep(1)
         self.assertIsNotNone(forward_button)
         self.assertIsNotNone(backward_button)
 def test_rotate_aclockwise(self):
     uri = os.getcwd() + '/tests/integration/test.png'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Image Viewer Activity",
                                    role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         rotate_aclock = activity.find_child(name="Rotate anticlockwise",
                                             role_name="push button")
         count = 4
         while count:
             rotate_aclock.click()
             time.sleep(0.25)
             count -= 1
         self.assertIsNotNone(rotate_aclock)
         time.sleep(1.5)
 def test_change_pages(self):
     uri = 'file://' + os.getcwd() + '/tests/integration/t2.txt'
     logging.error('OPEN WITH URI %s', uri)
     with self.run_activity_with_uri(uri):
         root = uitree.get_root()
         activity = root.find_child(name="Read Activity", role_name="frame")
         try:
             logging.error(activity.dump())
         except:
             logging.error("Error")
             pass
         forward_button = activity.find_child(name="Forward",
                                              role_name="push button")
         backward_button = activity.find_child(name="Back",
                                               role_name="push button")
         forward_button.click()
         time.sleep(1)
         backward_button.click()
         time.sleep(1)
         self.assertIsNotNone(forward_button)
         self.assertIsNotNone(backward_button)
Ejemplo n.º 42
0
                raise RuntimeError


def go_to_list_view():
    root = uitree.get_root()
    shell = root.find_child(name="main.py", role_name="application")

    radio_button = shell.find_child(name="List view", role_name="radio button")
    radio_button.do_action("click")


def main():
    format = "%(created)f %(message)s"
    logging.basicConfig(format=format)
    logging.root.setLevel(logging.DEBUG)

    logging.info("Start test")

    go_to_list_view()

    for activity in _activities_list:
        launch_and_stop_activity(activity)


try:
    main()
except:
    logging.error(traceback.format_exc())
    logging.error("\n%s" % uitree.get_root().dump())
    raise
 def test_add_button(self):
     with self.run_activity():
         root = uitree.get_root()
         activity = root.find_child(name="HelloWorld Activity", role_name="frame")
         label = activity.find_child(name="Hello World!", role_name="label")
         self.assertEqual(label.text, "Hello World!")
Ejemplo n.º 44
0
def go_to_list_view():
    root = uitree.get_root()
    shell = root.find_child(name="main.py", role_name="application")

    radio_button = shell.find_child(name="List view", role_name="radio button")
    radio_button.do_action("click")
Ejemplo n.º 45
0
 def handle_dump_ui_tree(self, event_time):
     print uitree.get_root().dump()
 def get_activity(self):
     root = uitree.get_root()
     activity = root.find_child(name="Log Activity",
                                role_name="frame")
     return activity
Ejemplo n.º 47
0
            if activity is not None:
                raise RuntimeError


def go_to_list_view():
    root = uitree.get_root()
    shell = root.find_child(name="main.py", role_name="application")

    radio_button = shell.find_child(name="List view", role_name="radio button")
    radio_button.do_action("click")


def main():
    format = "%(created)f %(message)s"
    logging.basicConfig(format=format)
    logging.root.setLevel(logging.DEBUG)

    logging.info("Start test")

    go_to_list_view()

    for activity in _activities_list:
        launch_and_stop_activity(activity)

try:
    main()
except:
    logging.error(traceback.format_exc())
    logging.error("\n%s" % uitree.get_root().dump())
    raise
Ejemplo n.º 48
0
def get_activity():
    root = uitree.get_root()
    activity = root.find_child(name="Terminal Activity", role_name="frame")
    return activity
Ejemplo n.º 49
0
 def handle_dump_ui_tree(self, event_time):
     print(uitree.get_root().dump())
Ejemplo n.º 50
0
def go_to_list_view():
    root = uitree.get_root()
    shell = root.find_child(name="main.py", role_name="application")

    radio_button = shell.find_child(name="List view", role_name="radio button")
    radio_button.do_action("click")
 def get_activity(self):
     root = uitree.get_root()
     activity = root.find_child(name="Pippy Activity", role_name="frame")
     return activity