コード例 #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 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
コード例 #4
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__
                )
コード例 #5
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