2023-09-15 04:17:07 +00:00
|
|
|
import allure
|
|
|
|
|
2023-10-25 12:34:00 +00:00
|
|
|
import driver
|
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
|
|
|
@property
|
|
|
|
@allure.step('Get toast messages')
|
|
|
|
def get_toast_messages(self):
|
|
|
|
messages = []
|
2023-11-27 10:44:42 +00:00
|
|
|
for obj in driver.findAllObjects(self._toast_message.real_name):
|
2023-10-25 12:34:00 +00:00
|
|
|
messages.append(str(obj.primaryText))
|
|
|
|
if len(messages) == 0:
|
|
|
|
raise LookupError(
|
|
|
|
'Toast messages were not found')
|
|
|
|
else:
|
|
|
|
return messages
|