2022-07-18 08:37:37 +00:00
|
|
|
from enum import Enum
|
|
|
|
import time
|
2022-08-18 17:51:18 +00:00
|
|
|
import os
|
2022-07-18 08:37:37 +00:00
|
|
|
import sys
|
|
|
|
from drivers.SquishDriver import *
|
|
|
|
from drivers.SquishDriverVerification import *
|
2022-08-03 17:31:59 +00:00
|
|
|
from common.SeedUtils import *
|
2022-08-24 08:23:43 +00:00
|
|
|
from .StatusMainScreen import StatusMainScreen
|
2022-07-18 08:37:37 +00:00
|
|
|
|
2022-08-18 17:51:18 +00:00
|
|
|
class Tokens(Enum):
|
|
|
|
ETH: str = "ETH"
|
|
|
|
|
2022-07-18 08:37:37 +00:00
|
|
|
class SigningPhrasePopUp(Enum):
|
2022-07-29 22:51:34 +00:00
|
|
|
OK_GOT_IT_BUTTON: str = "signPhrase_Ok_Button"
|
2022-07-18 08:37:37 +00:00
|
|
|
|
|
|
|
class MainWalletScreen(Enum):
|
|
|
|
ADD_ACCOUNT_BUTTON: str = "mainWallet_Add_Account"
|
|
|
|
ACCOUNT_NAME: str = "mainWallet_Account_Name"
|
2022-08-18 17:51:18 +00:00
|
|
|
ACCOUNT_ADDRESS_PANEL: str = "mainWallet_Address_Panel"
|
2022-07-21 12:15:02 +00:00
|
|
|
SEND_BUTTON_FOOTER: str = "mainWallet_Footer_Send_Button"
|
2022-08-03 10:08:46 +00:00
|
|
|
SAVED_ADDRESSES_BUTTON: str = "mainWallet_Saved_Addresses_Button"
|
2022-08-08 10:07:29 +00:00
|
|
|
NETWORK_SELECTOR_BUTTON: str = "mainWallet_Network_Selector_Button"
|
2022-08-10 14:26:29 +00:00
|
|
|
RIGHT_SIDE_TABBAR: str = "mainWallet_Right_Side_Tab_Bar"
|
2022-08-18 17:51:18 +00:00
|
|
|
MAILSERVER_DIALOG: str = "mailserver_dialog"
|
|
|
|
MAILSERVER_RETRY: str = "mailserver_retry"
|
2022-08-08 10:07:29 +00:00
|
|
|
|
|
|
|
class AssetView(Enum):
|
|
|
|
LIST: str = "mainWallet_Assets_View_List"
|
|
|
|
|
|
|
|
class NetworkSelectorPopup(Enum):
|
|
|
|
LAYER_1_REPEATER: str = "mainWallet_Network_Popup_Chain_Repeater_1"
|
2022-08-03 10:08:46 +00:00
|
|
|
|
|
|
|
class SavedAddressesScreen(Enum):
|
|
|
|
ADD_BUTTON: str = "mainWallet_Saved_Addreses_Add_Buttton"
|
|
|
|
SAVED_ADDRESSES_LIST: str = "mainWallet_Saved_Addreses_List"
|
2022-08-04 09:06:15 +00:00
|
|
|
EDIT: str = "mainWallet_Saved_Addreses_More_Edit"
|
|
|
|
DELETE: str = "mainWallet_Saved_Addreses_More_Delete"
|
|
|
|
CONFIRM_DELETE: str = "mainWallet_Saved_Addreses_More_Confirm_Delete"
|
2022-08-24 08:23:43 +00:00
|
|
|
DELEGATE_MENU_BUTTON_OBJECT_NAME: str = "savedAddressView_Delegate_menuButton"
|
|
|
|
DELEGATE_FAVOURITE_BUTTON_OBJECT_NAME: str = "savedAddressView_Delegate_favouriteButton"
|
|
|
|
|
2022-08-03 10:08:46 +00:00
|
|
|
class AddSavedAddressPopup(Enum):
|
|
|
|
NAME_INPUT: str = "mainWallet_Saved_Addreses_Popup_Name_Input"
|
|
|
|
ADDRESS_INPUT: str = "mainWallet_Saved_Addreses_Popup_Address_Input"
|
|
|
|
ADD_BUTTON: str = "mainWallet_Saved_Addreses_Popup_Address_Add_Button"
|
2022-07-18 08:37:37 +00:00
|
|
|
|
2022-07-21 12:15:02 +00:00
|
|
|
class SendPopup(Enum):
|
|
|
|
SCROLL_BAR: str = "mainWallet_Send_Popup_Main"
|
|
|
|
HEADER_ACCOUNTS_LIST: str = "mainWallet_Send_Popup_Header_Accounts"
|
|
|
|
AMOUNT_INPUT: str = "mainWallet_Send_Popup_Amount_Input"
|
2022-08-18 17:51:18 +00:00
|
|
|
GAS_PRICE_INPUT: str = "mainWallet_Send_Popup_GasPrice_Input"
|
2022-07-21 12:15:02 +00:00
|
|
|
MY_ACCOUNTS_TAB: str = "mainWallet_Send_Popup_My_Accounts_Tab"
|
|
|
|
MY_ACCOUNTS_LIST: str = "mainWallet_Send_Popup_My_Accounts_List"
|
|
|
|
NETWORKS_LIST: str = "mainWallet_Send_Popup_Networks_List"
|
|
|
|
SEND_BUTTON: str = "mainWallet_Send_Popup_Send_Button"
|
|
|
|
PASSWORD_INPUT: str = "mainWallet_Send_Popup_Password_Input"
|
2022-08-09 13:52:17 +00:00
|
|
|
ASSET_SELECTOR: str = "mainWallet_Send_Popup_Asset_Selector"
|
|
|
|
ASSET_LIST: str = "mainWallet_Send_Popup_Asset_List"
|
2022-08-18 17:51:18 +00:00
|
|
|
HIGH_GAS_BUTTON: str = "mainWallet_Send_Popup_GasSelector_HighGas_Button"
|
2022-07-18 08:37:37 +00:00
|
|
|
|
|
|
|
class AddAccountPopup(Enum):
|
|
|
|
SCROLL_BAR: str = "mainWallet_Add_Account_Popup_Main"
|
|
|
|
PASSWORD_INPUT: str = "mainWallet_Add_Account_Popup_Password"
|
|
|
|
ACCOUNT_NAME_INPUT: str = "mainWallet_Add_Account_Popup_Account_Name"
|
|
|
|
ADVANCE_SECTION: str = "mainWallet_Add_Account_Popup_Advanced"
|
|
|
|
TYPE_SELECTOR: str = "mainWallet_Add_Account_Popup_Type_Selector"
|
|
|
|
TYPE_WATCH_ONLY: str = "mainWallet_Add_Account_Popup_Type_Watch_Only"
|
|
|
|
TYPE_SEED_PHRASE: str = "mainWallet_Add_Account_Popup_Type_Seed_Phrase"
|
|
|
|
TYPE_PRIVATE_KEY: str = "mainWallet_Add_Account_Popup_Type_Private_Key"
|
|
|
|
ADDRESS_INPUT: str = "mainWallet_Add_Account_Popup_Watch_Only_Address"
|
|
|
|
PRIVATE_KEY_INPUT: str = "mainWallet_Add_Account_Popup_Private_Key"
|
2022-09-27 10:10:45 +00:00
|
|
|
AUTHENTICATE_BUTTON: str = "mainWallet_Authenticate_Popup_Footer_Add_Account"
|
2022-07-18 08:37:37 +00:00
|
|
|
ADD_ACCOUNT_BUTTON: str = "mainWallet_Add_Account_Popup_Footer_Add_Account"
|
2022-08-03 17:31:59 +00:00
|
|
|
SEED_PHRASE_INPUT_TEMPLATE: str = "mainWindow_Add_Account_Popup_Seed_Phrase_"
|
2022-08-10 14:26:29 +00:00
|
|
|
|
2022-09-27 10:10:45 +00:00
|
|
|
class SharedPopup(Enum):
|
|
|
|
POPUP_CONTENT: str = "sharedPopup_Popup_Content"
|
|
|
|
PASSWORD_INPUT: str = "sharedPopup_Password_Input"
|
|
|
|
PRIMARY_BUTTON: str = "sharedPopup_Primary_Button"
|
|
|
|
|
2022-08-10 14:26:29 +00:00
|
|
|
class CollectiblesView(Enum):
|
|
|
|
COLLECTIONS_REPEATER: str = "mainWallet_Collections_Repeater"
|
|
|
|
COLLECTIBLES_REPEATER: str = "mainWallet_Collectibles_Repeater"
|
|
|
|
|
|
|
|
class WalletTabBar(Enum):
|
|
|
|
ASSET_TAB = 0
|
|
|
|
COLLECTION_TAB = 1
|
2022-09-20 12:27:52 +00:00
|
|
|
ACTIVITY_TAB = 2
|
|
|
|
|
|
|
|
class TransactionsView(Enum):
|
|
|
|
TRANSACTIONS_LISTVIEW: str = "mainWallet_Transactions_List"
|
|
|
|
TRANSACTIONS_DETAIL_VIEW_HEADER: str = "mainWallet_Transactions_Detail_View_Header"
|
2022-07-18 08:37:37 +00:00
|
|
|
|
|
|
|
class StatusWalletScreen:
|
|
|
|
|
2022-07-20 08:18:27 +00:00
|
|
|
def accept_signing_phrase(self):
|
2022-07-18 08:37:37 +00:00
|
|
|
click_obj_by_name(SigningPhrasePopUp.OK_GOT_IT_BUTTON.value)
|
|
|
|
|
2022-07-20 08:18:27 +00:00
|
|
|
def add_watch_only_account(self, account_name: str, address: str):
|
2022-07-18 08:37:37 +00:00
|
|
|
click_obj_by_name(MainWalletScreen.ADD_ACCOUNT_BUTTON.value)
|
|
|
|
|
|
|
|
click_obj_by_name(AddAccountPopup.ADVANCE_SECTION.value)
|
2022-09-20 12:27:52 +00:00
|
|
|
|
2022-07-18 08:37:37 +00:00
|
|
|
click_obj_by_name(AddAccountPopup.TYPE_SELECTOR.value)
|
|
|
|
time.sleep(1)
|
|
|
|
click_obj_by_name(AddAccountPopup.TYPE_WATCH_ONLY.value)
|
2022-09-27 10:10:45 +00:00
|
|
|
type(AddAccountPopup.ACCOUNT_NAME_INPUT.value, account_name)
|
2022-07-18 08:37:37 +00:00
|
|
|
|
|
|
|
type(AddAccountPopup.ADDRESS_INPUT.value, address)
|
|
|
|
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)
|
|
|
|
|
2022-07-20 08:18:27 +00:00
|
|
|
def import_private_key(self, account_name: str, password: str, private_key: str):
|
2022-07-18 08:37:37 +00:00
|
|
|
click_obj_by_name(MainWalletScreen.ADD_ACCOUNT_BUTTON.value)
|
|
|
|
|
2022-09-27 10:10:45 +00:00
|
|
|
click_obj_by_name(AddAccountPopup.AUTHENTICATE_BUTTON.value)
|
|
|
|
|
|
|
|
wait_for_object_and_type(SharedPopup.PASSWORD_INPUT.value, password)
|
|
|
|
click_obj_by_name(SharedPopup.PRIMARY_BUTTON.value)
|
|
|
|
|
2022-07-18 08:37:37 +00:00
|
|
|
click_obj_by_name(AddAccountPopup.ADVANCE_SECTION.value)
|
|
|
|
click_obj_by_name(AddAccountPopup.TYPE_SELECTOR.value)
|
|
|
|
time.sleep(1)
|
|
|
|
click_obj_by_name(AddAccountPopup.TYPE_PRIVATE_KEY.value)
|
2022-09-27 10:10:45 +00:00
|
|
|
type(AddAccountPopup.ACCOUNT_NAME_INPUT.value, account_name)
|
2022-07-18 08:37:37 +00:00
|
|
|
|
|
|
|
type(AddAccountPopup.PRIVATE_KEY_INPUT.value, private_key)
|
|
|
|
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)
|
|
|
|
|
2022-07-20 08:18:27 +00:00
|
|
|
def import_seed_phrase(self, account_name: str, password: str, mnemonic: str):
|
2022-07-18 08:37:37 +00:00
|
|
|
click_obj_by_name(MainWalletScreen.ADD_ACCOUNT_BUTTON.value)
|
|
|
|
|
2022-09-27 10:10:45 +00:00
|
|
|
click_obj_by_name(AddAccountPopup.AUTHENTICATE_BUTTON.value)
|
|
|
|
|
|
|
|
wait_for_object_and_type(SharedPopup.PASSWORD_INPUT.value, password)
|
|
|
|
click_obj_by_name(SharedPopup.PRIMARY_BUTTON.value)
|
2022-08-10 07:14:01 +00:00
|
|
|
|
2022-07-18 08:37:37 +00:00
|
|
|
click_obj_by_name(AddAccountPopup.ADVANCE_SECTION.value)
|
|
|
|
click_obj_by_name(AddAccountPopup.TYPE_SELECTOR.value)
|
|
|
|
time.sleep(1)
|
|
|
|
click_obj_by_name(AddAccountPopup.TYPE_SEED_PHRASE.value)
|
2022-09-27 10:10:45 +00:00
|
|
|
type(AddAccountPopup.ACCOUNT_NAME_INPUT.value, account_name)
|
|
|
|
|
2022-07-18 08:37:37 +00:00
|
|
|
words = mnemonic.split()
|
|
|
|
scroll_obj_by_name(AddAccountPopup.SCROLL_BAR.value)
|
2022-08-03 17:31:59 +00:00
|
|
|
time.sleep(1)
|
2022-07-18 08:37:37 +00:00
|
|
|
|
|
|
|
scroll_obj_by_name(AddAccountPopup.SCROLL_BAR.value)
|
2022-08-03 17:31:59 +00:00
|
|
|
time.sleep(1)
|
2022-07-18 08:37:37 +00:00
|
|
|
|
|
|
|
scroll_obj_by_name(AddAccountPopup.SCROLL_BAR.value)
|
2022-08-03 17:31:59 +00:00
|
|
|
time.sleep(1)
|
2022-07-18 08:37:37 +00:00
|
|
|
|
2022-08-03 17:31:59 +00:00
|
|
|
input_seed_phrase(AddAccountPopup.SEED_PHRASE_INPUT_TEMPLATE.value, words)
|
|
|
|
time.sleep(1)
|
2022-07-18 08:37:37 +00:00
|
|
|
|
2022-08-18 17:51:18 +00:00
|
|
|
visible, _ = is_loaded_visible_and_enabled(MainWalletScreen.MAILSERVER_DIALOG.value, 500)
|
|
|
|
if (visible):
|
|
|
|
click_obj_by_name(MainWalletScreen.MAILSERVER_RETRY.value)
|
|
|
|
|
2022-07-18 08:37:37 +00:00
|
|
|
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)
|
2022-08-18 17:51:18 +00:00
|
|
|
time.sleep(5)
|
2022-07-18 08:37:37 +00:00
|
|
|
|
2022-07-20 08:18:27 +00:00
|
|
|
def generate_new_account(self, account_name: str, password: str):
|
2022-07-18 08:37:37 +00:00
|
|
|
click_obj_by_name(MainWalletScreen.ADD_ACCOUNT_BUTTON.value)
|
|
|
|
|
2022-09-27 10:10:45 +00:00
|
|
|
click_obj_by_name(AddAccountPopup.AUTHENTICATE_BUTTON.value)
|
|
|
|
|
|
|
|
wait_for_object_and_type(SharedPopup.PASSWORD_INPUT.value, password)
|
|
|
|
click_obj_by_name(SharedPopup.PRIMARY_BUTTON.value)
|
|
|
|
|
2022-07-18 08:37:37 +00:00
|
|
|
type(AddAccountPopup.ACCOUNT_NAME_INPUT.value, account_name)
|
|
|
|
click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value)
|
|
|
|
|
2022-07-20 08:18:27 +00:00
|
|
|
def verify_account_name_is_present(self, account_name: str):
|
2022-07-18 08:37:37 +00:00
|
|
|
verify_text_matching(MainWalletScreen.ACCOUNT_NAME.value, account_name)
|
|
|
|
|
2022-07-21 12:15:02 +00:00
|
|
|
def send_transaction(self, account_name, amount, token, chain_name, password):
|
2022-08-18 17:51:18 +00:00
|
|
|
# TODO wait for balance to update
|
|
|
|
# Maybe needs a fix on the app itself. Make the Send modal be responsive to when the balance updates
|
|
|
|
time.sleep(2)
|
2022-07-21 12:15:02 +00:00
|
|
|
click_obj_by_name(MainWalletScreen.SEND_BUTTON_FOOTER.value)
|
|
|
|
|
|
|
|
self._click_repeater(SendPopup.HEADER_ACCOUNTS_LIST.value, account_name)
|
|
|
|
time.sleep(1)
|
|
|
|
type(SendPopup.AMOUNT_INPUT.value, amount)
|
2022-08-09 13:52:17 +00:00
|
|
|
|
2022-08-18 17:51:18 +00:00
|
|
|
if token != Tokens.ETH.value:
|
2022-08-09 13:52:17 +00:00
|
|
|
click_obj_by_name(SendPopup.ASSET_SELECTOR.value)
|
|
|
|
asset_list = get_obj(SendPopup.ASSET_LIST.value)
|
|
|
|
for index in range(asset_list.count):
|
2022-08-18 17:51:18 +00:00
|
|
|
tokenObj = asset_list.itemAtIndex(index)
|
|
|
|
if(not squish.isNull(tokenObj) and tokenObj.objectName == "AssetSelector_ItemDelegate_" + token):
|
2022-08-09 13:52:17 +00:00
|
|
|
click_obj(asset_list.itemAtIndex(index))
|
|
|
|
break
|
2022-07-21 12:15:02 +00:00
|
|
|
|
|
|
|
click_obj_by_name(SendPopup.MY_ACCOUNTS_TAB.value)
|
|
|
|
|
|
|
|
accounts = get_obj(SendPopup.MY_ACCOUNTS_LIST.value)
|
|
|
|
for index in range(accounts.count):
|
|
|
|
if(accounts.itemAtIndex(index).objectName == account_name):
|
|
|
|
click_obj(accounts.itemAtIndex(index))
|
|
|
|
break
|
|
|
|
|
2022-08-18 17:51:18 +00:00
|
|
|
scroll_obj_by_name(SendPopup.SCROLL_BAR.value)
|
|
|
|
time.sleep(1)
|
|
|
|
|
2022-07-21 12:15:02 +00:00
|
|
|
self._click_repeater(SendPopup.NETWORKS_LIST.value, chain_name)
|
|
|
|
|
2022-08-18 17:51:18 +00:00
|
|
|
# With the simulator, the gas price estimation doesn't work
|
|
|
|
type(SendPopup.GAS_PRICE_INPUT.value, "20")
|
|
|
|
|
2022-07-21 12:15:02 +00:00
|
|
|
click_obj_by_name(SendPopup.SEND_BUTTON.value)
|
|
|
|
|
|
|
|
type(SendPopup.PASSWORD_INPUT.value, password)
|
|
|
|
click_obj_by_name(SendPopup.SEND_BUTTON.value)
|
|
|
|
|
|
|
|
def _click_repeater(self, repeater_object_name: str, object_name: str):
|
|
|
|
repeater = get_obj(repeater_object_name)
|
|
|
|
for index in range(repeater.count):
|
|
|
|
if(repeater.itemAt(index).objectName == object_name):
|
|
|
|
click_obj(repeater.itemAt(index))
|
|
|
|
break
|
2022-08-03 10:08:46 +00:00
|
|
|
|
|
|
|
def add_saved_address(self, name: str, address: str):
|
|
|
|
click_obj_by_name(MainWalletScreen.SAVED_ADDRESSES_BUTTON.value)
|
|
|
|
click_obj_by_name(SavedAddressesScreen.ADD_BUTTON.value)
|
|
|
|
type(AddSavedAddressPopup.NAME_INPUT.value, name)
|
|
|
|
type(AddSavedAddressPopup.ADDRESS_INPUT.value, address)
|
|
|
|
click_obj_by_name(AddSavedAddressPopup.ADD_BUTTON.value)
|
2022-08-24 08:23:43 +00:00
|
|
|
|
|
|
|
def _get_saved_address_delegate_item(self, name: str):
|
|
|
|
list = wait_and_get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)
|
2022-08-04 09:06:15 +00:00
|
|
|
found = -1
|
|
|
|
for index in range(list.count):
|
2022-08-24 08:23:43 +00:00
|
|
|
if list.itemAtIndex(index).objectName == f"savedAddressView_Delegate_{name}":
|
2022-08-04 09:06:15 +00:00
|
|
|
found = index
|
2022-08-24 08:23:43 +00:00
|
|
|
|
2022-08-04 09:06:15 +00:00
|
|
|
assert found != -1, "saved address not found"
|
2022-08-24 08:23:43 +00:00
|
|
|
return list.itemAtIndex(found)
|
|
|
|
|
|
|
|
def _find_saved_address_and_open_menu(self, name: str):
|
|
|
|
item = self._get_saved_address_delegate_item(name)
|
|
|
|
obj = get_child_item_with_object_name(item, SavedAddressesScreen.DELEGATE_MENU_BUTTON_OBJECT_NAME.value)
|
|
|
|
click_obj(obj)
|
|
|
|
|
|
|
|
def edit_saved_address(self, name: str, new_name: str):
|
|
|
|
self._find_saved_address_and_open_menu(name)
|
|
|
|
|
2022-08-04 09:06:15 +00:00
|
|
|
click_obj_by_name(SavedAddressesScreen.EDIT.value)
|
|
|
|
type(AddSavedAddressPopup.NAME_INPUT.value, new_name)
|
|
|
|
click_obj_by_name(AddSavedAddressPopup.ADD_BUTTON.value)
|
2022-08-24 08:23:43 +00:00
|
|
|
|
2022-08-04 09:06:15 +00:00
|
|
|
def delete_saved_address(self, name: str):
|
2022-08-24 08:23:43 +00:00
|
|
|
self._find_saved_address_and_open_menu(name)
|
|
|
|
|
2022-08-04 09:06:15 +00:00
|
|
|
click_obj_by_name(SavedAddressesScreen.DELETE.value)
|
|
|
|
click_obj_by_name(SavedAddressesScreen.CONFIRM_DELETE.value)
|
2022-08-24 08:23:43 +00:00
|
|
|
|
|
|
|
def toggle_favourite_for_saved_address(self, name: str):
|
|
|
|
# Find the saved address and click favourite to toggle
|
|
|
|
item = self._get_saved_address_delegate_item(name)
|
|
|
|
favouriteButton = get_child_item_with_object_name(item, SavedAddressesScreen.DELEGATE_FAVOURITE_BUTTON_OBJECT_NAME.value)
|
|
|
|
click_obj(favouriteButton)
|
|
|
|
|
|
|
|
def check_favourite_status_for_saved_address(self, name: str, favourite: bool):
|
|
|
|
# Find the saved address
|
|
|
|
item = self._get_saved_address_delegate_item(name)
|
|
|
|
favouriteButton = get_child_item_with_object_name(item, SavedAddressesScreen.DELEGATE_FAVOURITE_BUTTON_OBJECT_NAME.value)
|
|
|
|
|
|
|
|
# if favourite is true, check that the favourite shows "unfavourite" icon and vice versa
|
|
|
|
wait_for_prop_value(favouriteButton, "icon.name", ("unfavourite" if favourite else "favourite"))
|
|
|
|
wait_for_prop_value(item, "titleTextIcon", ("star-icon" if favourite else ""))
|
|
|
|
|
2022-08-08 10:07:29 +00:00
|
|
|
def toggle_network(self, network_name: str):
|
2022-08-18 17:51:18 +00:00
|
|
|
time.sleep(2)
|
2022-08-08 10:07:29 +00:00
|
|
|
click_obj_by_name(MainWalletScreen.NETWORK_SELECTOR_BUTTON.value)
|
2022-08-18 17:51:18 +00:00
|
|
|
time.sleep(2)
|
2022-08-08 10:07:29 +00:00
|
|
|
|
2022-08-18 17:51:18 +00:00
|
|
|
list = wait_and_get_obj(NetworkSelectorPopup.LAYER_1_REPEATER.value)
|
2022-08-08 10:07:29 +00:00
|
|
|
for index in range(list.count):
|
2022-08-18 17:51:18 +00:00
|
|
|
item = list.itemAt(index)
|
|
|
|
if item.objectName == network_name:
|
|
|
|
click_obj(item)
|
2022-08-08 10:07:29 +00:00
|
|
|
click_obj_by_name(MainWalletScreen.ACCOUNT_NAME.value)
|
|
|
|
time.sleep(2)
|
|
|
|
return
|
|
|
|
|
|
|
|
assert False, "network name not found"
|
|
|
|
|
|
|
|
|
|
|
|
def verify_positive_balance(self, symbol: str):
|
|
|
|
list = get_obj(AssetView.LIST.value)
|
2022-08-18 17:51:18 +00:00
|
|
|
reset = 0
|
|
|
|
while (reset < 3):
|
|
|
|
found = False
|
|
|
|
for index in range(list.count):
|
|
|
|
tokenListItem = list.itemAtIndex(index)
|
|
|
|
if tokenListItem.objectName == "AssetView_TokenListItem_" + symbol:
|
|
|
|
found = True
|
|
|
|
if (tokenListItem.balance == "0" and reset < 3):
|
|
|
|
break
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
if not found:
|
|
|
|
verify_failure("Symbol " + symbol + " not found in the asset list")
|
|
|
|
reset += 1
|
|
|
|
time.sleep(5)
|
|
|
|
|
|
|
|
verify_failure("Balance was not positive")
|
2022-08-04 09:06:15 +00:00
|
|
|
|
2022-08-03 10:08:46 +00:00
|
|
|
def verify_saved_address_exists(self, name: str):
|
2022-08-24 08:23:43 +00:00
|
|
|
list = wait_and_get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)
|
2022-08-03 10:08:46 +00:00
|
|
|
for index in range(list.count):
|
2022-08-24 08:23:43 +00:00
|
|
|
if list.itemAtIndex(index).objectName == f"savedAddressView_Delegate_{name}":
|
|
|
|
return
|
|
|
|
|
|
|
|
verify_failure(f'FAIL: saved address {name} not found"')
|
|
|
|
|
2022-08-04 09:06:15 +00:00
|
|
|
def verify_saved_address_doesnt_exist(self, name: str):
|
2022-08-24 08:23:43 +00:00
|
|
|
# The list should be hidden when there are no saved addresses
|
|
|
|
try:
|
|
|
|
list = wait_and_get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value, 250)
|
|
|
|
except LookupError:
|
|
|
|
return
|
|
|
|
|
|
|
|
list = wait_and_get_obj(SavedAddressesScreen.SAVED_ADDRESSES_LIST.value)
|
2022-08-04 09:06:15 +00:00
|
|
|
for index in range(list.count):
|
2022-08-24 08:23:43 +00:00
|
|
|
if list.itemAtIndex(index).objectName == f"savedAddressView_Delegate_{name}":
|
|
|
|
verify_failure(f'FAIL: saved address {name} exists')
|
2022-08-03 10:08:46 +00:00
|
|
|
|
2022-07-21 12:15:02 +00:00
|
|
|
def verify_transaction(self):
|
|
|
|
print("TODO: fix notification and ensure there is one")
|
2022-08-10 14:26:29 +00:00
|
|
|
|
|
|
|
def verify_collectibles_exist(self, account_name: str):
|
|
|
|
tabbar = get_obj(MainWalletScreen.RIGHT_SIDE_TABBAR.value)
|
|
|
|
click_obj(tabbar.itemAt(WalletTabBar.COLLECTION_TAB.value))
|
|
|
|
collectionsRepeater = get_obj(CollectiblesView.COLLECTIONS_REPEATER.value)
|
|
|
|
if(collectionsRepeater.count > 0):
|
|
|
|
collectionsRepeater.itemAt(0).expanded = True
|
|
|
|
collectiblesRepeater = get_obj(CollectiblesView.COLLECTIBLES_REPEATER.value)
|
|
|
|
verify(collectiblesRepeater.count > 0, "Collectibles not retrieved for the account")
|
2022-09-20 12:27:52 +00:00
|
|
|
|
|
|
|
def verify_transactions_exist(self):
|
|
|
|
tabbar = get_obj(MainWalletScreen.RIGHT_SIDE_TABBAR.value)
|
|
|
|
click_obj(tabbar.itemAt(WalletTabBar.ACTIVITY_TAB.value))
|
|
|
|
|
|
|
|
transaction_list_view = get_obj(TransactionsView.TRANSACTIONS_LISTVIEW.value)
|
|
|
|
|
|
|
|
squish.waitFor("transaction_list_view.count > 0", 60*1000)
|
|
|
|
verify(transaction_list_view.count > 1, "Transactions not retrieved for the account")
|
|
|
|
|
|
|
|
transaction_item = transaction_list_view.itemAtIndex(1)
|
|
|
|
transaction_detail_header = get_obj(TransactionsView.TRANSACTIONS_DETAIL_VIEW_HEADER.value)
|
|
|
|
|
|
|
|
click_obj(transaction_item)
|
|
|
|
|
|
|
|
verify_equal(transaction_item.item.cryptoValue, transaction_detail_header.cryptoValue)
|
|
|
|
verify_equal(transaction_item.item.transferStatus, transaction_detail_header.transferStatus)
|
|
|
|
verify_equal(transaction_item.item.shortTimeStamp, transaction_detail_header.shortTimeStamp)
|
|
|
|
verify_equal(transaction_item.item.fiatValue, transaction_detail_header.fiatValue)
|
|
|
|
verify_equal(transaction_item.item.symbol, transaction_detail_header.symbol)
|
|
|
|
|