2024-03-11 06:15:12 +00:00
|
|
|
import typing
|
|
|
|
|
2023-09-15 04:17:07 +00:00
|
|
|
import allure
|
|
|
|
|
2024-03-11 06:15:12 +00:00
|
|
|
from driver.objects_access import walk_children
|
2023-10-06 08:33:42 +00:00
|
|
|
from gui.elements.object import QObject
|
2024-02-13 09:04:24 +00:00
|
|
|
from gui.objects_map import names
|
2023-09-15 04:17:07 +00:00
|
|
|
|
|
|
|
|
2023-11-27 10:44:42 +00:00
|
|
|
class ToastMessage(QObject):
|
2023-09-15 04:17:07 +00:00
|
|
|
|
|
|
|
def __init__(self):
|
2024-02-13 09:04:24 +00:00
|
|
|
super(ToastMessage, self).__init__(names.ephemeral_Notification_List)
|
|
|
|
self._toast_message = QObject(names.ephemeralNotificationList_StatusToastMessage)
|
2023-09-15 04:17:07 +00:00
|
|
|
|
2023-10-25 12:34:00 +00:00
|
|
|
@allure.step('Get toast messages')
|
2024-03-11 06:15:12 +00:00
|
|
|
def get_toast_messages(self) -> typing.List[str]:
|
2023-10-25 12:34:00 +00:00
|
|
|
messages = []
|
2024-03-11 06:15:12 +00:00
|
|
|
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:
|
2024-03-11 06:15:12 +00:00
|
|
|
raise LookupError('Toast message not found')
|
|
|
|
return messages
|