test(@wallet_settings): add test for editing status default account from wallet settings (#191)
This commit is contained in:
parent
3343bc675e
commit
d659cbd980
|
@ -19,6 +19,8 @@ class WalletNetworkSettings(Enum):
|
||||||
'security risks and potentially even loss of funds.')
|
'security risks and potentially even loss of funds.')
|
||||||
REVERT_TO_DEFAULT_LIVE_MAINNET_TOAST_MESSAGE = 'Live network settings for Mainnet reverted to default'
|
REVERT_TO_DEFAULT_LIVE_MAINNET_TOAST_MESSAGE = 'Live network settings for Mainnet reverted to default'
|
||||||
REVERT_TO_DEFAULT_TEST_MAINNET_TOAST_MESSAGE = 'Test network settings for Mainnet reverted to default'
|
REVERT_TO_DEFAULT_TEST_MAINNET_TOAST_MESSAGE = 'Test network settings for Mainnet reverted to default'
|
||||||
|
STATUS_ACCOUNT_DEFAULT_NAME = 'Status account'
|
||||||
|
STATUS_ACCOUNT_DEFAULT_COLOR = '#2a4af5'
|
||||||
|
|
||||||
|
|
||||||
class WalletNetworkNaming(Enum):
|
class WalletNetworkNaming(Enum):
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import random
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
import allure
|
import allure
|
||||||
|
@ -5,6 +6,7 @@ import allure
|
||||||
import configs
|
import configs
|
||||||
import constants.wallet
|
import constants.wallet
|
||||||
import driver
|
import driver
|
||||||
|
from gui.screens.settings_wallet import *
|
||||||
from gui.components.base_popup import BasePopup
|
from gui.components.base_popup import BasePopup
|
||||||
from gui.components.emoji_popup import EmojiPopup
|
from gui.components.emoji_popup import EmojiPopup
|
||||||
from gui.components.wallet.authenticate_popup import AuthenticatePopup
|
from gui.components.wallet.authenticate_popup import AuthenticatePopup
|
||||||
|
@ -15,6 +17,7 @@ from gui.elements.object import QObject
|
||||||
from gui.elements.scroll import Scroll
|
from gui.elements.scroll import Scroll
|
||||||
from gui.elements.text_edit import TextEdit
|
from gui.elements.text_edit import TextEdit
|
||||||
|
|
||||||
|
|
||||||
GENERATED_PAGES_LIMIT = 20
|
GENERATED_PAGES_LIMIT = 20
|
||||||
|
|
||||||
|
|
||||||
|
@ -127,6 +130,44 @@ class AccountPopup(BasePopup):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
|
class EditAccountFromSettingsPopup(BasePopup):
|
||||||
|
def __init__(self):
|
||||||
|
super(EditAccountFromSettingsPopup, self).__init__()
|
||||||
|
self._change_name_button = Button('editWalletSettings_renameButton')
|
||||||
|
self._account_name_input = TextEdit('editWalletSettings_AccountNameInput')
|
||||||
|
self._emoji_selector = QObject('editWalletSettings_EmojiSelector')
|
||||||
|
self._color_radiobutton = QObject('editWalletSettings_ColorSelector')
|
||||||
|
self._emoji_item = QObject('editWalletSettings_EmojiItem')
|
||||||
|
|
||||||
|
@allure.step('Click Change name button')
|
||||||
|
def click_change_name_button(self):
|
||||||
|
self._change_name_button.click()
|
||||||
|
|
||||||
|
@allure.step('Type in name for account')
|
||||||
|
def type_in_account_name(self, value: str):
|
||||||
|
self._account_name_input.text = value
|
||||||
|
return self
|
||||||
|
|
||||||
|
@allure.step('Select random color for account')
|
||||||
|
def select_random_color_for_account(self):
|
||||||
|
if 'radioButtonColor' in self._color_radiobutton.real_name.keys():
|
||||||
|
del self._color_radiobutton.real_name['radioButtonColor']
|
||||||
|
colors = [str(item.radioButtonColor) for item in driver.findAllObjects(self._color_radiobutton.real_name)]
|
||||||
|
self._color_radiobutton.real_name['radioButtonColor'] =\
|
||||||
|
random.choice([color for color in colors if color != '#2a4af5']) # exclude status default color
|
||||||
|
self._color_radiobutton.click()
|
||||||
|
return self
|
||||||
|
|
||||||
|
@allure.step('Click emoji button')
|
||||||
|
def select_random_emoji_for_account(self):
|
||||||
|
self._emoji_selector.click()
|
||||||
|
EmojiPopup().wait_until_appears()
|
||||||
|
emojis = [str(item.objectName) for item in driver.findAllObjects(self._emoji_item.real_name)]
|
||||||
|
value = ((random.choice(emojis)).split('_', 1))[1]
|
||||||
|
EmojiPopup().wait_until_appears().select(value)
|
||||||
|
return self
|
||||||
|
|
||||||
|
|
||||||
class AddNewAccountPopup(BasePopup):
|
class AddNewAccountPopup(BasePopup):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|
|
@ -168,6 +168,7 @@ contextMenuItem = {"container": statusDesktop_mainWindow_overlay, "type": "Statu
|
||||||
contextMenuItem_AddWatchOnly = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-AddWatchOnlyAccountAction*"), "type": "StatusMenuItem"}
|
contextMenuItem_AddWatchOnly = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-AddWatchOnlyAccountAction*"), "type": "StatusMenuItem"}
|
||||||
contextMenuItem_Delete = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-DeleteAction*"), "type": "StatusMenuItem"}
|
contextMenuItem_Delete = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-DeleteAction*"), "type": "StatusMenuItem"}
|
||||||
contextMenuItem_Edit = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-EditAction*"), "type": "StatusMenuItem"}
|
contextMenuItem_Edit = {"container": statusDesktop_mainWindow_overlay, "enabled": True, "objectName": RegularExpression("AccountMenu-EditAction*"), "type": "StatusMenuItem"}
|
||||||
|
|
||||||
# Confirmation Popup
|
# Confirmation Popup
|
||||||
confirmButton = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("confirm*"), "type": "StatusButton"}
|
confirmButton = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("confirm*"), "type": "StatusButton"}
|
||||||
|
|
||||||
|
@ -255,6 +256,13 @@ mainWallet_AddEditAccountPopup_12WordsButton = {"container": mainWallet_AddEditA
|
||||||
mainWallet_AddEditAccountPopup_18WordsButton = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "18SeedButton", "type": "StatusSwitchTabButton"}
|
mainWallet_AddEditAccountPopup_18WordsButton = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "18SeedButton", "type": "StatusSwitchTabButton"}
|
||||||
mainWallet_AddEditAccountPopup_24WordsButton = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "24SeedButton", "type": "StatusSwitchTabButton"}
|
mainWallet_AddEditAccountPopup_24WordsButton = {"container": mainWallet_AddEditAccountPopup_Content, "objectName": "24SeedButton", "type": "StatusSwitchTabButton"}
|
||||||
|
|
||||||
|
# Edit Account from settings popup
|
||||||
|
editWalletSettings_renameButton = {"container": statusDesktop_mainWindow_overlay, "objectName": "renameAccountModalSaveBtn", "type": "StatusButton"}
|
||||||
|
editWalletSettings_AccountNameInput = {"container": statusDesktop_mainWindow_overlay, "objectName": "renameAccountNameInput", "type": "TextEdit", "visible": True}
|
||||||
|
editWalletSettings_EmojiSelector = {"container": statusDesktop_mainWindow_overlay, "objectName": "statusSmartIdenticonLetter", "type": "StatusLetterIdenticon", "visible": True}
|
||||||
|
editWalletSettings_ColorSelector = {"container": statusDesktop_mainWindow_overlay, "type": "StatusColorRadioButton", "unnamed": 1, "visible": True}
|
||||||
|
editWalletSettings_EmojiItem = {"container": statusDesktop_mainWindow_overlay, "objectName": RegularExpression("statusEmoji_*"), "type": "StatusEmoji"}
|
||||||
|
|
||||||
# Testnet mode popup
|
# Testnet mode popup
|
||||||
turn_on_testnet_mode_StatusButton = {"container": statusDesktop_mainWindow_overlay, "id": "acceptBtn", "text": "Turn on testnet mode", "type": "StatusButton", "unnamed": 1, "visible": True}
|
turn_on_testnet_mode_StatusButton = {"container": statusDesktop_mainWindow_overlay, "id": "acceptBtn", "text": "Turn on testnet mode", "type": "StatusButton", "unnamed": 1, "visible": True}
|
||||||
turn_off_testnet_mode_StatusButton = {"container": statusDesktop_mainWindow_overlay, "id": "acceptBtn", "text": "Turn off testnet mode", "type": "StatusButton", "unnamed": 1, "visible": True}
|
turn_off_testnet_mode_StatusButton = {"container": statusDesktop_mainWindow_overlay, "id": "acceptBtn", "text": "Turn off testnet mode", "type": "StatusButton", "unnamed": 1, "visible": True}
|
||||||
|
|
|
@ -65,6 +65,12 @@ networkSettingsNetworks_Arbitrum = {"container": settingsContentBase_ScrollView,
|
||||||
networkSettingsNetworks_Arbitrum_Goerli = {"container": settingsContentBase_ScrollView, "objectName": "walletNetworkDelegate_Arbitrum_421613", "type": "WalletNetworkDelegate", "visible": True}
|
networkSettingsNetworks_Arbitrum_Goerli = {"container": settingsContentBase_ScrollView, "objectName": "walletNetworkDelegate_Arbitrum_421613", "type": "WalletNetworkDelegate", "visible": True}
|
||||||
networkSettingsNetworks_Mainnet_Goerli_sensor = {"container": networkSettingsNetworks_Mainnet_Goerli, "objectName": "walletNetworkDelegate_Mainnet_5_sensor", "id": "sensor", "type": "MouseArea", "unnamed": 1, "visible": True}
|
networkSettingsNetworks_Mainnet_Goerli_sensor = {"container": networkSettingsNetworks_Mainnet_Goerli, "objectName": "walletNetworkDelegate_Mainnet_5_sensor", "id": "sensor", "type": "MouseArea", "unnamed": 1, "visible": True}
|
||||||
networkSettingsNetowrks_Mainnet_Testlabel = {"container": networkSettingsNetworks_Mainnet_Goerli_sensor, "objectName": "testnetLabel_Mainnet", "type": "StatusBaseText", "visible": True}
|
networkSettingsNetowrks_Mainnet_Testlabel = {"container": networkSettingsNetworks_Mainnet_Goerli_sensor, "objectName": "testnetLabel_Mainnet", "type": "StatusBaseText", "visible": True}
|
||||||
|
settingsWalletAccountDelegate_Status_account = {"container": settingsContentBase_ScrollView, "objectName": "Status account", "type": "WalletAccountDelegate", "visible": True}
|
||||||
|
|
||||||
|
# Wallet Account Details view
|
||||||
|
walletAccountViewEditAccountButton = {"container": statusDesktop_mainWindow, "objectName": "walletAccountViewEditAccountButton", "type": "StatusButton"}
|
||||||
|
walletAccountViewAccountName = {"container": statusDesktop_mainWindow, "objectName": "walletAccountViewAccountName", "type": "StatusBaseText"}
|
||||||
|
walletAccountViewAccountEmoji = {"container": statusDesktop_mainWindow, "objectName": "walletAccountViewAccountImage", "type": "StatusEmoji", "visible": True}
|
||||||
|
|
||||||
# Wallet edit network view
|
# Wallet edit network view
|
||||||
settingsContentBaseScrollView_editPreviwTabBar_StatusTabBar = {"container": statusDesktop_mainWindow, "objectName": "editPreviwTabBar", "type": "StatusTabBar"}
|
settingsContentBaseScrollView_editPreviwTabBar_StatusTabBar = {"container": statusDesktop_mainWindow, "objectName": "editPreviwTabBar", "type": "StatusTabBar"}
|
||||||
|
|
|
@ -11,7 +11,7 @@ from constants.wallet import WalletNetworkSettings, WalletNetworkDefaultValues
|
||||||
from driver import objects_access
|
from driver import objects_access
|
||||||
from gui.components.wallet.testnet_mode_popup import TestnetModePopup
|
from gui.components.wallet.testnet_mode_popup import TestnetModePopup
|
||||||
|
|
||||||
from gui.components.wallet.wallet_account_popups import AccountPopup
|
from gui.components.wallet.wallet_account_popups import AccountPopup, EditAccountFromSettingsPopup
|
||||||
from gui.components.wallet.wallet_toast_message import WalletToastMessage
|
from gui.components.wallet.wallet_toast_message import WalletToastMessage
|
||||||
from gui.elements.button import Button
|
from gui.elements.button import Button
|
||||||
from gui.elements.check_box import CheckBox
|
from gui.elements.check_box import CheckBox
|
||||||
|
@ -29,6 +29,7 @@ class WalletSettingsView(QObject):
|
||||||
self._wallet_settings_add_new_account_button = Button('settings_Wallet_MainView_AddNewAccountButton')
|
self._wallet_settings_add_new_account_button = Button('settings_Wallet_MainView_AddNewAccountButton')
|
||||||
self._wallet_network_button = Button('settings_Wallet_MainView_Networks')
|
self._wallet_network_button = Button('settings_Wallet_MainView_Networks')
|
||||||
self._account_order_button = Button('settingsContentBaseScrollView_accountOrderItem_StatusListItem')
|
self._account_order_button = Button('settingsContentBaseScrollView_accountOrderItem_StatusListItem')
|
||||||
|
self._status_account_in_keypair = QObject('settingsWalletAccountDelegate_Status_account')
|
||||||
|
|
||||||
@allure.step('Open add account pop up in wallet settings')
|
@allure.step('Open add account pop up in wallet settings')
|
||||||
def open_add_account_pop_up(self):
|
def open_add_account_pop_up(self):
|
||||||
|
@ -45,6 +46,39 @@ class WalletSettingsView(QObject):
|
||||||
self._account_order_button.click()
|
self._account_order_button.click()
|
||||||
return EditAccountOrderSettings().wait_until_appears()
|
return EditAccountOrderSettings().wait_until_appears()
|
||||||
|
|
||||||
|
@allure.step('Open Status account view in wallet settings')
|
||||||
|
def open_status_account_in_settings(self):
|
||||||
|
self._status_account_in_keypair.click()
|
||||||
|
return AccountDetailsView().wait_until_appears()
|
||||||
|
|
||||||
|
|
||||||
|
class AccountDetailsView(WalletSettingsView):
|
||||||
|
def __init__(self):
|
||||||
|
super(AccountDetailsView, self).__init__()
|
||||||
|
self._back_button = Button('main_toolBar_back_button')
|
||||||
|
self._edit_account_button = Button('walletAccountViewEditAccountButton')
|
||||||
|
self._wallet_account_title = TextLabel('walletAccountViewAccountName')
|
||||||
|
self._wallet_account_emoji = QObject('walletAccountViewAccountEmoji')
|
||||||
|
|
||||||
|
@allure.step('Click Edit button')
|
||||||
|
def click_edit_account_button(self):
|
||||||
|
self._edit_account_button.click()
|
||||||
|
return EditAccountFromSettingsPopup().wait_until_appears()
|
||||||
|
|
||||||
|
@allure.step('Get account name')
|
||||||
|
def get_account_name_value(self):
|
||||||
|
return self._wallet_account_title.text
|
||||||
|
|
||||||
|
@allure.step('Get account color value')
|
||||||
|
def get_account_color_value(self):
|
||||||
|
color_name = str(self._wallet_account_title.get_object_attribute('color')['name'])
|
||||||
|
return color_name
|
||||||
|
|
||||||
|
@allure.step('Get account emoji id')
|
||||||
|
def get_account_emoji_id(self):
|
||||||
|
emoji_id = str(self._wallet_account_emoji.get_object_attribute('emojiId'))
|
||||||
|
return emoji_id
|
||||||
|
|
||||||
|
|
||||||
class NetworkWalletSettings(WalletSettingsView):
|
class NetworkWalletSettings(WalletSettingsView):
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
|
||||||
|
import allure
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from constants.wallet import WalletNetworkSettings
|
||||||
|
from gui.main_window import MainWindow
|
||||||
|
|
||||||
|
|
||||||
|
@allure.testcase('https://ethstatus.testrail.net/index.php?/cases/view/704433',
|
||||||
|
'Account view: Edit Status default account')
|
||||||
|
@pytest.mark.case(704433)
|
||||||
|
@pytest.mark.parametrize('new_name', [
|
||||||
|
pytest.param(''.join(random.choices(string.ascii_letters +
|
||||||
|
string.digits, k=40)))
|
||||||
|
])
|
||||||
|
def test_settings_edit_status_account(main_screen: MainWindow, new_name):
|
||||||
|
status_acc_view = (
|
||||||
|
main_screen.left_panel.open_settings().left_panel.open_wallet_settings().open_status_account_in_settings())
|
||||||
|
|
||||||
|
assert status_acc_view.get_account_name_value() == WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_NAME.value, \
|
||||||
|
f"Status main account name must be {WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_NAME.value}"
|
||||||
|
assert status_acc_view.get_account_color_value() == WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_COLOR.value, \
|
||||||
|
f"Status main account color must be {WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_COLOR.value}"
|
||||||
|
|
||||||
|
account_emoji_id_before = status_acc_view.get_account_emoji_id()
|
||||||
|
|
||||||
|
edit_acc_pop_up = status_acc_view.click_edit_account_button()
|
||||||
|
edit_acc_pop_up.type_in_account_name(new_name)
|
||||||
|
edit_acc_pop_up.select_random_color_for_account()
|
||||||
|
edit_acc_pop_up.select_random_emoji_for_account()
|
||||||
|
edit_acc_pop_up.click_change_name_button()
|
||||||
|
edit_acc_pop_up.wait_until_hidden()
|
||||||
|
current_color = status_acc_view.get_account_color_value()
|
||||||
|
account_emoji_id_after = status_acc_view.get_account_emoji_id()
|
||||||
|
|
||||||
|
assert status_acc_view.get_account_name_value() == new_name, f"Account name has not been changed"
|
||||||
|
assert account_emoji_id_before != account_emoji_id_after, f"Account emoji has not been changed"
|
||||||
|
assert WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_COLOR.value != current_color, \
|
||||||
|
(f"Account color has not been changed: color before was {WalletNetworkSettings.STATUS_ACCOUNT_DEFAULT_COLOR.value},"
|
||||||
|
f" color after is {current_color}")
|
||||||
|
|
Loading…
Reference in New Issue