diff --git a/test/ui-test/src/screens/SettingsScreen.py b/test/ui-test/src/screens/SettingsScreen.py index c4df1d59c2..46f506ddf8 100644 --- a/test/ui-test/src/screens/SettingsScreen.py +++ b/test/ui-test/src/screens/SettingsScreen.py @@ -124,10 +124,6 @@ class SettingsScreen: click_obj_by_name(AdvancedOptionScreen.I_UNDERSTAND_POP_UP.value) verify_object_enabled(SidebarComponents.WALLET_OPTION.value) - def activate_open_wallet_settings(self): - self.activate_wallet_option() - self.open_wallet_settings() - def activate_open_wallet_section(self): self.activate_wallet_option() click_obj_by_name(MainScreenComponents.WALLET_BUTTON.value) @@ -175,7 +171,7 @@ class SettingsScreen: def toggle_test_networks(self): click_obj_by_name(WalletSettingsScreen.NETWORKS_ITEM.value) - click_obj_by_name(WalletSettingsScreen.TESTNET_TOGGLE.value) + click_obj_by_name(WalletSettingsScreen.TESTNET_TOGGLE.value) def open_language_and_currency_settings(self): click_obj_by_name(SidebarComponents.LANGUAGE_CURRENCY_OPTION.value) diff --git a/test/ui-test/src/screens/StatusMainScreen.py b/test/ui-test/src/screens/StatusMainScreen.py index 981ebb0af4..db6d13eb8f 100644 --- a/test/ui-test/src/screens/StatusMainScreen.py +++ b/test/ui-test/src/screens/StatusMainScreen.py @@ -13,10 +13,12 @@ import time from enum import Enum from drivers.SquishDriver import * from drivers.SquishDriverVerification import * +from drivers.SDKeyboardCommands import * from utils.ObjectAccess import * import time class MainScreenComponents(Enum): + MAIN_WINDOW = "statusDesktop_mainWindow" PUBLIC_CHAT_ICON = "mainWindow_public_chat_icon_StatusIcon" CHAT_NAVBAR_ICON = "navBarListView_Chat_navbar_StatusNavBarTabButton" COMMUNITY_PORTAL_BUTTON = "navBarListView_Communities_Portal_navbar_StatusNavBarTabButton" @@ -37,6 +39,7 @@ class MainScreenComponents(Enum): USERSTATUSMENU_AUTOMATIC_ACTION = "userContextmenu_AutomaticButton" USERSTATUSMENU_OPEN_PROFILE_POPUP = "userContextMenu_ViewMyProfileAction" SPLASH_SCREEN = "splashScreen" + TOOLBAR_BACK_BUTTON = "main_toolBar_back_button" class ProfilePopup(Enum): USER_IMAGE = "ProfileHeader_userImage" @@ -72,7 +75,7 @@ class StatusMainScreen: sleep_test(0.5) verify_equal(loaded, False, "Checking splash screen animation has ended.") - # It closes all existing banner and waits them to disappear + # It closes all existing banner and waits them to disappear: def close_banners(self): self.wait_for_banner_to_disappear(MainScreenComponents.CONNECTION_INFO_BANNER.value) self.wait_for_banner_to_disappear(MainScreenComponents.UPDATE_APP_BANNER.value) @@ -195,3 +198,9 @@ class StatusMainScreen: name_changed = setText(DisplayNamePopup.DISPLAY_NAME_INPUT.value, display_name) verify(name_changed, "set display name") click_obj_by_name(DisplayNamePopup.DISPLAY_NAME_OK_BUTTON.value) + + def click_escape(self): + press_escape(MainScreenComponents.MAIN_WINDOW.value) + + def click_tool_bar_back_button(self): + click_obj_by_name(MainScreenComponents.TOOLBAR_BACK_BUTTON.value) diff --git a/test/ui-test/src/screens/StatusWalletScreen.py b/test/ui-test/src/screens/StatusWalletScreen.py index 89ddb32322..882c98a857 100644 --- a/test/ui-test/src/screens/StatusWalletScreen.py +++ b/test/ui-test/src/screens/StatusWalletScreen.py @@ -23,6 +23,7 @@ class MainWalletScreen(Enum): RIGHT_SIDE_TABBAR: str = "mainWallet_Right_Side_Tab_Bar" MAILSERVER_DIALOG: str = "mailserver_dialog" MAILSERVER_RETRY: str = "mailserver_retry" + FIRST_ACCOUNT_ITEM: str = "firstWalletAccount_Item" class AssetView(Enum): LIST: str = "mainWallet_Assets_View_List" @@ -92,6 +93,10 @@ class TransactionsView(Enum): class StatusWalletScreen: + ##################################### + ### Screen actions region: + ##################################### + def accept_signing_phrase(self): click_obj_by_name(SigningPhrasePopUp.OK_GOT_IT_BUTTON.value) @@ -173,11 +178,12 @@ class StatusWalletScreen: wait_for_object_and_type(SharedPopup.PASSWORD_INPUT.value, password) click_obj_by_name(SharedPopup.PRIMARY_BUTTON.value) - time.sleep(5) def verify_account_name_is_present(self, account_name: str): verify_text_matching(MainWalletScreen.ACCOUNT_NAME.value, account_name) + type(AddAccountPopup.ACCOUNT_NAME_INPUT.value, account_name) + click_obj_by_name(AddAccountPopup.ADD_ACCOUNT_BUTTON.value) def send_transaction(self, account_name, amount, token, chain_name, password): # TODO wait for balance to update @@ -291,9 +297,20 @@ class StatusWalletScreen: return assert False, "network name not found" + + def click_first_account(self): + click_obj_by_name(MainWalletScreen.FIRST_ACCOUNT_ITEM.value) + + ##################################### + ### Verifications region: + ##################################### + + def verify_account_name_is_present(self, account_name: str): + verify_text_matching(MainWalletScreen.ACCOUNT_NAME.value, account_name) def verify_positive_balance(self, symbol: str): + time.sleep(5) # TODO: remove when it is faster @alaibe! list = get_obj(AssetView.LIST.value) reset = 0 while (reset < 3): diff --git a/test/ui-test/testSuites/global_shared/scripts/global_names.py b/test/ui-test/testSuites/global_shared/scripts/global_names.py index 781b68d304..7407baf336 100644 --- a/test/ui-test/testSuites/global_shared/scripts/global_names.py +++ b/test/ui-test/testSuites/global_shared/scripts/global_names.py @@ -15,7 +15,8 @@ mainWindow_ProfileNavBarButton = {"container": statusDesktop_mainWindow, "object settings_navbar_settings_icon_StatusIcon = {"container": mainWindow_navBarListView_ListView, "objectName": "settings-icon", "type": "StatusIcon", "visible": True} splashScreen = {"container": statusDesktop_mainWindow, "objectName": "splashScreen", "type": "SplashScreen"} navBarListView_Chat_navbar_StatusNavBarTabButton = {"checkable": True, "container": mainWindow_navBarListView_ListView, "objectName": "Chat-navbar", "type": "StatusNavBarTabButton", "visible": True} - +mainWindow_StatusToolBar = {"container": statusDesktop_mainWindow, "objectName": "statusToolBar", "type": "StatusToolBar", "visible": True} +main_toolBar_back_button = {"container": mainWindow_StatusToolBar, "objectName": "toolBarBackButton", "type": "StatusFlatButton", "visible": True} # main right panel mainWindow_RighPanel= {"container": statusDesktop_mainWindow, "type": "ColumnLayout", "objectName": "mainRightView", "visible": True} diff --git a/test/ui-test/testSuites/global_shared/steps/settingsSteps.py b/test/ui-test/testSuites/global_shared/steps/settingsSteps.py index d4a8fc0c1c..bada57ba11 100644 --- a/test/ui-test/testSuites/global_shared/steps/settingsSteps.py +++ b/test/ui-test/testSuites/global_shared/steps/settingsSteps.py @@ -1,3 +1,5 @@ +import steps.startupSteps as common_init_steps +import steps.walletInitSteps as wallet_init_steps from screens.StatusMainScreen import StatusMainScreen from screens.SettingsScreen import SettingsScreen @@ -23,6 +25,22 @@ def step(context: any): def step(context: any): _settingsScreen.check_tenor_gif_preview_is_enabled() +@Given("the user activates wallet and opens the wallet section") +def step(context: any): + wallet_init_steps.the_user_activates_wallet_and_opens_the_wallet_section() + +@Given("the user toggles test networks") +def step(context: any): + wallet_init_steps.the_user_toggles_test_networks() + +@Given("the user activates wallet") +def step(context: any): + the_user_activates_wallet() + +@Given("the user opens the wallet settings") +def step(context: any): + the_user_opens_the_wallet_settings() + ######################### ### ACTIONS region: ######################### @@ -30,10 +48,6 @@ def step(context: any): @When("the user opens app settings screen") def step(context: any): the_user_opens_app_settings_screen() - -@When("the user opens the wallet settings") -def step(context: any): - _settingsScreen.open_wallet_settings() @When("the user opens the messaging settings") def step(context: any): @@ -46,33 +60,29 @@ def step(context: any): @When("the user activates image unfurling") def step(context: any): _settingsScreen.activate_image_unfurling() - -@When("the user activates wallet and opens the wallet settings") -def step(context: any): - _settingsScreen.activate_open_wallet_settings() -@When("the user activates wallet and opens the wallet section") +@When("the user activates wallet") def step(context: any): - _settingsScreen.activate_open_wallet_section() + the_user_activates_wallet() -@When("the user deletes the account |any|") +@When("the user opens the wallet settings") +def step(context: any): + the_user_opens_the_wallet_settings() + +@When("the user deletes the account \"|any|\"") def step(context: any, account_name: str): _statusMain.open_settings() _settingsScreen.delete_account(account_name) - -@When("the user toggles test networks") -def step(context: any): - _settingsScreen.toggle_test_networks() @When("the user selects the default account") def step(context: any): _settingsScreen.select_default_account() -@When("the user edits default account to |any| name and |any| color") +@When("the user edits default account to \"|any|\" name and \"|any|\" color") def step(context: any, account_name: str, account_color: str): _settingsScreen.edit_account(account_name, account_color) -@When("the user registers a random ens name with password |any|") +@When("the user registers a random ens name with password \"|any|\"") def step(context, password): _statusMain.open_settings() _settingsScreen.register_random_ens_name(password) @@ -160,11 +170,11 @@ def step(context: any, oldPassword: str, newPassword: str): def step(context: any, address: str): _settingsScreen.verify_address(address) -@Then("the account |any| is not in the list of accounts") +@Then("the account \"|any|\" is not in the list of accounts") def step(context: any, account_name): _settingsScreen.verify_no_account(account_name) -@Then("the new account with name |any| and color |any| is updated") +@Then("the default account is updated to be named \"|any|\" with color \"|any|\"") def step(context, new_name: str, new_color: str): _settingsScreen.verify_editedAccount(new_name, new_color) @@ -223,7 +233,13 @@ def step(context, display_name): ########################################################################### def the_user_opens_app_settings_screen(): - _statusMain.open_settings() + common_init_steps.the_user_opens_app_settings_screen() def the_user_opens_the_messaging_settings(): - _settingsScreen.open_messaging_settings() \ No newline at end of file + _settingsScreen.open_messaging_settings() + +def the_user_activates_wallet(): + wallet_init_steps.the_user_activates_wallet() + +def the_user_opens_the_wallet_settings(): + wallet_init_steps.the_user_opens_the_wallet_settings() \ No newline at end of file diff --git a/test/ui-test/testSuites/global_shared/steps/startupSteps.py b/test/ui-test/testSuites/global_shared/steps/startupSteps.py index 00cab7734c..cdb8387926 100644 --- a/test/ui-test/testSuites/global_shared/steps/startupSteps.py +++ b/test/ui-test/testSuites/global_shared/steps/startupSteps.py @@ -63,32 +63,46 @@ def a_first_time_user_lands_on_and_generates_new_key(context): welcome_screen = StatusWelcomeScreen() welcome_screen.agree_terms_conditions_and_generate_new_key() -def given_a_first_time_user_lands_on_and_navigates_to_import_seed_phrase(context): +def a_first_time_user_lands_on_and_navigates_to_import_seed_phrase(context): erase_directory(context.userData[_status_data_folder]) start_application(context.userData[_aut_name]) welcome_screen = StatusWelcomeScreen() welcome_screen.agree_terms_conditions_and_navigate_to_import_seed_phrase() - -def when_the_user_signs_up(user, password): + +def the_user_signs_up(user, password): welcome_screen = StatusWelcomeScreen() welcome_screen.input_username_and_password_and_finalize_sign_up(user, password) -def when_the_user_lands_on_the_signed_in_app(): +def the_user_lands_on_the_signed_in_app(): main_screen = StatusMainScreen() main_screen.is_ready() def signs_up_process_steps(context, user, password): a_first_time_user_lands_on_and_generates_new_key(context) - when_the_user_signs_up(user, password) - when_the_user_lands_on_the_signed_in_app() + the_user_signs_up(user, password) + the_user_lands_on_the_signed_in_app() + +def the_user_inputs_the_seed_phrase(seed_phrase: str): + welcome_screen = StatusWelcomeScreen() + welcome_screen.input_seed_phrase(seed_phrase) + +def the_user_clicks_on_the_following_ui_component(component: str): + click_on_an_object(component) -def when_the_user_joins_chat_room(_chat_room): +def signs_up_with_seed_phrase_process_steps(context, seed_phrase, user, password): + a_first_time_user_lands_on_and_navigates_to_import_seed_phrase(context) + the_user_inputs_the_seed_phrase(seed_phrase) + the_user_clicks_on_the_following_ui_component("seedPhraseView_Submit_Button") + the_user_signs_up(user, password) + the_user_lands_on_the_signed_in_app() + +def the_user_joins_chat_room(_chat_room): main_screen = StatusMainScreen() main_screen.join_chat_room(_chat_room) chat_screen = StatusChatScreen() chat_screen.verify_chat_title(_chat_room) -def when_the_user_opens_the_chat_section(): +def the_user_opens_the_chat_section(): main_screen = StatusMainScreen() main_screen.open_chat_section() @@ -110,7 +124,7 @@ def the_user_lands_on_the_community(name: str): def the_admin_creates_a_community_channel(name: str, description: str, method: str): community_screen = StatusCommunityScreen() community_screen.create_community_channel(name, description, method) - + def the_channel_is_open(name: str): chat_screen = StatusChatScreen() chat_screen.verify_chat_title(name) @@ -122,5 +136,8 @@ def the_user_logs_in(username: str, password: str): def login_process_steps(context, user, password, data_dir_path): a_user_starts_the_application_with_a_specific_data_folder(context, data_dir_path) the_user_logs_in(user, password) - when_the_user_lands_on_the_signed_in_app() - + the_user_lands_on_the_signed_in_app() + +def the_user_opens_app_settings_screen(): + main_screen = StatusMainScreen() + main_screen.open_settings() \ No newline at end of file diff --git a/test/ui-test/testSuites/global_shared/steps/steps.py b/test/ui-test/testSuites/global_shared/steps/steps.py index aeb6475b6f..ea8531f81a 100644 --- a/test/ui-test/testSuites/global_shared/steps/steps.py +++ b/test/ui-test/testSuites/global_shared/steps/steps.py @@ -38,7 +38,11 @@ def step(context): @Given("the user joins chat room \"|any|\"") def step(context, room): the_user_joins_chat_room(room) - + +@Given("the user clicks on escape key") +def step(context): + _statusMain.click_escape() + ######################### ### ACTIONS region: ######################### @@ -52,8 +56,8 @@ def step(context, text, obj): input_text(text, obj) @When("user clicks on the following ui-component |any|") -def step(context, obj): - click_on_an_object(obj) +def step(context: any, obj: str): + the_user_clicks_on_the_following_ui_component(obj) @When("the user joins chat room \"|any|\"") def step(context, room): @@ -77,4 +81,4 @@ def the_user_restarts_the_app(context: any): startApplication(context.userData["aut_name"]) def the_user_joins_chat_room(room: str): - when_the_user_joins_chat_room(room) \ No newline at end of file + the_user_joins_chat_room(room) diff --git a/test/ui-test/testSuites/global_shared/steps/walletInitSteps.py b/test/ui-test/testSuites/global_shared/steps/walletInitSteps.py new file mode 100644 index 0000000000..7b3ee584fd --- /dev/null +++ b/test/ui-test/testSuites/global_shared/steps/walletInitSteps.py @@ -0,0 +1,48 @@ +"""It defines wallet specific starting-up or driving-the-app-into-an-idle-state static methods outside bdd context +that can be reused in different `hooks` as well as in specific bdd steps files.""" + +import steps.startupSteps as common_init_steps +from screens.StatusMainScreen import StatusMainScreen +from screens.SettingsScreen import SettingsScreen +from screens.StatusWalletScreen import StatusWalletScreen + +def the_user_activates_wallet_and_opens_the_wallet_section(): + settings_screen = SettingsScreen() + settings_screen.activate_open_wallet_section() + +def the_user_accepts_the_signing_phrase(): + wallet_screen = StatusWalletScreen() + wallet_screen.accept_signing_phrase() + +def activate_and_open_wallet(): + common_init_steps.the_user_opens_app_settings_screen() + the_user_activates_wallet_and_opens_the_wallet_section() + the_user_accepts_the_signing_phrase() + +def the_user_activates_wallet(): + settings_screen = SettingsScreen() + settings_screen.activate_wallet_option() + +def the_user_opens_the_wallet_settings(): + settings_screen = SettingsScreen() + settings_screen.open_wallet_settings() + +def enable_wallet_section(): + common_init_steps.the_user_opens_app_settings_screen() + the_user_activates_wallet() + +def the_user_toggles_test_networks(): + settings_screen = SettingsScreen() + settings_screen.toggle_test_networks() + main_screen = StatusMainScreen() + main_screen.click_tool_bar_back_button() + +def the_user_opens_wallet_screen(): + main_screen = StatusMainScreen() + main_screen.open_wallet() + +def toggle_test_networks(): + the_user_opens_the_wallet_settings() + the_user_toggles_test_networks() + the_user_opens_wallet_screen() + the_user_accepts_the_signing_phrase() \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_communities/shared/steps/communitySteps.py b/test/ui-test/testSuites/suite_communities/shared/steps/communitySteps.py index defc16b738..21f072aae4 100644 --- a/test/ui-test/testSuites/suite_communities/shared/steps/communitySteps.py +++ b/test/ui-test/testSuites/suite_communities/shared/steps/communitySteps.py @@ -29,7 +29,7 @@ def step(context, community_channel_name, community_channel_description, method) @Given("the user lands on the community named \"|any|\"") def step(context: any, community_name: str): the_user_lands_on_the_community(community_name) - + @Given("the channel named \"|any|\" is open") def step(context, community_channel_name): the_channel_is_open(community_channel_name) @@ -78,7 +78,7 @@ def step(context, message_index: int): @When("the user creates a community named \"|any|\", with description \"|any|\", intro \"|any|\" and outro \"|any|\"") def step(context: any, community_name: str, community_description: str, community_intro: str, community_outro: str): the_user_creates_a_community(community_name, community_description, community_intro, community_outro) - + @When("the admin creates a community channel named \"|any|\", with description \"|any|\", with the method \"|any|\"") def step(context, community_channel_name, community_channel_description, method): the_admin_creates_a_community_channel(community_channel_name, community_channel_description, method) @@ -130,11 +130,11 @@ def step(context, user_name): @Then("the user lands on the community named \"|any|\"") def step(context: any, community_name: str): the_user_lands_on_the_community(community_name) - + @Then("the channel named \"|any|\" is open") def step(context, community_channel_name): the_channel_is_open(community_channel_name) - + @Then("the amount of pinned messages is |integer|") def step(context, amount: int): _statusCommunityScreen.check_pin_count(amount) diff --git a/test/ui-test/testSuites/suite_communities/tst_searchFlows/bdd_hooks.py b/test/ui-test/testSuites/suite_communities/tst_searchFlows/bdd_hooks.py index a2f67a012a..f05616fccf 100644 --- a/test/ui-test/testSuites/suite_communities/tst_searchFlows/bdd_hooks.py +++ b/test/ui-test/testSuites/suite_communities/tst_searchFlows/bdd_hooks.py @@ -23,8 +23,8 @@ _method = "bottom_menu" def hook(context): init_steps.context_init(context) init_steps.signs_up_process_steps(context, _user, _password) - init_steps.when_the_user_joins_chat_room(_chat_room1) - init_steps.when_the_user_joins_chat_room(_chat_room2) + init_steps.the_user_joins_chat_room(_chat_room1) + init_steps.the_user_joins_chat_room(_chat_room2) init_steps.the_user_opens_the_community_portal_section() init_steps.the_user_lands_on_the_community_portal_section() init_steps.the_user_creates_a_community(_community_name, _community_description, _community_intro, _community_outro) diff --git a/test/ui-test/testSuites/suite_messaging/shared/steps/chatSteps.py b/test/ui-test/testSuites/suite_messaging/shared/steps/chatSteps.py index 6b4e2a6d6b..5ade8e6bb5 100644 --- a/test/ui-test/testSuites/suite_messaging/shared/steps/chatSteps.py +++ b/test/ui-test/testSuites/suite_messaging/shared/steps/chatSteps.py @@ -258,7 +258,7 @@ def the_group_chat_is_created(): _statusChat = StatusChatScreen() def the_user_opens_the_chat_section(): - when_the_user_opens_the_chat_section() + the_user_opens_the_chat_section() def the_user_sends_a_random_chat_message(context): random_int = randint(0, 10000) diff --git a/test/ui-test/testSuites/suite_messaging/tst_ChatFlow/bdd_hooks.py b/test/ui-test/testSuites/suite_messaging/tst_ChatFlow/bdd_hooks.py index 3fba430c20..9c9c007d45 100644 --- a/test/ui-test/testSuites/suite_messaging/tst_ChatFlow/bdd_hooks.py +++ b/test/ui-test/testSuites/suite_messaging/tst_ChatFlow/bdd_hooks.py @@ -13,7 +13,7 @@ _chat_room = "test" def hook(context): context_init(context) signs_up_process_steps(context, _user, _password) - when_the_user_joins_chat_room(_chat_room) + the_user_joins_chat_room(_chat_room) @OnFeatureEnd def hook(context): @@ -22,7 +22,7 @@ def hook(context): @OnScenarioStart def hook(context): - when_the_user_opens_the_chat_section() + the_user_opens_the_chat_section() @OnStepEnd def hook(context): diff --git a/test/ui-test/testSuites/suite_messaging/tst_OneToOneChatFlow/bdd_hooks.py b/test/ui-test/testSuites/suite_messaging/tst_OneToOneChatFlow/bdd_hooks.py index 2b0224babd..6f4c961169 100644 --- a/test/ui-test/testSuites/suite_messaging/tst_OneToOneChatFlow/bdd_hooks.py +++ b/test/ui-test/testSuites/suite_messaging/tst_OneToOneChatFlow/bdd_hooks.py @@ -4,7 +4,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) -# from steps.chatSteps import * +import steps.startupSteps as init_steps # Global properties for the specific feature _user = "tester123" @@ -13,8 +13,8 @@ _data_folder_path = "../../../fixtures/mutual_contacts" @OnFeatureStart def hook(context): - context_init(context) - login_process_steps(context, _user, _password, _data_folder_path) + init_steps,context_init(context) + init_steps.login_process_steps(context, _user, _password, _data_folder_path) @OnFeatureEnd def hook(context): @@ -23,7 +23,7 @@ def hook(context): @OnScenarioStart def hook(context): - when_the_user_opens_the_chat_section() + init_steps.the_user_opens_the_chat_section() @OnScenarioEnd def hook(context): diff --git a/test/ui-test/testSuites/suite_onboarding/shared/steps/signUpSteps.py b/test/ui-test/testSuites/suite_onboarding/shared/steps/signUpSteps.py index 296c7d4ae4..e6c69625fd 100644 --- a/test/ui-test/testSuites/suite_onboarding/shared/steps/signUpSteps.py +++ b/test/ui-test/testSuites/suite_onboarding/shared/steps/signUpSteps.py @@ -15,11 +15,11 @@ def step(context): @Given("A first time user lands on the status desktop and navigates to import seed phrase") def step(context): - given_a_first_time_user_lands_on_and_navigates_to_import_seed_phrase(context) + a_first_time_user_lands_on_and_navigates_to_import_seed_phrase(context) @Given("the user lands on the signed in app") def step(context): - when_the_user_lands_on_the_signed_in_app() + the_user_lands_on_the_signed_in_app() ######################### ### ACTIONS region: @@ -27,15 +27,15 @@ def step(context): @When("user signs up with username \"|any|\" and password \"|any|\"") def step(context, username, password): - when_the_user_signs_up(username, password) + the_user_signs_up(username, password) @When("the user inputs username |any|") def step(context, username): _welcomeScreen.input_username(username) -@When("The user inputs the seed phrase |any|") +@When("The user inputs the seed phrase \"|any|\"") def step(context, seed_phrase): - _welcomeScreen.input_seed_phrase(seed_phrase) + the_user_inputs_the_seed_phrase(seed_phrase) @When("the user logs in with password |any|") def step(context, password: str): @@ -55,7 +55,7 @@ def step(context): @Then("the user lands on the signed in app") def step(context): - when_the_user_lands_on_the_signed_in_app() + the_user_lands_on_the_signed_in_app() @Then("the invalid seed text is visible") def step(context): diff --git a/test/ui-test/testSuites/suite_onboarding/tst_statusSignUp/test.feature b/test/ui-test/testSuites/suite_onboarding/tst_statusSignUp/test.feature index 2d0a7d660e..0a9fc3e453 100644 --- a/test/ui-test/testSuites/suite_onboarding/tst_statusSignUp/test.feature +++ b/test/ui-test/testSuites/suite_onboarding/tst_statusSignUp/test.feature @@ -120,7 +120,7 @@ Feature: Status Desktop Sign Up Scenario Outline: User signs up with imported seed phrase Given A first time user lands on the status desktop and navigates to import seed phrase - When The user inputs the seed phrase + When The user inputs the seed phrase "" And user clicks on the following ui-component seedPhraseView_Submit_Button When user signs up with username "tester123" and password "TesTEr16843/!@00" Then the user lands on the signed in app @@ -134,7 +134,7 @@ Feature: Status Desktop Sign Up Scenario: User signs up with wrong imported seed phrase Given A first time user lands on the status desktop and navigates to import seed phrase - When The user inputs the seed phrase truth gold urban vital rose market legal release border gospel leave potato + When The user inputs the seed phrase "truth gold urban vital rose market legal release border gospel leave potato" And user clicks on the following ui-component seedPhraseView_Submit_Button Then the following ui-component seedPhraseView_Submit_Button is not enabled And the invalid seed text is visible diff --git a/test/ui-test/testSuites/suite_settings/tst_settingsMenu/test.feature b/test/ui-test/testSuites/suite_settings/tst_settingsMenu/test.feature index 0194d796f3..286f343b24 100644 --- a/test/ui-test/testSuites/suite_settings/tst_settingsMenu/test.feature +++ b/test/ui-test/testSuites/suite_settings/tst_settingsMenu/test.feature @@ -16,7 +16,8 @@ Feature: Status Desktop Settings Menu @merge @mayfail Scenario: User can backup seed phrase - When the user activates wallet and opens the wallet settings + When the user activates wallet + And the user opens the wallet settings And the user backs up the wallet seed phrase Then the backup seed phrase indicator is not displayed diff --git a/test/ui-test/testSuites/suite_wallet/shared/scripts/wallet_names.py b/test/ui-test/testSuites/suite_wallet/shared/scripts/wallet_names.py index 874e531efa..c78721c2af 100644 --- a/test/ui-test/testSuites/suite_wallet/shared/scripts/wallet_names.py +++ b/test/ui-test/testSuites/suite_wallet/shared/scripts/wallet_names.py @@ -14,6 +14,10 @@ mainWallet_Right_Side_Tab_Bar = {"container": statusDesktop_mainWindow, "objectN mailserver_dialog = {"container": statusDesktop_mainWindow_overlay, "objectName": "mailserverConnectionDialog", "type": "StatusDialog"} mailserver_retry = {"container": mailserver_dialog, "objectName": "mailserverConnectionDialog_retryButton", "type": "StatusButton"} +accounts_StatusListView = {"container": statusDesktop_mainWindow, "objectName": "walletAccountsListView", "type": "StatusListView", "visible": True} +firstWalletAccount_Item = {"container": accounts_StatusListView, "index": 0, "objectName": "walletAccountItem", "type": "StatusListItem", "visible": True} + + # Assets view: mainWallet_Assets_View_List = {"container": statusDesktop_mainWindow, "objectName": "assetViewStatusListView", "type": "StatusListView"} 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 2ace3c7b58..ba7f8a19ad 100644 --- a/test/ui-test/testSuites/suite_wallet/shared/steps/walletSteps.py +++ b/test/ui-test/testSuites/suite_wallet/shared/steps/walletSteps.py @@ -1,3 +1,5 @@ +import steps.walletInitSteps as wallet_init_steps + from screens.StatusMainScreen import StatusMainScreen from screens.StatusWalletScreen import StatusWalletScreen from scripts.decorators import verify_screenshot @@ -6,64 +8,77 @@ from common.Common import str_to_bool _statusMain = StatusMainScreen() _walletScreen = StatusWalletScreen() -@When("the user opens wallet screen") -def step(context): - _statusMain.open_wallet() - -@When("the user accepts the signing phrase") -def step(context): - _walletScreen.accept_signing_phrase() +######################### +### PRECONDITIONS region: +######################### -@When("the user adds watch only account with |any| and |any|") +@Given("the user accepts the signing phrase") +def step(context): + the_user_accepts_the_signing_phrase() + +@Given("the user clicks on the first account") +def step(context): + _walletScreen.click_first_account() + +@Given("the user opens wallet screen") +def step(context): + wallet_init_steps.the_user_opens_wallet_screen() + +######################### +### ACTIONS region: +######################### + +@When("the user adds watch only account \"|any|\" named \"|any|\"") @verify_screenshot -def step(context, account_name, address): +def step(context, address, account_name): _walletScreen.add_watch_only_account(account_name, address) -@When("the user generates a new account with |any| and |any|") +@When("an account named \"|any|\" is generated and authenticated using password \"|any|\"") def step(context, account_name, password): _walletScreen.generate_new_account(account_name, password) -@When("the user imports a private key with |any| and |any| and |any|") -def step(context, account_name, password, private_key): +@When("an account named \"|any|\" is added via private key \"|any|\" and authenticated using password \"|any|\"") +def step(context, account_name, private_key, password): _walletScreen.import_private_key(account_name, password, private_key) -@When("the user imports a seed phrase with |any| and |any| and |any|") -def step(context, account_name, password, mnemonic): +@When("an account named \"|any|\" is added via imported seed phrase \"|any|\" and authenticated using password \"|any|\"") +def step(context, account_name, mnemonic, password): _walletScreen.import_seed_phrase(account_name, password, mnemonic) -@When("the user sends a transaction to himself from account |any| of |any| |any| on |any| with password |any|") +@When("the user sends a transaction to himself from account \"|any|\" of \"|any|\" \"|any|\" on \"|any|\" with password \"|any|\"") def step(context, account_name, amount, token, chain_name, password): _walletScreen.send_transaction(account_name, amount, token, chain_name, password) -@When("the user adds a saved address named |any| and address |any|") +@When("the user adds a saved address named \"|any|\" and address \"|any|\"") def step(context, name, address): _walletScreen.add_saved_address(name, address) -@When("the user edits a saved address with name |any| to |any|") +@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 deletes the saved address with name |any|") +@When("the user deletes the saved address with name \"|any|\"") def step(context, name): _walletScreen.delete_saved_address(name) -@When("the user toggles favourite for the saved address with name |any|") +@When("the user toggles favourite for the saved address with name \"|any|\"") def step(context, name): _walletScreen.toggle_favourite_for_saved_address(name) -@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)) - @When("the user toggles the network |any|") def step(context, network_name): _walletScreen.toggle_network(network_name) -@Then("the user has a positive balance of |any|") + +######################### +### VERIFICATIONS region: +######################### + +@Then("the user has a positive balance of \"|any|\"") def step(context, symbol): _walletScreen.verify_positive_balance(symbol) -@Then("the new account |any| is added") +@Then("the new account \"|any|\" is added") def step(context, account_name): _walletScreen.verify_account_name_is_present(account_name) @@ -71,11 +86,11 @@ def step(context, account_name): def step(context): _walletScreen.verify_transaction() -@Then("the name |any| is in the list of saved addresses") +@Then("the name \"|any|\" is in the list of saved addresses") def step(context, name: str): _walletScreen.verify_saved_address_exists(name) -@Then("the name |any| is not in the list of saved addresses") +@Then("the name \"|any|\" is not in the list of saved addresses") def step(context, name: str): _walletScreen.verify_saved_address_doesnt_exist(name) @@ -85,4 +100,12 @@ def step(context, account_name: str): @Then("the transactions are listed for the added account") def step(context): - _walletScreen.verify_transactions_exist() \ No newline at end of file + _walletScreen.verify_transactions_exist() + +@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)) + +########################################################################### +### COMMON methods used in different steps given/when/then region: +########################################################################### \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_wallet/tst_transaction/bdd_hooks.py b/test/ui-test/testSuites/suite_wallet/tst_transaction/bdd_hooks.py new file mode 100644 index 0000000000..224293fbce --- /dev/null +++ b/test/ui-test/testSuites/suite_wallet/tst_transaction/bdd_hooks.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +# This file contains hook functions to run as the .feature file is executed + +sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/")) +sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) + +import steps.startupSteps as common_init_steps +import steps.walletInitSteps as wallet_init_steps + +# Global properties for the specific feature +_user = "tester123" +_password = "qqqqqqqqqq" +_seed_phrase = "pelican chief sudden oval media rare swamp elephant lawsuit wheat knife initial" + +@OnFeatureStart +def hook(context): + common_init_steps.context_init(context) + common_init_steps.signs_up_with_seed_phrase_process_steps(context, _seed_phrase, _user, _password) + wallet_init_steps.enable_wallet_section() + wallet_init_steps.toggle_test_networks() + +@OnFeatureEnd +def hook(context): + currentApplicationContext().detach() + snooze(_app_closure_timeout) + +@OnStepEnd +def hook(context): + context.userData["step_name"] = context._data["text"] \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_wallet/tst_transaction/test.feature b/test/ui-test/testSuites/suite_wallet/tst_transaction/test.feature index 2d071373a2..ab626bdffb 100644 --- a/test/ui-test/testSuites/suite_wallet/tst_transaction/test.feature +++ b/test/ui-test/testSuites/suite_wallet/tst_transaction/test.feature @@ -1,22 +1,29 @@ Feature: Status Desktop Transaction - As a user I want to perform transaction + As a user I want to perform transactions - Background: Sign up & Enable wallet section & Toggle test networks - Given A first time user lands on the status desktop and navigates to import seed phrase - When The user inputs the seed phrase pelican chief sudden oval media rare swamp elephant lawsuit wheat knife initial - And user clicks on the following ui-component seedPhraseView_Submit_Button - When user signs up with username "tester123" and password "qqqqqqqqqq" - Then the user lands on the signed in app - When the user opens app settings screen - And the user activates wallet and opens the wallet settings - And the user toggles test networks - And the user opens wallet screen - And the user accepts the signing phrase + The feature start sequence is the following (setup on its own `bdd_hooks`): + + ** given A first time user lands on the status desktop and navigates to import seed phrase + ** and the user inputs the seed phrase "pelican chief sudden oval media rare swamp elephant lawsuit wheat knife initial" + ** and the user clicks on the following ui-component seedPhraseView_Submit_Button + ** and the user signs up with username "tester123" and password "qqqqqqqqqq" + ** and the user lands on the signed in app + ** and the user opens app settings screen + ** and the user activates wallet + ** and the user opens the wallet settings + ** and the user toggles test networks + ** and the user opens wallet screen + ** and the user accepts the signing phrase + + Background: Navigation to main wallet screen + + Given the user opens wallet screen + And the user clicks on the first account @mayfail - Scenario Outline: User sends a transaction - When the user sends a transaction to himself from account Status account of on with password qqqqqqqqqq + Scenario Outline: The user sends a transaction + When the user sends a transaction to himself from account "Status account" of "" "" on "" with password "qqqqqqqqqq" Then the transaction is in progress Examples: @@ -27,6 +34,6 @@ Feature: Status Desktop Transaction | 0 | STT | Goerli | @mayfail - Scenario: User registers a ENS name - When the user registers a random ens name with password qqqqqqqqqq + Scenario: The user registers an ENS name + When the user registers a random ens name with password "qqqqqqqqqq" Then the transaction is in progress diff --git a/test/ui-test/testSuites/suite_wallet/tst_transaction/test.py b/test/ui-test/testSuites/suite_wallet/tst_transaction/test.py index 01702be131..e69956ffa6 100644 --- a/test/ui-test/testSuites/suite_wallet/tst_transaction/test.py +++ b/test/ui-test/testSuites/suite_wallet/tst_transaction/test.py @@ -1,7 +1,7 @@ source(findFile('scripts', 'python/bdd.py')) -setupHooks('../../global_shared/scripts/bdd_hooks.py') -collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/', '../../suite_onboarding/shared/steps/') +setupHooks('bdd_hooks.py') +collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/') def main(): testSettings.throwOnFailure = True diff --git a/test/ui-test/testSuites/suite_wallet/tst_wallet/bdd_hooks.py b/test/ui-test/testSuites/suite_wallet/tst_wallet/bdd_hooks.py new file mode 100644 index 0000000000..35501f84f8 --- /dev/null +++ b/test/ui-test/testSuites/suite_wallet/tst_wallet/bdd_hooks.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- +# This file contains hook functions to run as the .feature file is executed + +sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/")) +sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) + +import steps.startupSteps as common_init_steps +import steps.walletInitSteps as wallet_init_steps + +# Global properties for the specific feature +_user = "tester123" +_password = "TesTEr16843/!@00" + +@OnFeatureStart +def hook(context): + context_init(context) + common_init_steps.signs_up_process_steps(context, _user, _password) + wallet_init_steps.activate_and_open_wallet() + +@OnFeatureEnd +def hook(context): + currentApplicationContext().detach() + snooze(_app_closure_timeout) + +@OnStepEnd +def hook(context): + context.userData["step_name"] = context._data["text"] \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_wallet/tst_wallet/test.feature b/test/ui-test/testSuites/suite_wallet/tst_wallet/test.feature index 7a767f977c..064d57ec07 100644 --- a/test/ui-test/testSuites/suite_wallet/tst_wallet/test.feature +++ b/test/ui-test/testSuites/suite_wallet/tst_wallet/test.feature @@ -2,56 +2,67 @@ Feature: Status Desktop Wallet As a user I want to use the wallet - Background: Sign up & Enable wallet section - Given A first time user lands on the status desktop and generates new key - When user signs up with username "tester123" and password "TesTEr16843/!@00" - Then the user lands on the signed in app - When the user opens app settings screen - When the user activates wallet and opens the wallet section - When the user accepts the signing phrase + The feature start sequence is the following (setup on its own `bdd_hooks`): + ** given A first time user lands on the status desktop and generates new key + ** when user signs up with username "tester123" and password "TesTEr16843/!@00" + ** and the user lands on the signed in app - Scenario: User can observe an account data - When the user opens app settings screen + ** given the user opens app settings screen + ** and the user activates wallet and opens the wallet section + ** and the user accepts the signing phrase + + Background: Navigation to main wallet screen + + Given the user opens wallet screen + And the user clicks on the first account + + Scenario: The user can import seed phrase and observe an account data + Given the user opens app settings screen And the user opens the wallet settings And the user toggles test networks And the user opens wallet screen - And the user imports a seed phrase with one and TesTEr16843/!@00 and pelican chief sudden oval media rare swamp elephant lawsuit wheat knife initial - Then the new account one is added - And the user has a positive balance of ETH - And the user has a positive balance of STT - # And the collectibles are listed for the one + When an account named "one" is added via imported seed phrase "pelican chief sudden oval media rare swamp elephant lawsuit wheat knife initial" and authenticated using password "TesTEr16843/!@00" + Then the new account "one" is added + And the user has a positive balance of "ETH" + And the user has a positive balance of "STT" + # And the collectibles are listed for the on And the transactions are listed for the added account + Scenario: The user can manage a watch only account + When the user adds watch only account "0x8397bc3c5a60a1883174f722403d63a8833312b7" named "AccountWatch" + Then the new account "AccountWatch" is added - Scenario: User can manage a list of accounts - When the user adds watch only account with AccountWatch and 0x8397bc3c5a60a1883174f722403d63a8833312b7 - Then the new account AccountWatch is added - When the user imports a private key with AccountPrivate and TesTEr16843/!@00 and 8da4ef21b864d2cc526dbdb2a120bd2874c36c9d0a1fb7f8c63d7f7a8b41de8f - Then the new account AccountPrivate is added - When the user imports a seed phrase with AccountSeed and TesTEr16843/!@00 and pelican chief sudden oval media rare swamp elephant lawsuit wheat knife initial - Then the new account AccountSeed is added - When the user generates a new account with AccountGenerated and TesTEr16843/!@00 - Then the new account AccountGenerated is added - When the user deletes the account AccountGenerated - Then the account AccountGenerated is not in the list of accounts - When the user opens app settings screen + Scenario: The user imports a private key + When an account named "AccountPrivate" is added via private key "8da4ef21b864d2cc526dbdb2a120bd2874c36c9d0a1fb7f8c63d7f7a8b41de8f" and authenticated using password "TesTEr16843/!@00" + Then the new account "AccountPrivate" is added + + @mayfail + Scenario: The user generates a new account from wallet and deletes it + When an account named "AccountGenerated" is generated and authenticated using password "TesTEr16843/!@00" + Then the new account "AccountGenerated" is added + + When the user deletes the account "AccountGenerated" + Then the account "AccountGenerated" is not in the list of accounts + + Scenario: The user edits the default account + Given the user opens app settings screen And the user opens the wallet settings - And the user selects the default account - And the user edits default account to Default name and #FFCA0F color - Then the new account with name DefaultStatus account and color #FFCA0F is updated + When the user selects the default account + And the user edits default account to "Default" name and "#FFCA0F" color + Then the default account is updated to be named "DefaultStatus account" with color "#FFCA0F" + Scenario Outline: The user can manage a saved address + When the user adds a saved address named "" and address "
" + And the user toggles favourite for the saved address with name "" + Then the saved address "" has favourite status "true" - Scenario Outline: User can manage a saved address - When the user adds a saved address named and address
- And the user toggles favourite for the saved address with name - Then the saved address has favourite status true - When the user deletes the saved address with name - Then the name is not in the list of saved addresses - When the user adds a saved address named and address
- And the user edits a saved address with name to - Then the name is in the list of saved addresses + When the user deletes the saved address with name "" + Then the name "" is not in the list of saved addresses + When the user adds a saved address named "" and address "
" + And the user edits a saved address with name "" to "" + Then the name "" is in the list of saved addresses Examples: | name | address | new_name | | bar | 0x8397bc3c5a60a1883174f722403d63a8833312b7 | foo | \ No newline at end of file diff --git a/test/ui-test/testSuites/suite_wallet/tst_wallet/test.py b/test/ui-test/testSuites/suite_wallet/tst_wallet/test.py index 01702be131..e69956ffa6 100644 --- a/test/ui-test/testSuites/suite_wallet/tst_wallet/test.py +++ b/test/ui-test/testSuites/suite_wallet/tst_wallet/test.py @@ -1,7 +1,7 @@ source(findFile('scripts', 'python/bdd.py')) -setupHooks('../../global_shared/scripts/bdd_hooks.py') -collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/', '../../suite_onboarding/shared/steps/') +setupHooks('bdd_hooks.py') +collectStepDefinitions('./steps', '../shared/steps/', '../../global_shared/steps/') def main(): testSettings.throwOnFailure = True diff --git a/ui/StatusQ/src/StatusQ/Components/StatusToolBar.qml b/ui/StatusQ/src/StatusQ/Components/StatusToolBar.qml index 8428d79503..755e116124 100644 --- a/ui/StatusQ/src/StatusQ/Components/StatusToolBar.qml +++ b/ui/StatusQ/src/StatusQ/Components/StatusToolBar.qml @@ -17,6 +17,7 @@ ToolBar { signal backButtonClicked() signal notificationButtonClicked() + objectName: "statusToolBar" implicitWidth: visible ? 518 : 0 implicitHeight: visible ? 56 : 0 padding: 4 @@ -27,6 +28,7 @@ ToolBar { anchors.rightMargin: 4 spacing: 0 StatusFlatButton { + objectName: "toolBarBackButton" icon.name: "arrow-left" icon.width: 20 icon.height: 20 diff --git a/ui/app/AppLayouts/Wallet/views/LeftTabView.qml b/ui/app/AppLayouts/Wallet/views/LeftTabView.qml index 9431663c6f..4835dc3533 100644 --- a/ui/app/AppLayouts/Wallet/views/LeftTabView.qml +++ b/ui/app/AppLayouts/Wallet/views/LeftTabView.qml @@ -103,6 +103,7 @@ Rectangle { } StatusListView { + objectName: "walletAccountsListView" spacing: Style.current.smallPadding Layout.fillWidth: true Layout.fillHeight: true @@ -111,6 +112,7 @@ Rectangle { // ScrollBar.horizontal.policy: ScrollBar.AlwaysOff delegate: StatusListItem { + objectName: "walletAccountItem" width: ListView.view.width highlighted: RootStore.currentAccount.name === model.name title: model.name