Exemplo n.º 1
0
    def confirm_delete_member(self, dataset, member):
        notification_container = self.find_it(UI.get_theia_notification_container_locator())
        highlight(notification_container)

        notifications = self.find_them(UI.get_theia_notifications_locator(), parent=notification_container)
        for notification in notifications:
            text_el = self.find_it(UI.get_theia_notification_message_locator(), parent=notification)
            if text_el.text == self.create_delete_member_expected_text(dataset, member):
                buttons = self.find_them(UI.get_buttons_locator(), parent=notification)
                for button in buttons:
                    if button.text == constants.OK:
                        self.click_me(button, element_human_name=constants.OK)
                        return

        raise WebDriverException
Exemplo n.º 2
0
    def confirm_delete(self, host_name):
        notification_container = self.find_it(UI.get_theia_notification_container_locator())
        highlight(notification_container)

        notifications = self.find_them(UI.get_theia_notifications_locator(), parent=notification_container)

        if len(notifications) == 0:
            notifications = self.get_notifications_from_control_center()

        for notification in notifications:
            highlight(notification)
            text_el = self.find_it(UI.get_theia_notification_message_locator(), parent=notification)
            if text_el.text == self.create_delete_host_expected_text(host_name):
                buttons = self.find_them(UI.get_buttons_locator(), parent=notification)
                for button in buttons:
                    if button.text == constants.OK:
                        self.click_me(button, element_human_name=constants.OK)
                        return

        raise WebDriverException
    def close_tab_element(self, tab_element, save=False):
        modified = constants.THEIA_UNSAVED_FILE in tab_element.get_attribute(
            constants.TYPE_CLASS)
        close_button = self.find_it(UI.get_tab_close_button_locator(),
                                    parent=tab_element)
        self.click_me(close_button,
                      element_human_name=constants.Close,
                      effect_time=1)

        if modified:
            print("File was modified")
            tab_title = self.find_it(UI.get_tab_label_locator(),
                                     parent=tab_element)
            msg = lsp_constants.SAVE_DIALOG_TEMPLATE.format(tab_title.text)

            dialog_shell = self.find_it(UI.get_theia_dialog_shell_locator())
            dialog_title = self.find_it(UI.get_theia_dialog_title_locator(),
                                        parent=dialog_shell)

            control_button = None

            if dialog_title.text.upper() == msg.upper():
                dialog_control = self.find_it(
                    UI.get_theia_dialog_control_locator(), parent=dialog_shell)
                control_buttons = self.find_them(UI.get_buttons_locator(),
                                                 parent=dialog_control)
                for control_button in control_buttons:
                    button_text = control_button.text
                    if not save and button_text == constants.THEIA_DIALOG_DONT_SAVE_BUTTON:
                        break

                    if save and button_text == constants.THEIA_DIALOG_SAVE_BUTTON:
                        break

            if control_button is not None:
                self.click_me(control_button, effect_time=1)

        else:
            print("File was NOT modified")