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

40 lines
1.3 KiB
Python
Raw Normal View History

2024-06-06 06:14:30 +00:00
import time
import allure
import configs
from gui.elements.object import QObject
from gui.elements.text_edit import TextEdit
from gui.objects_map import names
class EmojiPopup(QObject):
def __init__(self):
2024-06-06 06:14:30 +00:00
super(EmojiPopup, self).__init__()
self._search_text_edit = TextEdit(names.mainWallet_AddEditAccountPopup_AccountEmojiSearchBox)
self._emoji_item = QObject(names.mainWallet_AddEditAccountPopup_AccountEmoji)
@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
@allure.step('Select emoji')
def select(self, name: str, attempts: int = 2):
self._search_text_edit.text = name
self._emoji_item.real_name['objectName'] = 'statusEmoji_' + name
try:
2024-06-06 06:14:30 +00:00
time.sleep(0.5)
self._emoji_item.click()
except LookupError as err:
if attempts:
return self.select(name, attempts - 1)
else:
raise err
EmojiPopup().wait_until_hidden()