Skip to content

Commit

Permalink
test(chore): Add Automatic Screenshots on Test Failures and Errors
Browse files Browse the repository at this point in the history
Set `logScreenshotOnFail` property.

Closes #8330
  • Loading branch information
noeliaSD committed Nov 22, 2022
1 parent 5a0334e commit f077cd8
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion test/ui-test/testSuites/global_shared/scripts/bdd_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

@OnScenarioStart
def hook(context):
context_init(context)
context_init(context, testSettings)

@OnScenarioEnd
def hook(context):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@
_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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

@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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
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"
_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):
Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
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
Expand All @@ -15,8 +15,8 @@

@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

@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()

Expand Down

0 comments on commit f077cd8

Please sign in to comment.