2024-11-04 15:42:34 +00:00
|
|
|
import time
|
|
|
|
|
2024-06-05 07:52:32 +00:00
|
|
|
import configs.timeouts
|
2023-11-03 15:04:23 +00:00
|
|
|
from constants.wallet import *
|
2024-07-10 10:00:25 +00:00
|
|
|
from gui.screens.settings_keycard import KeycardSettingsView
|
2023-10-19 13:56:33 +00:00
|
|
|
from gui.screens.settings_wallet import *
|
2023-09-05 06:22:44 +00:00
|
|
|
from gui.components.base_popup import BasePopup
|
|
|
|
from gui.components.emoji_popup import EmojiPopup
|
2024-05-30 12:07:43 +00:00
|
|
|
from gui.components.authenticate_popup import AuthenticatePopup
|
2023-10-09 17:04:29 +00:00
|
|
|
from gui.components.wallet.back_up_your_seed_phrase_popup import BackUpYourSeedPhrasePopUp
|
2023-10-06 08:33:42 +00:00
|
|
|
from gui.elements.button import Button
|
|
|
|
from gui.elements.check_box import CheckBox
|
|
|
|
from gui.elements.object import QObject
|
|
|
|
from gui.elements.scroll import Scroll
|
|
|
|
from gui.elements.text_edit import TextEdit
|
2024-01-10 17:15:38 +00:00
|
|
|
from gui.elements.text_label import TextLabel
|
2024-07-09 10:05:39 +00:00
|
|
|
from gui.objects_map import names, onboarding_names
|
2023-09-05 06:22:44 +00:00
|
|
|
|
2023-09-07 04:13:38 +00:00
|
|
|
GENERATED_PAGES_LIMIT = 20
|
2023-09-05 06:22:44 +00:00
|
|
|
|
2023-09-14 03:52:27 +00:00
|
|
|
|
2023-09-05 06:22:44 +00:00
|
|
|
class AccountPopup(BasePopup):
|
|
|
|
def __init__(self):
|
|
|
|
super(AccountPopup, self).__init__()
|
2024-07-10 05:00:53 +00:00
|
|
|
self._scroll = Scroll(names.generalView_StatusScrollView)
|
2024-02-13 09:04:24 +00:00
|
|
|
self._name_text_edit = TextEdit(names.mainWallet_AddEditAccountPopup_AccountName)
|
2024-06-06 07:17:16 +00:00
|
|
|
self._name_text_input = QObject(names.mainWallet_AddEditAccountPopup_AccountNameComponent)
|
2024-02-13 09:04:24 +00:00
|
|
|
self._emoji_button = Button(names.mainWallet_AddEditAccountPopup_AccountEmojiPopupButton)
|
|
|
|
self._color_radiobutton = QObject(names.color_StatusColorRadioButton)
|
|
|
|
self._popup_header_title = TextLabel(names.mainWallet_AddEditAccountPopup_HeaderTitle)
|
2024-05-27 15:33:22 +00:00
|
|
|
self._emoji_id_in_title = QObject(names.mainWallet_AddEditAccountPopup_HeaderEmoji)
|
2023-09-05 06:22:44 +00:00
|
|
|
# origin
|
2024-02-13 09:04:24 +00:00
|
|
|
self._origin_combobox = QObject(names.mainWallet_AddEditAccountPopup_SelectedOrigin)
|
|
|
|
self._watched_address_origin_item = QObject(names.mainWallet_AddEditAccountPopup_OriginOptionWatchOnlyAcc)
|
|
|
|
self._new_master_key_origin_item = QObject(names.mainWallet_AddEditAccountPopup_OriginOptionNewMasterKey)
|
|
|
|
self._existing_origin_item = QObject(names.addAccountPopup_OriginOption_StatusListItem)
|
|
|
|
self._use_keycard_button = QObject(names.mainWallet_AddEditAccountPopup_MasterKey_GoToKeycardSettingsOption)
|
2023-09-05 06:22:44 +00:00
|
|
|
# derivation
|
2024-02-13 09:04:24 +00:00
|
|
|
self._address_text_edit = TextEdit(names.mainWallet_AddEditAccountPopup_AccountWatchOnlyAddress)
|
2024-05-30 12:07:43 +00:00
|
|
|
self._add_save_account_confirmation_button = Button(names.mainWallet_AddEditAccountPopup_PrimaryButton)
|
2024-10-04 11:56:04 +00:00
|
|
|
self.copy_derivation_path_button = Button(names.mainWallet_AddEditAccountPopup_CopyDerivationPathButton)
|
2024-02-13 09:04:24 +00:00
|
|
|
self._edit_derivation_path_button = Button(names.mainWallet_AddEditAccountPopup_EditDerivationPathButton)
|
2024-05-27 09:13:43 +00:00
|
|
|
self._derivation_path_combobox_button = Button(
|
|
|
|
names.mainWallet_AddEditAccountPopup_PreDefinedDerivationPathsButton)
|
2024-02-13 09:04:24 +00:00
|
|
|
self._derivation_path_list_item = QObject(names.mainWallet_AddEditAccountPopup_derivationPath)
|
|
|
|
self._reset_derivation_path_button = Button(names.mainWallet_AddEditAccountPopup_ResetDerivationPathButton)
|
|
|
|
self._derivation_path_text_edit = TextEdit(names.mainWallet_AddEditAccountPopup_DerivationPathInput)
|
|
|
|
self._address_combobox_button = Button(names.mainWallet_AddEditAccountPopup_GeneratedAddressComponent)
|
|
|
|
self._non_eth_checkbox = CheckBox(names.mainWallet_AddEditAccountPopup_NonEthDerivationPathCheckBox)
|
2023-09-05 06:22:44 +00:00
|
|
|
|
2024-03-22 12:01:38 +00:00
|
|
|
def verify_add_account_popup_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
2024-10-24 15:45:38 +00:00
|
|
|
driver.waitFor(lambda: self._popup_header_title.is_visible, timeout_msec)
|
2024-01-12 08:01:08 +00:00
|
|
|
assert (getattr(self._popup_header_title.object, 'text')
|
|
|
|
== WalletScreensHeaders.WALLET_ADD_ACCOUNT_POPUP_TITLE.value), \
|
|
|
|
f"AccountPopup is not shown or has wrong title, \
|
|
|
|
current screen title is {getattr(self._popup_header_title.object, 'text')}"
|
2024-01-10 17:15:38 +00:00
|
|
|
return self
|
|
|
|
|
2024-03-22 12:01:38 +00:00
|
|
|
def verify_edit_account_popup_present(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
|
|
|
driver.waitFor(lambda: self._popup_header_title.exists, timeout_msec)
|
|
|
|
assert (getattr(self._popup_header_title.object, 'text')
|
|
|
|
== WalletScreensHeaders.WALLET_EDIT_ACCOUNT_POPUP_TITLE.value), \
|
|
|
|
f"AccountPopup is not shown or has wrong title, \
|
|
|
|
current screen title is {getattr(self._popup_header_title.object, 'text')}"
|
|
|
|
return self
|
|
|
|
|
2023-09-05 06:22:44 +00:00
|
|
|
@allure.step('Set name for account')
|
|
|
|
def set_name(self, value: str):
|
|
|
|
self._name_text_edit.text = value
|
|
|
|
return self
|
|
|
|
|
2024-06-06 07:17:16 +00:00
|
|
|
@allure.step('Get error message')
|
|
|
|
def get_error_message(self):
|
|
|
|
return self._name_text_input.object.errorMessageCmp.text
|
|
|
|
|
2023-09-05 06:22:44 +00:00
|
|
|
@allure.step('Set color for account')
|
|
|
|
def set_color(self, value: str):
|
|
|
|
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)]
|
|
|
|
assert value in colors, f'Color {value} not found in {colors}'
|
|
|
|
self._color_radiobutton.real_name['radioButtonColor'] = value
|
|
|
|
self._color_radiobutton.click()
|
|
|
|
return self
|
|
|
|
|
2024-08-28 12:54:29 +00:00
|
|
|
def set_random_color(self):
|
2024-08-08 14:09:18 +00:00
|
|
|
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)]
|
|
|
|
random_color = random.choice(colors)
|
|
|
|
self._color_radiobutton.real_name['radioButtonColor'] = random_color
|
|
|
|
self._color_radiobutton.click()
|
|
|
|
return random_color
|
|
|
|
|
2023-09-05 06:22:44 +00:00
|
|
|
@allure.step('Set emoji for account')
|
|
|
|
def set_emoji(self, value: str):
|
|
|
|
self._emoji_button.click()
|
2024-06-05 07:52:32 +00:00
|
|
|
EmojiPopup().wait_until_appears(timeout_msec=10000).select(value)
|
2023-09-05 06:22:44 +00:00
|
|
|
return self
|
|
|
|
|
2024-05-27 15:33:22 +00:00
|
|
|
@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'))
|
|
|
|
|
2023-09-05 06:22:44 +00:00
|
|
|
@allure.step('Set eth address for account added from context menu')
|
|
|
|
def set_eth_address(self, value: str):
|
|
|
|
self._address_text_edit.text = value
|
|
|
|
return self
|
|
|
|
|
|
|
|
@allure.step('Set eth address for account added from plus button')
|
2023-11-03 15:04:23 +00:00
|
|
|
def set_origin_watched_address(self, value: str):
|
2023-09-05 06:22:44 +00:00
|
|
|
self._origin_combobox.click()
|
2023-11-03 15:04:23 +00:00
|
|
|
self._watched_address_origin_item.click()
|
2023-11-17 14:27:51 +00:00
|
|
|
assert getattr(self._origin_combobox.object, 'title') == WalletOrigin.WATCHED_ADDRESS_ORIGIN.value
|
2023-09-05 06:22:44 +00:00
|
|
|
self._address_text_edit.text = value
|
|
|
|
return self
|
|
|
|
|
2023-09-07 04:13:38 +00:00
|
|
|
@allure.step('Set private key for account')
|
2024-06-06 07:17:16 +00:00
|
|
|
def set_origin_private_key(self, value: str, private_key_name: str):
|
|
|
|
self.open_add_new_account_popup().import_private_key(value, private_key_name)
|
2023-09-07 04:13:38 +00:00
|
|
|
return self
|
|
|
|
|
2024-05-27 09:13:43 +00:00
|
|
|
@allure.step('Click new master key item')
|
2024-06-06 06:14:30 +00:00
|
|
|
def click_new_master_key(self, attempts: int = 2):
|
2024-05-27 09:13:43 +00:00
|
|
|
self._new_master_key_origin_item.click()
|
|
|
|
try:
|
2024-05-29 05:33:48 +00:00
|
|
|
AccountPopup().verify_add_account_popup_present()
|
|
|
|
return AddNewAccountPopup()
|
2024-05-27 09:13:43 +00:00
|
|
|
except AssertionError as err:
|
|
|
|
if attempts:
|
2024-06-06 06:14:30 +00:00
|
|
|
return self.click_new_master_key(attempts - 1)
|
2024-05-27 09:13:43 +00:00
|
|
|
else:
|
|
|
|
raise err
|
|
|
|
|
2023-09-14 03:52:27 +00:00
|
|
|
@allure.step('Set new seed phrase for account')
|
|
|
|
def set_origin_new_seed_phrase(self, value: str):
|
2024-05-28 05:32:01 +00:00
|
|
|
self.open_add_new_account_popup().generate_new_master_key(value)
|
2023-09-14 03:52:27 +00:00
|
|
|
return self
|
|
|
|
|
2024-05-28 05:32:01 +00:00
|
|
|
@allure.step('Open add new account popup')
|
|
|
|
def open_add_new_account_popup(self):
|
2023-09-14 03:52:27 +00:00
|
|
|
self._origin_combobox.click()
|
2024-06-06 06:14:30 +00:00
|
|
|
self.click_new_master_key()
|
2024-05-28 05:32:01 +00:00
|
|
|
return AddNewAccountPopup().wait_until_appears()
|
2023-09-14 03:52:27 +00:00
|
|
|
|
2023-09-07 04:13:38 +00:00
|
|
|
@allure.step('Set derivation path for account')
|
|
|
|
def set_derivation_path(self, value: str, index: int, password: str):
|
|
|
|
self._edit_derivation_path_button.hover().click()
|
|
|
|
AuthenticatePopup().wait_until_appears().authenticate(password)
|
2024-08-28 12:54:29 +00:00
|
|
|
if value in [_.value for _ in DerivationPathName]:
|
2023-09-07 04:13:38 +00:00
|
|
|
self._derivation_path_combobox_button.click()
|
|
|
|
self._derivation_path_list_item.real_name['title'] = value
|
|
|
|
self._derivation_path_list_item.click()
|
|
|
|
del self._derivation_path_list_item.real_name['title']
|
|
|
|
self._address_combobox_button.click()
|
|
|
|
GeneratedAddressesList().wait_until_appears().select(index)
|
2024-08-28 12:54:29 +00:00
|
|
|
if value != DerivationPathName.ETHEREUM.value:
|
2024-07-10 05:00:53 +00:00
|
|
|
self._scroll.vertical_scroll_down(self._non_eth_checkbox)
|
2023-09-07 04:13:38 +00:00
|
|
|
self._non_eth_checkbox.set(True)
|
|
|
|
else:
|
|
|
|
self._derivation_path_text_edit.type_text(str(index))
|
|
|
|
return self
|
|
|
|
|
2023-09-14 03:52:27 +00:00
|
|
|
@allure.step('Click continue in keycard settings')
|
|
|
|
def continue_in_keycard_settings(self):
|
|
|
|
self._origin_combobox.click()
|
2024-06-06 06:14:30 +00:00
|
|
|
self.click_new_master_key()
|
2023-09-14 03:52:27 +00:00
|
|
|
self._use_keycard_button.click()
|
2024-07-19 06:43:44 +00:00
|
|
|
return KeycardSettingsView().wait_until_appears(), 'Keycard settings view was not opened'
|
2023-09-14 03:52:27 +00:00
|
|
|
|
2024-05-30 12:07:43 +00:00
|
|
|
@allure.step('Click confirmation (add account / save changes) button')
|
|
|
|
def save_changes(self):
|
2024-06-05 07:52:32 +00:00
|
|
|
assert driver.waitFor(lambda: self.is_save_changes_button_enabled(),
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC)
|
2024-06-26 09:53:52 +00:00
|
|
|
# TODO https://github.com/status-im/status-desktop/issues/15345
|
2024-10-07 11:45:43 +00:00
|
|
|
self._add_save_account_confirmation_button.click(timeout=60)
|
2023-09-07 04:13:38 +00:00
|
|
|
return self
|
|
|
|
|
2024-06-05 07:52:32 +00:00
|
|
|
@allure.step('Get enabled state of (add account / save changes) button')
|
|
|
|
def is_save_changes_button_enabled(self):
|
|
|
|
return driver.waitForObjectExists(self._add_save_account_confirmation_button.real_name,
|
|
|
|
configs.timeouts.UI_LOAD_TIMEOUT_MSEC).enabled
|
|
|
|
|
2023-09-07 04:13:38 +00:00
|
|
|
|
2023-10-19 13:56:33 +00:00
|
|
|
class EditAccountFromSettingsPopup(BasePopup):
|
|
|
|
def __init__(self):
|
|
|
|
super(EditAccountFromSettingsPopup, self).__init__()
|
2024-02-13 09:04:24 +00:00
|
|
|
self._change_name_button = Button(names.editWalletSettings_renameButton)
|
|
|
|
self._account_name_input = TextEdit(names.editWalletSettings_AccountNameInput)
|
|
|
|
self._emoji_selector = QObject(names.editWalletSettings_EmojiSelector)
|
|
|
|
self._color_radiobutton = QObject(names.editWalletSettings_ColorSelector)
|
|
|
|
self._emoji_item = QObject(names.editWalletSettings_EmojiItem)
|
2023-10-19 13:56:33 +00:00
|
|
|
|
|
|
|
@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)]
|
2024-01-12 08:01:08 +00:00
|
|
|
self._color_radiobutton.real_name['radioButtonColor'] = \
|
2023-10-19 13:56:33 +00:00
|
|
|
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
|
|
|
|
|
|
|
|
|
2023-09-07 04:13:38 +00:00
|
|
|
class AddNewAccountPopup(BasePopup):
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
super(AddNewAccountPopup, self).__init__()
|
2024-02-13 09:04:24 +00:00
|
|
|
self._import_private_key_button = Button(names.mainWallet_AddEditAccountPopup_MasterKey_ImportPrivateKeyOption)
|
|
|
|
self._private_key_text_edit = TextEdit(names.mainWallet_AddEditAccountPopup_PrivateKey)
|
|
|
|
self._private_key_name_text_edit = TextEdit(names.mainWallet_AddEditAccountPopup_PrivateKeyName)
|
|
|
|
self._continue_button = Button(names.mainWallet_AddEditAccountPopup_PrimaryButton)
|
|
|
|
self._import_seed_phrase_button = Button(names.mainWallet_AddEditAccountPopup_MasterKey_ImportSeedPhraseOption)
|
2024-05-27 09:13:43 +00:00
|
|
|
self._generate_master_key_button = Button(
|
|
|
|
names.mainWallet_AddEditAccountPopup_MasterKey_GenerateSeedPhraseOption)
|
2024-02-13 09:04:24 +00:00
|
|
|
self._seed_phrase_12_words_button = Button(names.mainWallet_AddEditAccountPopup_12WordsButton)
|
|
|
|
self._seed_phrase_18_words_button = Button(names.mainWallet_AddEditAccountPopup_18WordsButton)
|
|
|
|
self._seed_phrase_24_words_button = Button(names.mainWallet_AddEditAccountPopup_24WordsButton)
|
2024-07-09 10:05:39 +00:00
|
|
|
self._seed_phrase_word_text_edit = TextEdit(onboarding_names.mainWindow_statusSeedPhraseInputField_TextEdit)
|
2023-09-14 03:52:27 +00:00
|
|
|
self._seed_phrase_phrase_key_name_text_edit = TextEdit(
|
2024-02-13 09:04:24 +00:00
|
|
|
names.mainWallet_AddEditAccountPopup_ImportedSeedPhraseKeyName)
|
2024-06-06 07:17:16 +00:00
|
|
|
self._seed_phrase_status_input = QObject(names.addAccountPopup_ImportedSeedPhraseKeyName_StatusInput)
|
|
|
|
self._private_key_status_input = QObject(names.addAccountPopup_PrivateKeyName_StatusInput)
|
2024-05-28 05:32:01 +00:00
|
|
|
self._already_added_error = QObject(names.enterSeedPhraseInvalidSeedText_StatusBaseText)
|
2023-09-07 04:13:38 +00:00
|
|
|
|
2024-05-27 09:13:43 +00:00
|
|
|
@allure.step('Wait until appears {0}')
|
|
|
|
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
|
|
|
self._generate_master_key_button.wait_until_appears(timeout_msec)
|
|
|
|
return self
|
|
|
|
|
2024-06-06 07:17:16 +00:00
|
|
|
@allure.step('Get error message')
|
|
|
|
def get_error_message(self) -> str:
|
|
|
|
return str(self._seed_phrase_status_input.object.errorMessageCmp.text)
|
|
|
|
|
|
|
|
@allure.step('Get private key error message')
|
|
|
|
def get_private_key_error_message(self) -> str:
|
|
|
|
return str(self._private_key_status_input.object.errorMessageCmp.text)
|
|
|
|
|
2023-09-07 04:13:38 +00:00
|
|
|
@allure.step('Import private key')
|
2024-06-06 07:17:16 +00:00
|
|
|
def import_private_key(self, private_key: str, private_key_name: str) -> str:
|
|
|
|
self.import_and_enter_private_key(private_key)
|
|
|
|
self.enter_private_key_name(private_key_name)
|
|
|
|
self.click_continue()
|
|
|
|
return private_key_name
|
|
|
|
|
|
|
|
@allure.step('Click import private key and enter private key')
|
|
|
|
def import_and_enter_private_key(self, private_key: str):
|
2023-09-07 04:13:38 +00:00
|
|
|
self._import_private_key_button.click()
|
|
|
|
self._private_key_text_edit.text = private_key
|
2024-06-06 07:17:16 +00:00
|
|
|
return self
|
|
|
|
|
|
|
|
@allure.step('Enter private key name')
|
|
|
|
def enter_private_key_name(self, private_key_name: str):
|
|
|
|
self._private_key_name_text_edit.text = private_key_name
|
|
|
|
return self
|
|
|
|
|
|
|
|
@allure.step('Click continue')
|
|
|
|
def click_continue(self):
|
2024-10-07 11:45:43 +00:00
|
|
|
# TODO https://github.com/status-im/status-desktop/issues/15345
|
|
|
|
self._continue_button.click(timeout=60)
|
2024-06-06 07:17:16 +00:00
|
|
|
return self
|
2023-09-07 04:13:38 +00:00
|
|
|
|
2024-05-28 05:32:01 +00:00
|
|
|
@allure.step('Import new seed phrase and continue')
|
|
|
|
def import_new_seed_phrase(self, seed_phrase_words: list):
|
|
|
|
self.enter_new_seed_phrase(seed_phrase_words)
|
|
|
|
seed_phrase_name = ''.join([word[0] for word in seed_phrase_words[:10]])
|
2024-06-06 07:17:16 +00:00
|
|
|
self.enter_seed_phrase_name(seed_phrase_name)
|
|
|
|
self.click_continue()
|
2024-05-28 05:32:01 +00:00
|
|
|
return seed_phrase_name
|
|
|
|
|
|
|
|
@allure.step('Enter new seed phrase')
|
2024-06-06 07:17:16 +00:00
|
|
|
def enter_new_seed_phrase(self, seed_phrase_words: list):
|
2024-10-07 11:45:43 +00:00
|
|
|
# TODO https://github.com/status-im/status-desktop/issues/15345
|
|
|
|
self._import_seed_phrase_button.click(timeout=60)
|
2023-09-14 03:52:27 +00:00
|
|
|
if len(seed_phrase_words) == 12:
|
|
|
|
self._seed_phrase_12_words_button.click()
|
|
|
|
elif len(seed_phrase_words) == 18:
|
|
|
|
self._seed_phrase_18_words_button.click()
|
|
|
|
elif len(seed_phrase_words) == 24:
|
|
|
|
self._seed_phrase_24_words_button.click()
|
|
|
|
else:
|
|
|
|
raise RuntimeError("Wrong amount of seed words", len(seed_phrase_words))
|
|
|
|
for count, word in enumerate(seed_phrase_words, start=1):
|
2024-02-15 07:46:50 +00:00
|
|
|
self._seed_phrase_word_text_edit.real_name['objectName'] = f'enterSeedPhraseInputField{count}'
|
2023-09-14 03:52:27 +00:00
|
|
|
self._seed_phrase_word_text_edit.text = word
|
2024-06-06 07:17:16 +00:00
|
|
|
return self
|
|
|
|
|
|
|
|
@allure.step('Enter seed phrase name')
|
|
|
|
def enter_seed_phrase_name(self, seed_phrase_name: str):
|
|
|
|
self._seed_phrase_phrase_key_name_text_edit.text = seed_phrase_name
|
|
|
|
return self
|
2023-09-14 03:52:27 +00:00
|
|
|
|
|
|
|
@allure.step('Generate new seed phrase')
|
|
|
|
def generate_new_master_key(self, name: str):
|
|
|
|
self._generate_master_key_button.click()
|
|
|
|
BackUpYourSeedPhrasePopUp().wait_until_appears().generate_seed_phrase(name)
|
|
|
|
|
2024-05-28 05:32:01 +00:00
|
|
|
@allure.step('Get text of error')
|
|
|
|
def get_already_added_error(self):
|
|
|
|
assert self._already_added_error.is_visible
|
|
|
|
return self._already_added_error.object.text
|
|
|
|
|
2023-09-07 04:13:38 +00:00
|
|
|
|
|
|
|
class GeneratedAddressesList(QObject):
|
|
|
|
|
|
|
|
def __init__(self):
|
2024-10-10 10:26:23 +00:00
|
|
|
super().__init__(names.basePopup)
|
2024-02-13 09:04:24 +00:00
|
|
|
self._address_list_item = QObject(names.addAccountPopup_GeneratedAddress)
|
|
|
|
self._paginator_page = QObject(names.page_StatusBaseButton)
|
2023-09-07 04:13:38 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
@allure.step('Load generated addresses list')
|
|
|
|
def is_paginator_load(self) -> bool:
|
|
|
|
try:
|
|
|
|
return str(driver.findAllObjects(self._paginator_page.real_name)[0].text) == '1'
|
|
|
|
except IndexError:
|
|
|
|
return False
|
|
|
|
|
|
|
|
@allure.step('Wait until appears {0}')
|
|
|
|
def wait_until_appears(self, timeout_msec: int = configs.timeouts.UI_LOAD_TIMEOUT_MSEC):
|
|
|
|
if 'text' in self._paginator_page.real_name:
|
|
|
|
del self._paginator_page.real_name['text']
|
|
|
|
assert driver.waitFor(lambda: self.is_paginator_load, timeout_msec), 'Generated address list not load'
|
|
|
|
return self
|
|
|
|
|
|
|
|
@allure.step('Select address in list')
|
|
|
|
def select(self, index: int):
|
|
|
|
self._address_list_item.real_name['objectName'] = f'AddAccountPopup-GeneratedAddress-{index}'
|
|
|
|
|
|
|
|
selected_page_number = 1
|
|
|
|
while selected_page_number != GENERATED_PAGES_LIMIT:
|
|
|
|
if self._address_list_item.is_visible:
|
|
|
|
self._address_list_item.click()
|
|
|
|
self._paginator_page.wait_until_hidden()
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
selected_page_number += 1
|
|
|
|
self._paginator_page.real_name['text'] = selected_page_number
|
2023-09-14 03:52:27 +00:00
|
|
|
self._paginator_page.click()
|
2024-11-04 15:42:34 +00:00
|
|
|
time.sleep(0.5)
|