Example #1
0
    def find_child_node(self, content, child_name, top, padding):
        child_nodes = self.find_them(UI.get_tree_nodes_locator(), parent=content)

        for child_node in child_nodes:
            child_parent = self.get_parent_node(child_node)
            child_parent_top = self.get_element_top(child_parent)

            if lt_pixels(child_parent_top, top):
                continue

            child_padding = self.get_element_padding_left(child_node)
            if lt_pixels(child_padding, padding):
                continue

            child_node_content = self.find_it(UI.get_tree_node_content_locator(), parent=child_node)
            if child_node_content.text != child_name:
                continue

            if child_node_content.text == child_name:
                return child_node

            child_node_padding_left = self.get_element_padding_left(child_node)
            # we reached another Connection name, but looking not for a connection
            if child_node_padding_left == "0px" and padding != "0px":
                print("Next connection reached!")
                print("child_node_padding_left: '{0}'".format(child_node_padding_left))
                print("padding: '{0}'".format(padding))
                break

        return None
Example #2
0
    def wait_for_data_sets_is_expanded(self, node_id, content):
        print("Wait for node is expanded...")
        node_top = self.get_tree_element_top_by_id(node_id)
        node_padding = self.get_tree_element_padding_by_id(node_id)

        child_nodes = self.find_them(UI.get_tree_nodes_locator(), parent=content)

        for child_node in child_nodes:
            highlight(child_node)
            child_parent = self.get_parent_node(child_node)
            child_top = self.get_element_top(child_parent)

            if lt_pixels(child_top, node_top):
                continue

            child_padding = self.get_element_padding_left(child_node)
            if lt_pixels(node_padding, child_padding):
                print("Wait for node is expanded...Ok", node_padding, child_padding)
                return

        print("Wait for node is expanded...Waiting")

        node = self.find_it((By.ID, node_id))
        highlight(node)
        arrow = self.find_it(UI.get_theia_expand_arrow_locator(), parent=node)
        highlight(arrow)
        is_expanded = self.is_element_expanded(arrow)
        if is_expanded:
            self.page_down_tree(content)

        raise WebDriverException
Example #3
0
    def wait_for_nodes(self, content, expandable=True):
        interval = 1
        elapsed = 0
        timeout = 3

        tree_nodes = None

        while True:
            if elapsed > timeout:
                break

            if expandable:
                tree_nodes = self.find_them(UI.get_tree_expandable_nodes_locator(), parent=content)
            else:
                tree_nodes = self.find_them(UI.get_tree_nodes_locator(), parent=content)

            if len(tree_nodes):
                break

            time.sleep(interval)
            elapsed += interval

        return tree_nodes