From d9f15ace2b673bfc5d4e99c38446e383924ade8a Mon Sep 17 00:00:00 2001 From: Anastasiya Semiankevich Date: Thu, 8 Jun 2023 16:27:02 +0300 Subject: [PATCH] test(@tst_wallet_account_management): add test to verify hide watch-only button --- test/ui-test/src/screens/StatusWalletScreen.py | 11 +++++++++++ .../global_shared/scripts/wallet_names.py | 2 ++ .../suite_wallet/shared/steps/walletSteps.py | 8 ++++++++ .../tst_wallet_accountsManagement/test.feature | 14 ++++++++++++++ ui/app/AppLayouts/Wallet/panels/WalletHeader.qml | 1 + ui/app/AppLayouts/Wallet/views/LeftTabView.qml | 1 + 6 files changed, 37 insertions(+) diff --git a/test/ui-test/src/screens/StatusWalletScreen.py b/test/ui-test/src/screens/StatusWalletScreen.py index 5f2f5c50f2..e52540ed7b 100644 --- a/test/ui-test/src/screens/StatusWalletScreen.py +++ b/test/ui-test/src/screens/StatusWalletScreen.py @@ -68,6 +68,7 @@ class LeftPanel(BaseElement): self._saved_addresses_button = BaseElement('mainWallet_Saved_Addresses_Button') self._wallet_account_item = BaseElement('walletAccount_StatusListItem') self._add_account_button = Button('mainWallet_Add_Account_Button') + self._all_accounts_button = Button('mainWallet_All_Accounts_Button') @property def accounts(self) -> typing.List[constants.wallet.account_list_item]: @@ -162,6 +163,9 @@ class LeftPanel(BaseElement): return self.delete_account(account_name, attempt - 1) else: raise + + def open_all_accounts_view(self): + self._all_accounts_button.click() class SavedAddressListItem(BaseElement): @@ -270,6 +274,7 @@ class MainWalletScreen(Enum): ACCOUNT_ADDRESS_PANEL: str = "mainWallet_Address_Panel" SEND_BUTTON_FOOTER: str = "mainWallet_Footer_Send_Button" NETWORK_SELECTOR_BUTTON: str = "mainWallet_Network_Selector_Button" + HIDE_SHOW_WATCH_ONLY_BUTTON: str = "mainWallet_Hide_Show_Watch_Only_Button" RIGHT_SIDE_TABBAR: str = "mainWallet_Right_Side_Tab_Bar" WALLET_ACCOUNTS_LIST: str = "walletAccounts_StatusListView" WALLET_ACCOUNT_ITEM_PLACEHOLDER = "walletAccounts_WalletAccountItem_Placeholder" @@ -417,6 +422,12 @@ class StatusWalletScreen: return assert False, "network name not found" + + def click_hide_show_watch_only(self): + button_value_before_click = get_obj(MainWalletScreen.HIDE_SHOW_WATCH_ONLY_BUTTON.value).text + Button(MainWalletScreen.HIDE_SHOW_WATCH_ONLY_BUTTON.value).click() + button_value_after_click = get_obj(MainWalletScreen.HIDE_SHOW_WATCH_ONLY_BUTTON.value).text + assert button_value_before_click != button_value_after_click, f"Hide/Show watch only button label is not changed, button label is {button_value_after_click}, was {button_value_before_click}" ##################################### diff --git a/test/ui-test/testSuites/global_shared/scripts/wallet_names.py b/test/ui-test/testSuites/global_shared/scripts/wallet_names.py index b5851bfddc..ca8cf193dc 100644 --- a/test/ui-test/testSuites/global_shared/scripts/wallet_names.py +++ b/test/ui-test/testSuites/global_shared/scripts/wallet_names.py @@ -10,6 +10,8 @@ mainWallet_Saved_Addresses_Button = {"container": mainWindow_RighPanel, "objectN walletAccounts_StatusListView = {"container": statusDesktop_mainWindow, "objectName": "walletAccountsListView", "type": "StatusListView", "visible": True} walletAccounts_WalletAccountItem_Placeholder = {"container": walletAccounts_StatusListView, "objectName": "walletAccount-%NAME%", "type": "StatusListItem", "visible": True} walletAccount_StatusListItem = {"container": walletAccounts_StatusListView, "objectName": RegularExpression("walletAccount*"), "type": "StatusListItem", "visible": True} +mainWallet_Hide_Show_Watch_Only_Button = {"container": statusDesktop_mainWindow, "objectName": "hideShowWatchOnlyButton", "type": "StatusButton", "visible": True} +mainWallet_All_Accounts_Button = {"container": walletAccounts_StatusListView, "objectName": "allAccountsBtn", "type": "Button", "visible": True} # Context Menu mainWallet_CopyAddress_MenuItem = {"container": contextMenu_PopupItem, "enabled": True, "objectName": RegularExpression("AccountMenu-CopyAddressAction*"), "type": "StatusMenuItem"} diff --git a/test/ui-test/testSuites/suite_wallet/shared/steps/walletSteps.py b/test/ui-test/testSuites/suite_wallet/shared/steps/walletSteps.py index 743f9f0e4d..8aa5074ef5 100644 --- a/test/ui-test/testSuites/suite_wallet/shared/steps/walletSteps.py +++ b/test/ui-test/testSuites/suite_wallet/shared/steps/walletSteps.py @@ -135,6 +135,10 @@ def step(context, name, new_name, new_color, new_emoji): def step(context, name): _walletScreen.left_panel.delete_account(name).confirm() +@When("the user opens All accounts view") +def step(context): + _walletScreen.left_panel.open_all_accounts_view() + @When("the user start removing account \"|any|\" and cancel it") def step(context, name): @@ -178,6 +182,10 @@ def step(context, name): def step(context, network_name): _walletScreen.toggle_network(network_name) +@When("the user clicks Hide / Show watch-only button") +def step(context): + _walletScreen.click_hide_show_watch_only() + ######################### ### VERIFICATIONS region: diff --git a/test/ui-test/testSuites/suite_wallet/tst_wallet_accountsManagement/test.feature b/test/ui-test/testSuites/suite_wallet/tst_wallet_accountsManagement/test.feature index d9451b2fe7..8c3ffd9398 100644 --- a/test/ui-test/testSuites/suite_wallet/tst_wallet_accountsManagement/test.feature +++ b/test/ui-test/testSuites/suite_wallet/tst_wallet_accountsManagement/test.feature @@ -29,6 +29,20 @@ Feature: Status Desktop Wallet Section Wallet Account Management | 0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A | AccWatch1 | 2a4af5 | sunglasses | 1f60e | yes | AccWatch1edited | 216266 | thumbsup | 1f44d | | 0xea123F7beFF45E3C9fdF54B324c29DBdA14a639B | AccWatch2 | 7140fd | sunglasses | 1f60e | no | AccWatch2edited | 2a799b | thumbsup | 1f44d | + Scenario Outline: The user can hide and show watch only account by clicking Hide / Show button + When the user adds a watch only account "
" with "" color "#" and emoji "" via "" + Then the account is correctly displayed with "" and "#" and emoji unicode "" in accounts list + When the user opens All accounts view + And the user clicks Hide / Show watch-only button + Then the account with "" is not displayed + When the user opens All accounts view + And the user clicks Hide / Show watch-only button + Then the account is correctly displayed with "" and "#" and emoji unicode "" in accounts list + + Examples: + | address | name | color | emoji | emoji_unicode | add_via_context_menu | + | 0xea123F7beFF45E3C9fdF54B324c29DBdA14a639A | AccWatch1 | 2a4af5 | sunglasses | 1f60e | yes | + Scenario Outline: The user cancel deliting watch only account When the user adds a watch only account "
" with "" color "#" and emoji "" via "" Then the account is correctly displayed with "" and "#" and emoji unicode "" in accounts list diff --git a/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml b/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml index 4b5cdf92f9..5b784b079e 100644 --- a/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml +++ b/ui/app/AppLayouts/Wallet/panels/WalletHeader.qml @@ -85,6 +85,7 @@ Item { StatusButton { + objectName: "hideShowWatchOnlyButton" Layout.preferredHeight: 38 Layout.alignment: Qt.AlignTop diff --git a/ui/app/AppLayouts/Wallet/views/LeftTabView.qml b/ui/app/AppLayouts/Wallet/views/LeftTabView.qml index 15fedadf2c..c5bcbb4fbe 100644 --- a/ui/app/AppLayouts/Wallet/views/LeftTabView.qml +++ b/ui/app/AppLayouts/Wallet/views/LeftTabView.qml @@ -285,6 +285,7 @@ Rectangle { verticalPadding: Style.current.padding horizontalPadding: Style.current.padding highlighted: true + objectName: "allAccountsBtn" leftInset: Style.current.padding bottomInset: Style.current.padding