2023-05-17 14:39:58 +00:00
|
|
|
from common.Common import str_to_bool
|
2022-09-30 10:49:14 +00:00
|
|
|
from screens.StatusMainScreen import StatusMainScreen
|
2022-07-18 08:37:37 +00:00
|
|
|
from screens.StatusWalletScreen import StatusWalletScreen
|
2023-05-17 14:39:58 +00:00
|
|
|
from screens.StatusWalletScreen import VALUE_YES
|
|
|
|
from screens.components.authenticate_popup import AuthenticatePopup
|
2022-08-24 08:23:43 +00:00
|
|
|
from scripts.decorators import verify_screenshot
|
2023-05-17 14:39:58 +00:00
|
|
|
|
2022-07-21 12:15:02 +00:00
|
|
|
_statusMain = StatusMainScreen()
|
2022-07-18 08:37:37 +00:00
|
|
|
_walletScreen = StatusWalletScreen()
|
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
|
2022-10-21 07:17:48 +00:00
|
|
|
#########################
|
|
|
|
### PRECONDITIONS region:
|
|
|
|
#########################
|
|
|
|
|
|
|
|
@Given("the user accepts the signing phrase")
|
|
|
|
def step(context):
|
|
|
|
the_user_accepts_the_signing_phrase()
|
2022-07-18 08:37:37 +00:00
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
|
2022-10-21 07:17:48 +00:00
|
|
|
#########################
|
|
|
|
### ACTIONS region:
|
|
|
|
#########################
|
2023-04-13 10:32:25 +00:00
|
|
|
|
|
|
|
@When("the user opens wallet section")
|
|
|
|
def step(context):
|
2023-06-06 14:15:28 +00:00
|
|
|
walletInitSteps.the_user_opens_wallet_screen()
|
2023-05-14 10:21:19 +00:00
|
|
|
|
2023-04-13 10:32:25 +00:00
|
|
|
@When("the user clicks on the default wallet account")
|
|
|
|
def step(context):
|
|
|
|
_walletScreen.click_default_wallet_account()
|
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
|
|
|
|
@When("the user selects wallet account with \"|any|\"")
|
|
|
|
def step(context, name):
|
|
|
|
_walletScreen.left_panel.select_account(name)
|
|
|
|
|
|
|
|
|
2023-07-25 10:12:20 +00:00
|
|
|
@When("the user adds a watch only account \"|any|\" with \"|any|\" color \"|any|\" and emoji \"|any|\"")
|
2023-04-13 10:32:25 +00:00
|
|
|
@verify_screenshot
|
2023-07-25 10:12:20 +00:00
|
|
|
def step(context, address, name, color, emoji):
|
|
|
|
account_popup = _walletScreen.left_panel.open_add_account_popup()
|
2023-05-17 14:39:58 +00:00
|
|
|
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_eth_address(address).save()
|
|
|
|
account_popup.wait_until_hidden()
|
|
|
|
|
|
|
|
|
2023-07-25 10:12:20 +00:00
|
|
|
@When("the user adds a generated account with \"|any|\" color \"|any|\" and emoji \"|any|\"")
|
2023-04-13 10:32:25 +00:00
|
|
|
@verify_screenshot
|
2023-07-25 10:12:20 +00:00
|
|
|
def step(context, name, color, emoji):
|
|
|
|
account_popup = _walletScreen.left_panel.open_add_account_popup()
|
2023-05-17 14:39:58 +00:00
|
|
|
account_popup.set_name(name).set_emoji(emoji).set_color(color).save()
|
|
|
|
AuthenticatePopup().wait_until_appears().authenticate()
|
|
|
|
account_popup.wait_until_hidden()
|
|
|
|
|
2023-04-13 10:32:25 +00:00
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
@When("the user adds a private key account \"|any|\" with \"|any|\" color \"|any|\" and emoji \"|any|\"")
|
2023-04-13 10:32:25 +00:00
|
|
|
@verify_screenshot
|
2023-05-17 14:39:58 +00:00
|
|
|
def step(context, private_key, name, color, emoji):
|
|
|
|
account_popup = _walletScreen.left_panel.open_add_account_popup()
|
|
|
|
account_popup.set_name(name).set_emoji(emoji).set_color(color).set_origin_private_key(private_key).save()
|
|
|
|
AuthenticatePopup().wait_until_appears().authenticate()
|
|
|
|
account_popup.wait_until_hidden()
|
|
|
|
|
|
|
|
|
|
|
|
@When("the user adds an imported seed phrase account \"|any|\" with \"|any|\" color \"|any|\" and emoji \"|any|\"")
|
2023-04-13 10:32:25 +00:00
|
|
|
@verify_screenshot
|
2023-05-17 14:39:58 +00:00
|
|
|
def step(context, seed_phrase, name, color, emoji):
|
|
|
|
account_popup = _walletScreen.left_panel.open_add_account_popup()
|
2023-06-02 14:34:09 +00:00
|
|
|
account_popup.set_name(name)
|
|
|
|
account_popup.set_emoji(emoji)
|
|
|
|
account_popup.set_color(color)
|
|
|
|
account_popup.set_origin_seed_phrase(seed_phrase.split())
|
|
|
|
account_popup.save()
|
2023-05-17 14:39:58 +00:00
|
|
|
AuthenticatePopup().wait_until_appears().authenticate()
|
|
|
|
account_popup.wait_until_hidden()
|
|
|
|
|
|
|
|
|
|
|
|
@When("the user adds a custom generated account with \"|any|\" color \"|any|\" emoji \"|any|\" and derivation \"|any|\" \"|any|\"")
|
2023-04-13 10:32:25 +00:00
|
|
|
@verify_screenshot
|
2023-05-17 14:39:58 +00:00
|
|
|
def step(context, name, color, emoji, derivation_path, generated_address_index):
|
|
|
|
account_popup = _walletScreen.left_panel.open_add_account_popup()
|
2023-06-02 14:34:09 +00:00
|
|
|
account_popup.set_name(name)
|
|
|
|
account_popup.set_emoji(emoji)
|
|
|
|
account_popup.set_color(color)
|
|
|
|
account_popup.set_derivation_path(derivation_path, generated_address_index)
|
|
|
|
account_popup.save()
|
2023-05-17 14:39:58 +00:00
|
|
|
|
|
|
|
@When("the user adds to \"|any|\" a custom generated account with \"|any|\" color \"|any|\" emoji \"|any|\" and derivation \"|any|\" \"|any|\"")
|
2023-04-13 10:32:25 +00:00
|
|
|
@verify_screenshot
|
2023-05-17 14:39:58 +00:00
|
|
|
def step(context, keypair_name, name, color, emoji, derivation_path, generated_address_index):
|
|
|
|
account_popup = _walletScreen.left_panel.open_add_account_popup()
|
2023-06-02 14:34:09 +00:00
|
|
|
account_popup.set_name(name)
|
|
|
|
account_popup.set_emoji(emoji)
|
|
|
|
account_popup.set_color(color)
|
|
|
|
account_popup.set_derivation_path(derivation_path, generated_address_index)
|
|
|
|
account_popup.set_origin_keypair(keypair_name)
|
|
|
|
account_popup.save()
|
2023-05-17 14:39:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
@When(
|
|
|
|
"the user adds a generated seed phrase account with \"|any|\" color \"|any|\" emoji \"|any|\" and keypair \"|any|\"")
|
|
|
|
def step(context, name, color, emoji, keypair_name):
|
|
|
|
account_popup = _walletScreen.left_panel.open_add_account_popup()
|
2023-06-02 14:34:09 +00:00
|
|
|
account_popup.set_name(name)
|
|
|
|
account_popup.set_emoji(emoji)
|
|
|
|
account_popup.set_color(color)
|
|
|
|
account_popup.set_origin_new_seed_phrase(keypair_name)
|
|
|
|
account_popup.save()
|
2023-05-17 14:39:58 +00:00
|
|
|
AuthenticatePopup().wait_until_appears().authenticate()
|
|
|
|
account_popup.wait_until_hidden()
|
|
|
|
|
2023-04-13 10:32:25 +00:00
|
|
|
|
|
|
|
@When("the user adds new master key and go to use a Keycard")
|
|
|
|
def step(context):
|
2023-08-15 08:14:14 +00:00
|
|
|
account_popup = _walletScreen.left_panel.open_add_account_popup()
|
|
|
|
account_popup.set_origin_keypair('LABEL-OPTION-ADD-NEW-MASTER-KEY')
|
|
|
|
_walletScreen.go_to_keycard_settings()
|
2023-04-13 10:32:25 +00:00
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
|
2023-04-13 10:32:25 +00:00
|
|
|
@When("the user edits an account with \"|any|\" to \"|any|\" with color \"|any|\" and emoji \"|any|\"")
|
|
|
|
def step(context, name, new_name, new_color, new_emoji):
|
2023-05-17 14:39:58 +00:00
|
|
|
account_popup = _walletScreen.left_panel.open_edit_account_popup(name)
|
2023-06-02 14:34:09 +00:00
|
|
|
account_popup.set_name(new_name)
|
|
|
|
account_popup.set_emoji(new_emoji)
|
|
|
|
account_popup.set_color(new_color)
|
|
|
|
account_popup.save()
|
2023-05-17 14:39:58 +00:00
|
|
|
|
|
|
|
|
|
|
|
@When("the user removes account \"|any|\"")
|
|
|
|
def step(context, name):
|
|
|
|
_walletScreen.left_panel.delete_account(name).confirm()
|
|
|
|
|
2023-06-08 13:27:02 +00:00
|
|
|
@When("the user opens All accounts view")
|
|
|
|
def step(context):
|
|
|
|
_walletScreen.left_panel.open_all_accounts_view()
|
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
|
|
|
|
@When("the user start removing account \"|any|\" and cancel it")
|
|
|
|
def step(context, name):
|
|
|
|
_walletScreen.left_panel.delete_account(name).cancel()
|
|
|
|
|
|
|
|
|
|
|
|
@When("the user removes account \"|any|\" with agreement")
|
|
|
|
def step(context, name):
|
|
|
|
_walletScreen.left_panel.delete_account(name).agree_and_confirm()
|
|
|
|
|
|
|
|
|
|
|
|
@When(
|
|
|
|
"the user sends a transaction to himself from account \"|any|\" of \"|any|\" \"|any|\" on \"|any|\" with password \"|any|\"")
|
2022-07-21 12:15:02 +00:00
|
|
|
def step(context, account_name, amount, token, chain_name, password):
|
|
|
|
_walletScreen.send_transaction(account_name, amount, token, chain_name, password)
|
2023-05-14 10:21:19 +00:00
|
|
|
|
2023-06-15 12:53:40 +00:00
|
|
|
@When("the user adds a saved address with name \"|any|\" and address \"|any|\"")
|
2022-08-03 10:08:46 +00:00
|
|
|
def step(context, name, address):
|
|
|
|
_walletScreen.add_saved_address(name, address)
|
|
|
|
|
2023-06-19 17:54:17 +00:00
|
|
|
@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)
|
2022-08-04 09:06:15 +00:00
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
|
2022-10-21 07:17:48 +00:00
|
|
|
@When("the user deletes the saved address with name \"|any|\"")
|
2022-08-04 09:06:15 +00:00
|
|
|
def step(context, name):
|
|
|
|
_walletScreen.delete_saved_address(name)
|
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
|
2022-10-21 07:17:48 +00:00
|
|
|
@When("the user toggles favourite for the saved address with name \"|any|\"")
|
2022-08-24 08:23:43 +00:00
|
|
|
def step(context, name):
|
|
|
|
_walletScreen.toggle_favourite_for_saved_address(name)
|
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
|
2022-08-31 10:55:42 +00:00
|
|
|
@When("the user toggles the network |any|")
|
2022-08-08 10:07:29 +00:00
|
|
|
def step(context, network_name):
|
|
|
|
_walletScreen.toggle_network(network_name)
|
2022-08-09 13:52:17 +00:00
|
|
|
|
2023-06-08 13:27:02 +00:00
|
|
|
@When("the user clicks Hide / Show watch-only button")
|
|
|
|
def step(context):
|
|
|
|
_walletScreen.click_hide_show_watch_only()
|
|
|
|
|
2022-10-21 07:17:48 +00:00
|
|
|
|
|
|
|
#########################
|
|
|
|
### VERIFICATIONS region:
|
|
|
|
#########################
|
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
@Then("the account is correctly displayed with \"|any|\" and \"|any|\" and emoji unicode \"|any|\" in accounts list")
|
2023-04-13 10:32:25 +00:00
|
|
|
def step(context, name, color, emoji_unicode):
|
|
|
|
_walletScreen.verify_account_existence(name, color, emoji_unicode)
|
2023-05-14 10:21:19 +00:00
|
|
|
|
2023-06-02 14:34:09 +00:00
|
|
|
|
2023-04-13 10:32:25 +00:00
|
|
|
@Then("settings keycard section is opened")
|
|
|
|
def step(context):
|
|
|
|
_walletScreen.verify_keycard_settings_is_opened()
|
2023-05-14 10:21:19 +00:00
|
|
|
|
2023-06-02 14:34:09 +00:00
|
|
|
|
2023-04-13 10:32:25 +00:00
|
|
|
@Then("the account with \"|any|\" is not displayed")
|
|
|
|
def step(context, name):
|
|
|
|
_walletScreen.verify_account_doesnt_exist(name)
|
|
|
|
|
2023-05-17 14:39:58 +00:00
|
|
|
|
2023-06-02 14:34:09 +00:00
|
|
|
@Then("the account with \"|any|\" is displayed")
|
|
|
|
def step(context, name):
|
|
|
|
_walletScreen.verify_account_exist(name)
|
|
|
|
|
|
|
|
|
2022-10-21 07:17:48 +00:00
|
|
|
@Then("the user has a positive balance of \"|any|\"")
|
2022-08-08 10:07:29 +00:00
|
|
|
def step(context, symbol):
|
|
|
|
_walletScreen.verify_positive_balance(symbol)
|
|
|
|
|
2022-07-21 12:15:02 +00:00
|
|
|
|
|
|
|
@Then("the transaction is in progress")
|
|
|
|
def step(context):
|
2022-08-03 10:08:46 +00:00
|
|
|
_walletScreen.verify_transaction()
|
2023-05-14 10:21:19 +00:00
|
|
|
|
2023-06-15 12:53:40 +00:00
|
|
|
@Then("the saved address with name \"|any|\" is in the list of saved addresses")
|
2022-08-03 10:08:46 +00:00
|
|
|
def step(context, name: str):
|
2023-05-14 10:21:19 +00:00
|
|
|
_walletScreen.verify_saved_address_exists(name)
|
|
|
|
|
2023-06-15 12:53:40 +00:00
|
|
|
@Then("the saved address with name \"|any|\" is not in the list of saved addresses")
|
2022-08-04 09:06:15 +00:00
|
|
|
def step(context, name: str):
|
2023-05-14 10:21:19 +00:00
|
|
|
_walletScreen.verify_saved_address_doesnt_exist(name)
|
|
|
|
|
2022-08-10 14:26:29 +00:00
|
|
|
@Then("the collectibles are listed for the |any|")
|
|
|
|
def step(context, account_name: str):
|
2023-05-14 10:21:19 +00:00
|
|
|
_walletScreen.verify_collectibles_exist(account_name)
|
|
|
|
|
2022-09-20 12:27:52 +00:00
|
|
|
@Then("the transactions are listed for the added account")
|
|
|
|
def step(context):
|
2022-10-21 07:17:48 +00:00
|
|
|
_walletScreen.verify_transactions_exist()
|
2023-05-14 10:21:19 +00:00
|
|
|
|
2022-10-21 07:17:48 +00:00
|
|
|
@Then("the saved address \"|any|\" has favourite status \"|any|\"")
|
|
|
|
def step(context, name, favourite):
|
|
|
|
_walletScreen.check_favourite_status_for_saved_address(name, str_to_bool(favourite))
|
2023-05-14 10:21:19 +00:00
|
|
|
|
2022-10-21 07:17:48 +00:00
|
|
|
###########################################################################
|
|
|
|
### COMMON methods used in different steps given/when/then region:
|
2023-05-14 10:21:19 +00:00
|
|
|
###########################################################################
|