test(chore): Add Automatic Screenshots on Test Failures and Errors

Set `logScreenshotOnFail` property.

Closes #8330
This commit is contained in:
Noelia 2022-11-21 14:41:34 +01:00 committed by Noelia
parent 1da0cf9c79
commit 78d23ccde8
13 changed files with 23 additions and 18 deletions

View File

@ -8,7 +8,7 @@ from steps.commonInitSteps import context_init
@OnScenarioStart
def hook(context):
context_init(context)
context_init(context, testSettings)
@OnScenarioEnd
def hook(context):

View File

@ -28,7 +28,10 @@ _fixtures_root = "fixtures_root"
_search_images = "search_images"
_scenario_name = "scenario_name"
def context_init(context):
def context_init(context, testSettings, screenshot_on_fail = True):
# With this property it is enabled that every test failure will cause Squish to take a screenshot of the desktop when the failure occurred
testSettings.logScreenshotOnFail = screenshot_on_fail
filesMngr.erase_directory(_status_qt_path)
context.userData = {}
context.userData[_aut_name] = _status_desktop_app_name

View File

@ -12,7 +12,7 @@ _password = "TesTEr16843/!@00"
@OnFeatureStart
def hook(context):
init_steps.context_init(context)
init_steps.context_init(context, testSettings)
init_steps.signs_up_process_steps(context, _user, _password)
@OnFeatureEnd

View File

@ -12,7 +12,7 @@ _password = "TesTEr16843/!@00"
@OnFeatureStart
def hook(context):
init_steps.context_init(context)
init_steps.context_init(context, testSettings)
init_steps.signs_up_process_steps(context, _user, _password)
@OnFeatureEnd

View File

@ -21,7 +21,7 @@ _method = "bottom_menu"
@OnFeatureStart
def hook(context):
init_steps.context_init(context)
init_steps.context_init(context, testSettings)
init_steps.signs_up_process_steps(context, _user, _password)
init_steps.the_user_joins_chat_room(_chat_room1)
init_steps.the_user_joins_chat_room(_chat_room2)

View File

@ -4,6 +4,8 @@
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 init_steps
# Global properties for the specific feature
_user = "tester123"
_password = "TesTEr16843/!@00"
@ -11,9 +13,9 @@ _chat_room = "test"
@OnFeatureStart
def hook(context):
context_init(context)
signs_up_process_steps(context, _user, _password)
the_user_joins_chat_room(_chat_room)
init_steps.context_init(context, testSettings)
init_steps.signs_up_process_steps(context, _user, _password)
init_steps.the_user_joins_chat_room(_chat_room)
@OnFeatureEnd
def hook(context):
@ -22,7 +24,7 @@ def hook(context):
@OnScenarioStart
def hook(context):
the_user_opens_the_chat_section()
init_steps.the_user_opens_the_chat_section()
@OnStepEnd
def hook(context):

View File

@ -13,7 +13,7 @@ _data_folder_path = "../../../fixtures/mutual_contacts"
@OnFeatureStart
def hook(context):
init_steps,context_init(context)
init_steps.context_init(context, testSettings)
init_steps.login_process_steps(context, _user, _password, _data_folder_path)
@OnFeatureEnd

View File

@ -12,7 +12,7 @@ _onboarding_new_psw_input = "onboarding_newPsw_Input"
@OnFeatureStart
def hook(context):
init_steps.context_init(context)
init_steps.context_init(context, testSettings)
init_steps.a_first_time_user_lands_on_and_generates_new_key(context)
init_steps.the_user_inputs_username(_user)

View File

@ -12,7 +12,7 @@ _onboarding_new_psw_input = "onboarding_newPsw_Input"
@OnFeatureStart
def hook(context):
init_steps.context_init(context)
init_steps.context_init(context, testSettings)
init_steps.a_first_time_user_lands_on_and_generates_new_key(context)
@OnFeatureEnd

View File

@ -12,7 +12,7 @@ _password = "TesTEr16843/!@00"
@OnFeatureStart
def hook(context):
init_steps.context_init(context)
init_steps.context_init(context, testSettings)
init_steps.signs_up_process_steps(context, _user, _password)
@OnFeatureEnd

View File

@ -12,7 +12,7 @@ _password = "TesTEr16843/!@00"
@OnFeatureStart
def hook(context):
init_steps.context_init(context)
init_steps.context_init(context, testSettings)
init_steps.signs_up_process_steps(context, _user, _password)
@OnFeatureEnd

View File

@ -5,7 +5,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/glo
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.commonInitSteps as common_init_steps
import steps.commonInitSteps as init_steps
import walletInitSteps as wallet_init_steps
# Global properties for the specific feature
@ -15,8 +15,8 @@ _seed_phrase = "pelican chief sudden oval media rare swamp elephant lawsuit whea
@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)
init_steps.context_init(context, testSettings)
init_steps.signs_up_with_seed_phrase_process_steps(context, _seed_phrase, _user, _password)
wallet_init_steps.activate_and_open_wallet()
@OnFeatureEnd

View File

@ -14,7 +14,7 @@ _password = "TesTEr16843/!@00"
@OnFeatureStart
def hook(context):
context_init(context)
init_steps.context_init(context, testSettings)
init_steps.signs_up_process_steps(context, _user, _password)
wallet_init_steps.activate_and_open_wallet()