test(@wallet): fix broken test on wallet

This commit is contained in:
Anthony Laibe 2022-08-08 10:13:20 +02:00 committed by Anthony Laibe
parent f60dacc45d
commit 7aa7e01f36
6 changed files with 8 additions and 12 deletions

View File

@ -122,9 +122,8 @@ def is_text_matching(objName: str, text: str):
return False
def is_text_matching_insensitive(objName: str, text: str):
def is_text_matching_insensitive(obj, text: str):
try:
obj = squish.waitForObject(getattr(names, objName))
test.compare(obj.text.toLower(), text.lower(), "Found the following text " + text.lower())
return True
except LookupError:

View File

@ -18,8 +18,8 @@ def verify_object_enabled(objName: str, timeout: int=_MIN_WAIT_OBJ_TIMEOUT, cond
def verify_text_matching(objName: str, text: str):
test.verify(is_text_matching(objName, text), "text does not match")
def verify_text_matching_insensitive(objName: str, text: str):
test.verify(is_text_matching_insensitive(objName, text), "text does not match")
def verify_text_matching_insensitive(obj, text: str):
test.verify(is_text_matching_insensitive(obj, text), "text does not match")
def verify_equal(result: object, expected: object):
test.verify(result == expected, "objects are not equal")

View File

@ -25,7 +25,6 @@ class AdvancedOptionScreen(Enum):
class WalletSettingsScreen(Enum):
ACCOUNT_DELEGATE_WALLET_ADDRESS: str = "walletSettingsAccountDelegate_WalletAddress_Text"
GENERATED_ACCOUNTS: str = "settings_Wallet_MainView_GeneratedAccounts"
DELETE_ACCOUNT: str = "settings_Wallet_AccountView_DeleteAccount"
DELETE_ACCOUNT_CONFIRM: str = "settings_Wallet_AccountView_DeleteAccount_Confirm"
@ -74,7 +73,8 @@ class SettingsScreen:
verify_equal(index, -1)
def verify_address(self, address: str):
verify_text_matching_insensitive(WalletSettingsScreen.ACCOUNT_DELEGATE_WALLET_ADDRESS.value, address)
accounts = get_obj(WalletSettingsScreen.GENERATED_ACCOUNTS.value)
verify_text_matching_insensitive(accounts.itemAtIndex(0).statusListItemSubTitle, address)
def toggle_test_networks(self):
click_obj_by_name(WalletSettingsScreen.NETWORKS_ITEM.value)

View File

@ -17,8 +17,6 @@ settings_Wallet_MainView_Networks = {"container": statusDesktop_mainWindow, "obj
settings_Wallet_NetworksView_TestNet_Toggle = {"container": statusDesktop_mainWindow, "objectName": "testnetModeSwitch", "type": "StatusSwitch"}
generatedAccounts_ListView = {"container": statusDesktop_mainWindow, "objectName": "generatedAccounts", "type": "ListView"}
generatedAccounts_walletSettingsAccountDelegate_WalletAccountDelegate = {"container": generatedAccounts_ListView, "index": 0, "objectName": "walletSettingsAccountDelegate", "type": "WalletAccountDelegate"}
walletSettingsAccountDelegate_WalletAddress_Text = {"container": generatedAccounts_walletSettingsAccountDelegate_WalletAccountDelegate, "objectName": "statusListItemSubTitle", "type": "StatusBaseText"}
# Advanced Settings:
walletSettingsLineButton = {"container": statusDesktop_mainWindow, "objectName": "WalletSettingsLineButton", "type": "StatusSettingsLineButton", "visible": True}

View File

@ -55,7 +55,7 @@ Feature: Status Desktop Wallet
| one |
Scenario Outline: User adds a saved address
When the user adds a saved address name <name> and address <address>
When the user adds a saved address named <name> and address <address>
Then the name <name> is in the list of saved addresses
Examples:
@ -63,7 +63,7 @@ Feature: Status Desktop Wallet
| one | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |
Scenario Outline: User can edit a saved address
When the user adds a saved address name <name> and address <address>
When the user adds a saved address named <name> and address <address>
And the user edits a saved address with name <name> to <new_name>
Then the name <new_name><name> is in the list of saved addresses
@ -72,7 +72,7 @@ Feature: Status Desktop Wallet
| bar | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | foo |
Scenario Outline: User can delete a saved address
When the user adds a saved address name <name> and address <address>
When the user adds a saved address named <name> and address <address>
And the user deletes the saved address with name <name>
Then the name <name> is not in the list of saved addresses

View File

@ -107,7 +107,6 @@ Column {
objectName: "generatedAccounts"
model: walletStore.generatedAccounts
delegate: WalletAccountDelegate {
objectName: "walletSettingsAccountDelegate"
account: model
onGoToAccountView: {
root.goToAccountView(model.address)