From cdb838d5787c7bc7cadc80f6ed3716d2d5ab5e5e Mon Sep 17 00:00:00 2001 From: Anastasiya Semiankevich Date: Mon, 19 Jun 2023 20:54:17 +0300 Subject: [PATCH] chore(@e2e_tests): add logic to use networks selector only if address is hex --- test/ui-test/src/drivers/elements/checkbox.py | 2 +- .../ui-test/src/screens/StatusWalletScreen.py | 4 +- .../screens/components/saved_address_popup.py | 38 ++++++++++--------- .../suite_wallet/shared/steps/walletSteps.py | 10 ++--- .../tst_wallet_savedAddresses/test.feature | 6 ++- 5 files changed, 30 insertions(+), 30 deletions(-) diff --git a/test/ui-test/src/drivers/elements/checkbox.py b/test/ui-test/src/drivers/elements/checkbox.py index b4f96fab31..68d9480cd3 100644 --- a/test/ui-test/src/drivers/elements/checkbox.py +++ b/test/ui-test/src/drivers/elements/checkbox.py @@ -10,4 +10,4 @@ class CheckBox(BaseElement): if self.is_checked is not value: self.click(x, y) assert squish.waitFor( - lambda: self.is_checked is value, configs.squish.UI_LOAD_TIMEOUT_MSEC), 'Value not changed' + lambda: self.is_checked is value, configs.squish.UI_LOAD_TIMEOUT_MSEC), 'Value has not been changed' diff --git a/test/ui-test/src/screens/StatusWalletScreen.py b/test/ui-test/src/screens/StatusWalletScreen.py index e52540ed7b..c4c0222d4c 100644 --- a/test/ui-test/src/screens/StatusWalletScreen.py +++ b/test/ui-test/src/screens/StatusWalletScreen.py @@ -389,8 +389,8 @@ class StatusWalletScreen: def add_saved_address(self, name: str, address: str): self.left_panel.open_saved_addresses().open_add_address_popup().add_saved_address(name, address) - def edit_saved_address(self, name: str, new_name: str): - self.left_panel.open_saved_addresses().open_edit_address_popup(name).edit_saved_address(new_name) + def edit_saved_address(self, name: str, address: str, new_name: str): + self.left_panel.open_saved_addresses().open_edit_address_popup(name).edit_saved_address(new_name, address) def delete_saved_address(self, name: str): self.left_panel.open_saved_addresses().delete_saved_address(name) diff --git a/test/ui-test/src/screens/components/saved_address_popup.py b/test/ui-test/src/screens/components/saved_address_popup.py index d1e3fc69c2..8ac164842e 100644 --- a/test/ui-test/src/screens/components/saved_address_popup.py +++ b/test/ui-test/src/screens/components/saved_address_popup.py @@ -30,7 +30,7 @@ class SavedAddressPopup(BasePopup): return self def verify_network_selector_enabled(self): - assert self._add_networks_selector.is_visible, f'Network selector is not active' + assert self._add_networks_selector.is_visible, f'Network selector is not enabled' def verify_ethereum_mainnet_network_tag_present(self): assert self._ethereum_mainnet_network_tag.is_visible, f'Ethereum Mainnet network tag is not present' @@ -39,7 +39,7 @@ class SavedAddressPopup(BasePopup): assert self._optimism_mainnet_network_tag.is_visible, f'Optimism Mainnet network tag is not present' def verify_arbitrum_mainnet_network_tag_present(self): - assert self._arbitrum_mainnet_network_tag.is_visible, f'Arbitrum Mainnet network tag is not present' + assert self._arbitrum_mainnet_network_tag.is_visible, f'Arbitrum Mainnet network tag is not present' @@ -52,15 +52,16 @@ class AddSavedAddressPopup(SavedAddressPopup): self._name_text_edit.text = name self._address_text_edit.clear(verify=False) self._address_text_edit.type_text(address) - self.verify_network_selector_enabled() - self._add_networks_selector.click(1, 1) - self.set_ethereum_mainnet_network(True) - self.set_optimism_mainnet_network(True) - self.set_arbitrum_mainnet_network(True) - self._save_add_address_button.click() # i click it twice to close the network selector pop up - self.verify_ethereum_mainnet_network_tag_present() - self.verify_otimism_mainnet_network_tag_present() - self.verify_arbitrum_mainnet_network_tag_present() + if address.startswith("0x"): + self.verify_network_selector_enabled() + self._add_networks_selector.click(1, 1) + self.set_ethereum_mainnet_network(True) + self.set_optimism_mainnet_network(True) + self.set_arbitrum_mainnet_network(True) + self._save_add_address_button.click() # i click it twice to close the network selector pop up + self.verify_ethereum_mainnet_network_tag_present() + self.verify_otimism_mainnet_network_tag_present() + self.verify_arbitrum_mainnet_network_tag_present(), self._save_add_address_button.click() self.wait_until_hidden() @@ -71,12 +72,13 @@ class EditSavedAddressPopup(SavedAddressPopup): super(EditSavedAddressPopup, self).__init__() self._address_text_label = TextLabel('mainWallet_Saved_Addreses_Popup_Address_Input_Edit') - def edit_saved_address(self, name: str): - self._name_text_edit.text = name - self._add_networks_button.click() - self.set_optimism_mainnet_network(False) - self.set_arbitrum_mainnet_network(False) - self._save_add_address_button.click() - self.verify_ethereum_mainnet_network_tag_present + def edit_saved_address(self, new_name: str, address: str): + self._name_text_edit.text = new_name + if address.startswith("0x"): + self._add_networks_button.click() + self.set_ethereum_mainnet_network(False) + self.set_optimism_mainnet_network(False) + self.set_arbitrum_mainnet_network(False) + self._save_add_address_button.click() self._save_add_address_button.click() self.wait_until_hidden() 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 6b85a8ea27..9028042b82 100644 --- a/test/ui-test/testSuites/suite_wallet/shared/steps/walletSteps.py +++ b/test/ui-test/testSuites/suite_wallet/shared/steps/walletSteps.py @@ -159,13 +159,9 @@ def step(context, account_name, amount, token, chain_name, password): def step(context, name, address): _walletScreen.add_saved_address(name, address) -@When("the user adds a saved address named \"|any|\" and ENS name \"|any|\"") -def step(context, name, ens_name): - _walletScreen.add_saved_address(name, ens_name) - -@When("the user edits a saved address with name \"|any|\" to \"|any|\"") -def step(context, name, new_name): - _walletScreen.edit_saved_address(name, new_name) +@When("the user edits a saved address with name \"|any|\" and address \"|any|\" to \"|any|\"") +def step(context, name, address, new_name): + _walletScreen.edit_saved_address(name, address, new_name) @When("the user deletes the saved address with name \"|any|\"") diff --git a/test/ui-test/testSuites/suite_wallet/tst_wallet_savedAddresses/test.feature b/test/ui-test/testSuites/suite_wallet/tst_wallet_savedAddresses/test.feature index 1d6bf7fe8a..d587178c68 100644 --- a/test/ui-test/testSuites/suite_wallet/tst_wallet_savedAddresses/test.feature +++ b/test/ui-test/testSuites/suite_wallet/tst_wallet_savedAddresses/test.feature @@ -15,16 +15,18 @@ Background: Then the saved address with name "" is not in the list of saved addresses Examples: | name | address | - | Saved address | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | + | Saved address | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | + | ENS name as address | nastya.stateofus.eth | Scenario Outline: The user can add saved address with all network options, change address name and disable networks When the user adds a saved address with name "" and address "
" - And the user edits a saved address with name "" to "" + And the user edits a saved address with name "" and address "
" to "" Then the saved address with name "" is in the list of saved addresses # And the user can open saved address in "" TODO: later Examples: | name | address |new_name | | Saved address name before | 0x8397bc3c5a60a1883174f722403d63a8833312b7 |Saved address name after | + | Ens name before | nastya.stateofus.eth |Ens name after | # | foo | nastya.stateofus.eth | bar | https://github.com/status-im/status-desktop/issues/11090 # TODO: actions from burger menu