status-desktop/test/e2e/gui/components/toast_message.py

25 lines
754 B
Python
Raw Normal View History

import typing
import allure
from driver.objects_access import walk_children
from gui.elements.object import QObject
from gui.objects_map import names
class ToastMessage(QObject):
def __init__(self):
super(ToastMessage, self).__init__(names.ephemeral_Notification_List)
self._toast_message = QObject(names.ephemeralNotificationList_StatusToastMessage)
2023-10-25 12:34:00 +00:00
@allure.step('Get toast messages')
def get_toast_messages(self) -> typing.List[str]:
2023-10-25 12:34:00 +00:00
messages = []
for child in walk_children(self.object):
if getattr(child, 'id', '') == 'title':
messages.append(str(child.text))
2023-10-25 12:34:00 +00:00
if len(messages) == 0:
raise LookupError('Toast message not found')
return messages