def status_bar_should_have_text(self, text):
        theia_status_bar = self.find_it(UI.get_theia_statusbar_locator())
        elements_with_commands = self.find_them(UI.get_status_elements(),
                                                parent=theia_status_bar)
        for elements_with_command in elements_with_commands:
            if elements_with_command.text == text:
                highlight(elements_with_command, effect_time=1)
                return

        raise NoSuchElementException
Esempio n. 2
0
    def get_notifications_from_control_center(self):
        status_bar = self.find_it(UI.get_theia_statusbar_locator())
        highlight(status_bar)

        area_right = self.find_it(UI.get_right_status_bar_area(), parent=status_bar)

        highlight(area_right)

        status_elements = self.find_them(UI.get_status_elements(), parent=area_right)

        show_button = None
        for status_element in status_elements:
            highlight(status_element)
            try:
                int_text = int(status_element.text)
                show_button = status_element
                break

            except ValueError:
                continue

            except Exception:
                raise GeneralException(self.get_driver(), call_from=self.get_notifications_from_control_center.__name__)

        notifications = list()

        if show_button is not None:
            highlight(show_button)

            notification_center = self.find_it(UI.get_theia_notification_center_locator())
            highlight(notification_center)
            if constants.THEIA_CLOSED in notification_center.get_attribute(constants.TYPE_CLASS):
                self.click_me(show_button)
                sleep(1)

            while True:
                if constants.THEIA_CLOSED in notification_center.get_attribute(constants.TYPE_CLASS):
                    sleep(1)
                    continue

                break

            highlight(notification_center)
            notifications = self.find_them(UI.get_theia_notifications_locator(), parent=notification_center)

        return notifications