test(chore): Renamed and reorganized files and added files flow diagram

Renamed `startupSteps.py` to `commonInitSteps.py`.
Cleanup `Processes` folder (not used).
Moved `walletInitSteps.py` inside the own suite steps.
Added files flow diagram.

Closes #8353
This commit is contained in:
Noelia 2022-11-21 13:56:06 +01:00 committed by Noelia
parent 0baa49c978
commit ed42928f0b
28 changed files with 55 additions and 225 deletions

View File

@ -16,3 +16,5 @@ UI test application for **Status Desktop**
* Save changes. * Save changes.
Now you should be able to create new suites, test cases and run the existing ones just only by clicking `Run` buttons!! Now you should be able to create new suites, test cases and run the existing ones just only by clicking `Run` buttons!!
[Here](https://hackmd.io/@status-desktop/S19eu_Baq) a more detailed **installation guide** specific for this project.

File diff suppressed because one or more lines are too long

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

After

Width:  |  Height:  |  Size: 125 KiB

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

View File

@ -1,127 +0,0 @@
#******************************************************************************
# Status.im
#*****************************************************************************/
#/**
# * \file StatusLoginProcess.py
# *
# * \date February 2022
# * \brief It defines the status login process.
# *****************************************************************************/
from processes.StatusProcess import StatusProcess
from screens.StatusLoginScreen import StatusLoginScreen
from screens.StatusLoginScreen import PswPlaceholderTextType
# It defines the status login process.
class StatusLoginProcess(StatusProcess):
__login_screen = None
__account = None
__byKeycard = False
__isBiometrics = False
__step1_result = False
__step2_result = False
__step3_result = False
def __init__(self, account, isBiometrics=False):
self.__account = account
self.__byKeycard = (account.get_password() == None)
self.__isBiometrics = isBiometrics
# It is used to check if the process can be run
def can_execute_process(self):
# Create current screen and verify if it is correctly loaded
self.__login_screen = StatusLoginScreen()
return self.__login_screen.is_loaded()
# It is used to execute the status login process steps.
def execute_process(self, verify_success = True):
self.__verify_success = verify_success
if(self.__account.get_password()):
self.__execute_password_steps()
else:
raise NotImplementedError("TODO: __execute_keycard_steps")
# It is used to obtain the status login process output result.
def get_process_result(self):
result = False
result_description = None
# Login by password:
if(self.__account.get_password()):
if not self.__step1_result:
result_description = "Not possible to select the given account."
elif not self.__step2_result:
result_description = "Not possible to introduce given password and submit."
elif not self.__step3_result and self.__verify_success:
result_description = "Expected connection to Status Desktop failed."
elif not self.__step3_result and not self.__verify_success:
result_description = "Expected error message not shown."
else:
# All the steps have been correctly executed.
result = True
result_description = "Process steps succeeded!"
# Login by keycard:
else:
raise NotImplementedError("TODO: __execute_keycard_steps")
return result, result_description
# Step 1 - The user selects an account
# Step 2 - The user enters a password
# Step 3 - Verify login success / failure
def __execute_password_steps(self):
# Step 1:
self.__step1_result = self.__step_user_selects_account(self.__account.get_name())
# Step 2:
self.__step2_result = self.__step_user_enters_password(self.__account.get_password())
# Step 3:
if self.__verify_success:
self.__step3_result = self.__verify_login_success()
else:
self.__step3_result = self.__verify_login_failure()
# It navigates through login screen to select the given account:
def __step_user_selects_account(self, accountName):
result = False
if self.__login_screen and self.__login_screen.is_loaded():
if self.__login_screen.open_accounts_selector_popup():
accounts_popup = self.__login_screen.get_accounts_selector_popup()
if accounts_popup.is_loaded():
result = accounts_popup.select_account(accountName)
return result
# It navigates through password input and submits the introduced one:
def __step_user_enters_password(self, password):
res1 = False
res2 = False
if self.__login_screen and self.__login_screen.is_loaded():
res1 = self.__login_screen.introduce_password(password)
res2 = self.__login_screen.submit_password()
return res1 & res2
# It inspects login screen and decides if login has been succeed:
def __verify_login_success(self):
res1 = False
res2 = False
if self.__login_screen and self.__login_screen.is_loaded():
res1 = self.__login_screen.get_password_placeholder_text() == PswPlaceholderTextType.CONNECTING.value
res2 = self.__login_screen.get_error_message_text() == ""
return res1 & res2
# It inspects login screen and decides if it displays the expected failure information:
def __verify_login_failure(self):
result = False
if self.__login_screen and self.__login_screen.is_loaded():
result = self.__login_screen.get_error_message_text() == self.__login_screen.get_expected_error_message_text()
return result

View File

@ -1,47 +0,0 @@
#******************************************************************************
# Status.im
#*****************************************************************************/
#/**
# * \file StatusProcess.py
# *
# * \date February 2022
# * \brief Base template class to define testing status processes.
# *****************************************************************************/
class StatusProcess:
__context = None
# Variable used to determine if it is needed to verify the process success or the process failure behavior
__verify_success: bool = True
def __init__(self, context):
self.__context = context
# It is used to check if the process can be run
#@abstractmethod
def can_execute_process(self):
print("TODO: Invoke needed screen/s constructors")
# ***
# Below, the code to create the necessary status screen to execute the process.
# ***
# It is used to execute the specific status process steps.
#@abstractmethod
def execute_process(self, verify_success: bool = True):
self.__verify_success = verify_success
print("TODO: Invoke navigations")
# ***
# Below, the code to invoke the necessary status screen's navigations.
# ***
# It is used to obtain the status process output result.
#@abstractmethod
def get_process_result(self):
result = False
result_description = None
print("TODO: Validate process steps")
# ***
# Below, the code to validate status process steps.
# ***
return result, result_description

View File

@ -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__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
from steps.startupSteps import context_init from steps.commonInitSteps import context_init
@OnScenarioStart @OnScenarioStart
def hook(context): def hook(context):

View File

@ -11,6 +11,7 @@ from screens.StatusChatScreen import StatusChatScreen
from screens.StatusCommunityPortalScreen import StatusCommunityPortalScreen from screens.StatusCommunityPortalScreen import StatusCommunityPortalScreen
from screens.StatusCommunityScreen import StatusCommunityScreen from screens.StatusCommunityScreen import StatusCommunityScreen
from screens.StatusLoginScreen import StatusLoginScreen from screens.StatusLoginScreen import StatusLoginScreen
from screens.SettingsScreen import SettingsScreen
# Project settings properties: # Project settings properties:
_status_desktop_app_name = "nim_status_client" _status_desktop_app_name = "nim_status_client"
@ -152,3 +153,12 @@ def the_user_navigates_back_to_user_profile_page():
welcome_screen = StatusWelcomeScreen() welcome_screen = StatusWelcomeScreen()
welcome_screen.navigate_back_to_user_profile_page() welcome_screen.navigate_back_to_user_profile_page()
def the_user_activates_wallet_and_opens_the_wallet_section():
settings_screen = SettingsScreen()
settings_screen.activate_open_wallet_section()
def the_user_toggles_test_networks():
settings_screen = SettingsScreen()
settings_screen.toggle_test_networks()
main_screen = StatusMainScreen()
main_screen.click_tool_bar_back_button()

View File

@ -1,5 +1,4 @@
import steps.startupSteps as common_init_steps import steps.commonInitSteps as init_steps
import steps.walletInitSteps as wallet_init_steps
from screens.StatusMainScreen import StatusMainScreen from screens.StatusMainScreen import StatusMainScreen
from screens.SettingsScreen import SettingsScreen from screens.SettingsScreen import SettingsScreen
@ -27,11 +26,11 @@ def step(context: any):
@Given("the user activates wallet and opens the wallet section") @Given("the user activates wallet and opens the wallet section")
def step(context: any): def step(context: any):
wallet_init_steps.the_user_activates_wallet_and_opens_the_wallet_section() init_steps.the_user_activates_wallet_and_opens_the_wallet_section()
@Given("the user toggles test networks") @Given("the user toggles test networks")
def step(context: any): def step(context: any):
wallet_init_steps.the_user_toggles_test_networks() init_steps.the_user_toggles_test_networks()
@Given("the user activates wallet") @Given("the user activates wallet")
def step(context: any): def step(context: any):
@ -233,7 +232,7 @@ def step(context, display_name):
########################################################################### ###########################################################################
def the_user_opens_app_settings_screen(): def the_user_opens_app_settings_screen():
common_init_steps.the_user_opens_app_settings_screen() init_steps.the_user_opens_app_settings_screen()
def the_user_opens_the_messaging_settings(): def the_user_opens_the_messaging_settings():
_settingsScreen.open_messaging_settings() _settingsScreen.open_messaging_settings()

View File

@ -16,7 +16,7 @@
import common.Common as common import common.Common as common
import time import time
import steps.startupSteps as init_steps import steps.commonInitSteps as init_steps
from screens.StatusMainScreen import StatusMainScreen from screens.StatusMainScreen import StatusMainScreen
from screens.StatusChatScreen import StatusChatScreen from screens.StatusChatScreen import StatusChatScreen
@ -29,7 +29,7 @@ _statusChat = StatusChatScreen()
@Given("the user starts the application with a specific data folder \"|any|\"") @Given("the user starts the application with a specific data folder \"|any|\"")
def step(context, data_folder_path): def step(context, data_folder_path):
common.a_user_starts_the_application_with_a_specific_data_folder(context, data_folder_path) init_steps.a_user_starts_the_application_with_a_specific_data_folder(context, data_folder_path)
@Given("the user restarts the app") @Given("the user restarts the app")
def step(context): def step(context):

View File

@ -1,4 +1,4 @@
import steps.startupSteps as init_steps import steps.commonInitSteps as init_steps
from screens.StatusMainScreen import StatusMainScreen from screens.StatusMainScreen import StatusMainScreen
from screens.StatusCommunityPortalScreen import StatusCommunityPortalScreen from screens.StatusCommunityPortalScreen import StatusCommunityPortalScreen
from screens.StatusCommunityScreen import StatusCommunityScreen from screens.StatusCommunityScreen import StatusCommunityScreen

View File

@ -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__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
import steps.startupSteps as init_steps import steps.commonInitSteps as init_steps
# Global properties for the specific feature # Global properties for the specific feature
_user = "tester123" _user = "tester123"

View File

@ -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__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
from steps.startupSteps import * import steps.commonInitSteps as init_steps
# Global properties for the specific feature # Global properties for the specific feature
_user = "tester123" _user = "tester123"
@ -12,8 +12,8 @@ _password = "TesTEr16843/!@00"
@OnFeatureStart @OnFeatureStart
def hook(context): def hook(context):
context_init(context) init_steps.context_init(context)
signs_up_process_steps(context, _user, _password) init_steps.signs_up_process_steps(context, _user, _password)
@OnFeatureEnd @OnFeatureEnd
def hook(context): def hook(context):

View File

@ -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__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
import steps.startupSteps as init_steps import steps.commonInitSteps as init_steps
# Global properties for the specific feature # Global properties for the specific feature
_user = "tester123" _user = "tester123"

View File

@ -1,5 +1,5 @@
from random import randint from random import randint
from steps.startupSteps import * import steps.commonInitSteps as init_steps
from screens.StatusMainScreen import StatusMainScreen from screens.StatusMainScreen import StatusMainScreen
from screens.StatusChatScreen import StatusChatScreen from screens.StatusChatScreen import StatusChatScreen
from screens.StatusCreateChatScreen import StatusCreateChatScreen from screens.StatusCreateChatScreen import StatusCreateChatScreen
@ -276,7 +276,7 @@ def the_group_chat_is_created():
_statusChat = StatusChatScreen() _statusChat = StatusChatScreen()
def the_user_opens_the_chat_section(): def the_user_opens_the_chat_section():
the_user_opens_the_chat_section() init_steps.the_user_opens_the_chat_section()
def the_user_sends_a_random_chat_message(context): def the_user_sends_a_random_chat_message(context):
random_int = randint(0, 10000) random_int = randint(0, 10000)

View File

@ -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__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
import steps.startupSteps as init_steps import steps.commonInitSteps as init_steps
# Global properties for the specific feature # Global properties for the specific feature
_user = "tester123" _user = "tester123"

View File

@ -1,4 +1,4 @@
import steps.startupSteps as init_steps import steps.commonInitSteps as init_steps
from screens.StatusWelcomeScreen import StatusWelcomeScreen from screens.StatusWelcomeScreen import StatusWelcomeScreen
from screens.StatusMainScreen import StatusMainScreen from screens.StatusMainScreen import StatusMainScreen

View File

@ -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__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
import steps.startupSteps as init_steps import steps.commonInitSteps as init_steps
# Global properties for the specific feature # Global properties for the specific feature
_user = "tester123" _user = "tester123"

View File

@ -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__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
import steps.startupSteps as init_steps import steps.commonInitSteps as init_steps
# Global properties for the specific feature # Global properties for the specific feature
_user = "tester123" _user = "tester123"

View File

@ -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__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
import steps.startupSteps as init_steps import steps.commonInitSteps as init_steps
# Global properties for the specific feature # Global properties for the specific feature
_user = "tester123" _user = "tester123"

View File

@ -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__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
import steps.startupSteps as init_steps import steps.commonInitSteps as init_steps
# Global properties for the specific feature # Global properties for the specific feature
_user = "tester123" _user = "tester123"

View File

@ -1,22 +1,18 @@
"""It defines wallet specific starting-up or driving-the-app-into-an-idle-state static methods outside bdd context """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.""" that can be reused in different `hooks` as well as in specific bdd steps files."""
import steps.startupSteps as common_init_steps import steps.commonInitSteps as init_steps
from screens.StatusMainScreen import StatusMainScreen from screens.StatusMainScreen import StatusMainScreen
from screens.SettingsScreen import SettingsScreen from screens.SettingsScreen import SettingsScreen
from screens.StatusWalletScreen import StatusWalletScreen 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(): def the_user_accepts_the_signing_phrase():
wallet_screen = StatusWalletScreen() wallet_screen = StatusWalletScreen()
wallet_screen.accept_signing_phrase() wallet_screen.accept_signing_phrase()
def activate_and_open_wallet(): def activate_and_open_wallet():
common_init_steps.the_user_opens_app_settings_screen() init_steps.the_user_opens_app_settings_screen()
the_user_activates_wallet_and_opens_the_wallet_section() init_steps.the_user_activates_wallet_and_opens_the_wallet_section()
the_user_accepts_the_signing_phrase() the_user_accepts_the_signing_phrase()
def the_user_activates_wallet(): def the_user_activates_wallet():
@ -28,21 +24,15 @@ def the_user_opens_the_wallet_settings():
settings_screen.open_wallet_settings() settings_screen.open_wallet_settings()
def enable_wallet_section(): def enable_wallet_section():
common_init_steps.the_user_opens_app_settings_screen() init_steps.the_user_opens_app_settings_screen()
the_user_activates_wallet() 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(): def the_user_opens_wallet_screen():
main_screen = StatusMainScreen() main_screen = StatusMainScreen()
main_screen.open_wallet() main_screen.open_wallet()
def toggle_test_networks(): def toggle_test_networks():
the_user_opens_the_wallet_settings() the_user_opens_the_wallet_settings()
the_user_toggles_test_networks() init_steps.the_user_toggles_test_networks()
the_user_opens_wallet_screen() the_user_opens_wallet_screen()
the_user_accepts_the_signing_phrase() the_user_accepts_the_signing_phrase()

View File

@ -1,4 +1,4 @@
import steps.walletInitSteps as wallet_init_steps import walletInitSteps as wallet_init_steps
from screens.StatusMainScreen import StatusMainScreen from screens.StatusMainScreen import StatusMainScreen
from screens.StatusWalletScreen import StatusWalletScreen from screens.StatusWalletScreen import StatusWalletScreen

View File

@ -3,9 +3,10 @@
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../shared/steps/"))
import steps.startupSteps as common_init_steps import steps.commonInitSteps as common_init_steps
import steps.walletInitSteps as wallet_init_steps import walletInitSteps as wallet_init_steps
# Global properties for the specific feature # Global properties for the specific feature
_user = "tester123" _user = "tester123"

View File

@ -3,9 +3,10 @@
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
sys.path.append(os.path.join(os.path.dirname(__file__), "../shared/steps/"))
import steps.startupSteps as common_init_steps import steps.commonInitSteps as init_steps
import steps.walletInitSteps as wallet_init_steps import walletInitSteps as wallet_init_steps
# Global properties for the specific feature # Global properties for the specific feature
_user = "tester123" _user = "tester123"
@ -14,7 +15,7 @@ _password = "TesTEr16843/!@00"
@OnFeatureStart @OnFeatureStart
def hook(context): def hook(context):
context_init(context) context_init(context)
common_init_steps.signs_up_process_steps(context, _user, _password) init_steps.signs_up_process_steps(context, _user, _password)
wallet_init_steps.activate_and_open_wallet() wallet_init_steps.activate_and_open_wallet()
@OnFeatureEnd @OnFeatureEnd