示例#1
0
    def expect_notification_message_gone(self, msg_text):
        print("Expecting notification message '{0}' to disappear ...".format(msg_text))
        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 == msg_text:
                raise WebDriverException

        print("Expecting notification message '{0}' to disappear ... Ok".format(msg_text))
        return
示例#2
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
示例#3
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
示例#4
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
示例#5
0
    def wait_for_timeout_waiting_notification(self, msg_text):
        print("Notification message '{0}' should not appear...".format(msg_text))
        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()

        if len(notifications) == 0:
            raise WebDriverException

        for notification in notifications:
            highlight(notification)
            text_el = self.find_it(UI.get_theia_notification_message_locator(), parent=notification)
            if text_el.text == msg_text:
                print("Expecting notification message '{0}' ... Ok".format(msg_text))
                raise UnexpectedNotificationMessage(
                    self.get_driver(),
                    call_from=self.wait_for_timeout_waiting_notification.__name__
                )
示例#6
0
    def expect_notification_message(self, msg_text, like=False):
        print("Expecting notification message '{0}' ...".format(msg_text))
        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 like:
                if msg_text in text_el.text:
                    print("Expecting notification message '{0}' ... Ok".format(msg_text))
                    return notification
            else:
                if text_el.text == msg_text:
                    print("Expecting notification message '{0}' ... Ok".format(msg_text))
                    return notification

        raise WebDriverException