2024-06-06 06:14:30 +00:00
|
|
|
import time
|
|
|
|
|
2023-09-04 18:36:48 +00:00
|
|
|
import allure
|
|
|
|
|
|
|
|
import configs
|
2023-10-06 08:33:42 +00:00
|
|
|
from gui.elements.object import QObject
|
|
|
|
from gui.elements.text_edit import TextEdit
|
2024-02-13 09:04:24 +00:00
|
|
|
from gui.objects_map import names
|
2023-09-04 18:36:48 +00:00
|
|
|
|
|
|
|
|
2023-11-02 16:07:12 +00:00
|
|
|
class EmojiPopup(QObject):
|
2023-09-04 18:36:48 +00:00
|
|
|
def __init__(self):
|
2024-06-06 06:14:30 +00:00
|
|
|
super(EmojiPopup, self).__init__()
|
2024-02-13 09:04:24 +00:00
|
|
|
self._search_text_edit = TextEdit(names.mainWallet_AddEditAccountPopup_AccountEmojiSearchBox)
|
|
|
|
self._emoji_item = QObject(names.mainWallet_AddEditAccountPopup_AccountEmoji)
|
2023-09-04 18:36:48 +00:00
|
|
|
|
|
|
|
@allure.step('Wait until appears {0}')
|
|
|
|
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
|
|
|
self._search_text_edit.wait_until_appears(timeout_msec)
|
|
|
|
return self
|
|
|
|
|
2024-06-06 06:14:30 +00:00
|
|
|
@allure.step('Wait until hidden {0}')
|
|
|
|
def wait_until_hidden(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
|
|
|
self._search_text_edit.wait_until_hidden(timeout_msec)
|
|
|
|
return self
|
|
|
|
|
2023-09-04 18:36:48 +00:00
|
|
|
@allure.step('Select emoji')
|
2024-06-05 07:52:32 +00:00
|
|
|
def select(self, name: str, attempts: int = 2):
|
2023-09-04 18:36:48 +00:00
|
|
|
self._search_text_edit.text = name
|
|
|
|
self._emoji_item.real_name['objectName'] = 'statusEmoji_' + name
|
2024-06-05 07:52:32 +00:00
|
|
|
try:
|
2024-06-06 06:14:30 +00:00
|
|
|
time.sleep(0.5)
|
2024-06-05 07:52:32 +00:00
|
|
|
self._emoji_item.click()
|
|
|
|
except LookupError as err:
|
|
|
|
if attempts:
|
|
|
|
return self.select(name, attempts - 1)
|
|
|
|
else:
|
|
|
|
raise err
|
|
|
|
EmojiPopup().wait_until_hidden()
|