chore: add verification after emoji selection

Added verification step for emoji selection, so test is checking wether emoji is applied or not
This commit is contained in:
Anastasiya Semenkevich 2024-05-27 18:33:22 +03:00 committed by Anastasiya
parent 45f7445595
commit 2723281937
5 changed files with 26 additions and 12 deletions

View File

@ -54,3 +54,8 @@ class ColorCodes(Enum):
BLUE = '#2a4af5'
ORANGE = '#ff9f0f'
GRAY = '#939ba1'
class EmojiCodes(Enum):
SMILING_FACE_WITH_SUNGLASSES = '1f60e'
THUMBSUP_SIGN = '1f44d'

View File

@ -18,14 +18,7 @@ class EmojiPopup(QObject):
return self
@allure.step('Select emoji')
def select(self, name: str, attempts: int = 2):
def select(self, name: str):
self._search_text_edit.text = name
self._emoji_item.real_name['objectName'] = 'statusEmoji_' + name
try:
self._emoji_item.click()
except LookupError as err:
if attempts:
return self.select(name, attempts - 1)
else:
raise err
EmojiPopup().wait_until_hidden()
self._emoji_item.click()

View File

@ -30,6 +30,7 @@ class AccountPopup(BasePopup):
self._emoji_button = Button(names.mainWallet_AddEditAccountPopup_AccountEmojiPopupButton)
self._color_radiobutton = QObject(names.color_StatusColorRadioButton)
self._popup_header_title = TextLabel(names.mainWallet_AddEditAccountPopup_HeaderTitle)
self._emoji_id_in_title = QObject(names.mainWallet_AddEditAccountPopup_HeaderEmoji)
# origin
self._origin_combobox = QObject(names.mainWallet_AddEditAccountPopup_SelectedOrigin)
self._watched_address_origin_item = QObject(names.mainWallet_AddEditAccountPopup_OriginOptionWatchOnlyAcc)
@ -81,9 +82,13 @@ class AccountPopup(BasePopup):
@allure.step('Set emoji for account')
def set_emoji(self, value: str):
self._emoji_button.click()
EmojiPopup().wait_until_appears(timeout_msec=10000).select(value)
EmojiPopup().select(value)
return self
@allure.step('Get emoji id from account header')
def get_emoji_from_account_title(self):
return str(getattr(self._emoji_id_in_title.object, 'emojiId'))
@allure.step('Set eth address for account added from context menu')
def set_eth_address(self, value: str):
self._address_text_edit.text = value

View File

@ -291,6 +291,8 @@ mainWallet_AddEditAccountPopup_BackButton = {"container": statusDesktop_mainWind
mainWallet_AddEditAccountPopup_AccountNameComponent = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "AddAccountPopup-AccountName", "type": "StatusInput", "visible": True}
mainWallet_AddEditAccountPopup_AccountName = {"container": mainWallet_AddEditAccountPopup_AccountNameComponent, "type": "TextEdit", "unnamed": 1, "visible": True}
mainWallet_AddEditAccountPopup_HeaderTitle = {"container": statusDesktop_mainWindow_overlay, "objectName": "headerTitle", "type": "StatusBaseText", "visible": True}
mainWallet_AddEditAccountPopup_Status_Identicon = {"container": statusDesktop_mainWindow_overlay, "objectName": "statusSmartIdenticonLetter", "type": "StatusLetterIdenticon", "visible": True}
mainWallet_AddEditAccountPopup_HeaderEmoji = {"container": mainWallet_AddEditAccountPopup_Status_Identicon, "type": "StatusEmoji", "unnamed": 1, "visible": True}
mainWallet_AddEditAccountPopup_AccountColorComponent = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "AddAccountPopup-AccountColor", "type": "StatusColorSelectorGrid", "visible": True}
mainWallet_AddEditAccountPopup_AccountColorSelector = {"container": mainWallet_AddEditAccountPopup_AccountColorComponent, "type": "Repeater", "objectName": "statusColorRepeater", "visible": True, "enabled": True}
mainWallet_AddEditAccountPopup_AccountEmojiPopupButton = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "AddAccountPopup-AccountEmoji", "type": "StatusFlatRoundButton", "visible": True}

View File

@ -1,6 +1,9 @@
import allure
import pytest
from allure_commons._allure import step
import constants
from constants import EmojiCodes
from . import marks
import configs
@ -28,12 +31,18 @@ def test_change_account_order_by_drag_and_drop(main_screen: MainWindow, user_acc
wallet = main_screen.left_panel.open_wallet()
SigningPhrasePopup().wait_until_appears().confirm_phrase()
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_watched_address(address).save()
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_watched_address(address)
assert account_popup.get_emoji_from_account_title() == EmojiCodes.SMILING_FACE_WITH_SUNGLASSES.value, \
f'Emoji was not set or does not match'
account_popup.save()
account_popup.wait_until_hidden()
with step('Create generated wallet account'):
account_popup = wallet.left_panel.open_add_account_popup()
account_popup.set_name(second_name).set_emoji(second_emoji).set_color(second_color).save()
account_popup.set_name(second_name).set_emoji(second_emoji).set_color(second_color)
assert account_popup.get_emoji_from_account_title() == EmojiCodes.THUMBSUP_SIGN.value, \
f'Emoji was not set or does not match'
account_popup.save()
AuthenticatePopup().wait_until_appears().authenticate(user_account.password)
account_popup.wait_until_hidden()