From 734ad54c475526345b47d4a1cfd9e9917f9b6409 Mon Sep 17 00:00:00 2001 From: femi Date: Thu, 26 May 2022 01:28:49 +0100 Subject: [PATCH] feat(@DesktopApp): SignUp Scenario (Squish Test) Ticket: https://github.com/status-im/status-desktop/issues/5718 Include script to erase data file before each test --- test/ui-test/src/screens/StatusWelcomeScreen.py | 3 ++- test/ui-test/src/utils/FileManager.py | 13 +++++++++++++ .../suite_statusLogin/shared/scripts/bdd_hooks.py | 5 +++++ .../suite_statusLogin/shared/scripts/names.py | 7 +++++++ 4 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 test/ui-test/src/utils/FileManager.py diff --git a/test/ui-test/src/screens/StatusWelcomeScreen.py b/test/ui-test/src/screens/StatusWelcomeScreen.py index 910cea46a1..0d4b81066f 100644 --- a/test/ui-test/src/screens/StatusWelcomeScreen.py +++ b/test/ui-test/src/screens/StatusWelcomeScreen.py @@ -7,6 +7,8 @@ # * \date May 2022 # * \brief Sign Up and Login for new users to the app. # *****************************************************************************/ +from enum import Enum +from drivers.SquishDriver import * class AgreementPopUp(Enum): @@ -37,7 +39,6 @@ class StatusWelcomeScreen(): verify_screen_is_loaded(AgreementPopUp.ACKNOWLEDGE_CHECKBOX.value) def agree_terms_conditions_and_generate_new_key(self): - verify_text(AgreementPopUp.ACKNOWLEDGE_CHECKBOX.value, "I acknowledge that Status Desktop is in Beta and by using it, I take the full responsibility for all risks concerning my data and funds.") click_obj_by_name(AgreementPopUp.ACKNOWLEDGE_CHECKBOX.value) check_obj_by_name(AgreementPopUp.TERMS_OF_USE_CHECK_BOX.value) click_obj_by_name(AgreementPopUp.GET_STARTED_BUTTON.value) diff --git a/test/ui-test/src/utils/FileManager.py b/test/ui-test/src/utils/FileManager.py new file mode 100644 index 0000000000..2a9497ca08 --- /dev/null +++ b/test/ui-test/src/utils/FileManager.py @@ -0,0 +1,13 @@ +import os, shutil +import os.path as path + + +def erase_directory(dir): + directory = path.abspath(path.join(__file__ , "../../../../../" + dir)) + if (os.path.isdir(directory)): + print(directory) + try: + shutil.rmtree(directory) + except OSError: + os.remove(directory) + diff --git a/test/ui-test/testSuites/suite_statusLogin/shared/scripts/bdd_hooks.py b/test/ui-test/testSuites/suite_statusLogin/shared/scripts/bdd_hooks.py index 8e8412591e..8a88d2de20 100644 --- a/test/ui-test/testSuites/suite_statusLogin/shared/scripts/bdd_hooks.py +++ b/test/ui-test/testSuites/suite_statusLogin/shared/scripts/bdd_hooks.py @@ -1,13 +1,18 @@ # -*- coding: utf-8 -*- # This file contains hook functions to run as the .feature file is executed. + +from utils.FileManager import * + sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/")) + _statusDektopAppName = "nim_status_client" _appClosureTimeout = 2 #[seconds] @OnScenarioStart def hook(context): + erase_directory("Status/data") startApplication(_statusDektopAppName) context.userData = {} diff --git a/test/ui-test/testSuites/suite_statusLogin/shared/scripts/names.py b/test/ui-test/testSuites/suite_statusLogin/shared/scripts/names.py index 23c9d5eda2..f269231a0d 100644 --- a/test/ui-test/testSuites/suite_statusLogin/shared/scripts/names.py +++ b/test/ui-test/testSuites/suite_statusLogin/shared/scripts/names.py @@ -31,3 +31,10 @@ mainWindow_Create_password_StatusBaseText = {"container": statusDesktop_mainWind mainWindow_Confirm_you_password_again_PlaceholderText = {"container": statusDesktop_mainWindow, "text": "Confirm you password (again)", "type": "PlaceholderText", "unnamed": 1, "visible": True} mainWindow_Finalise_Status_Password_Creation_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "Finalise Status Password Creation", "type": "StatusBaseText", "unnamed": 1, "visible": True} mainWindow_I_prefer_to_use_my_password_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "I prefer to use my password", "type": "StatusBaseText", "unnamed": 1, "visible": True} +mainWindow_Enter_password_PlaceholderText = {"container": statusDesktop_mainWindow, "text": "Enter password", "type": "PlaceholderText", "unnamed": 1, "visible": True} +mainWindow_button_StatusButton = {"container": statusDesktop_mainWindow, "id": "button", "type": "StatusButton", "unnamed": 1, "visible": True} +mainWindow_Username_must_be_at_least_5_characters_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "Username must be at least 5 characters", "type": "StatusBaseText", "unnamed": 1, "visible": True} +mainWindow_Passwords_don_t_match_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "Passwords don't match", "type": "StatusBaseText", "unnamed": 1, "visible": True} +mainWindow_inputRectangle_Rectangle = {"container": statusDesktop_mainWindow, "id": "inputRectangle", "occurrence": 2, "type": "Rectangle", "unnamed": 1, "visible": True} +mainWindow_inputRectangle_Rectangle_2 = {"container": statusDesktop_mainWindow, "id": "inputRectangle", "type": "Rectangle", "unnamed": 1, "visible": True} +mainWindow_You_will_not_be_able_to_recover_this_password_if_it_is_lost_StatusBaseText = {"container": statusDesktop_mainWindow, "text": "You will not be able to recover this password if it is lost.", "type": "StatusBaseText", "unnamed": 1, "visible": True}