Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 4 commits into from
Nov 22, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion test/ui-test/src/screens/StatusMainScreen.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class MainScreenComponents(Enum):
SPLASH_SCREEN = "splashScreen"
TOOLBAR_BACK_BUTTON = "main_toolBar_back_button"
LEAVE_CHAT_MENUITEM = "leaveChatMenuItem"
EMPTY_CHAT_PANEL_IMAGE = "mainWindow_emptyChatPanelImage"

class ProfilePopup(Enum):
USER_IMAGE = "ProfileHeader_userImage"
Expand All @@ -60,12 +61,13 @@ class ChatNamePopUp(Enum):
class StatusMainScreen:

def __init__(self):
verify_screen(MainScreenComponents.PUBLIC_CHAT_ICON.value)
verify_screen(MainScreenComponents.EMPTY_CHAT_PANEL_IMAGE.value)

# Main screen is ready to interact with it (Splash screen animation not present and no banners on top of the screen)
def is_ready(self):
self.wait_for_splash_animation_ends()
self.close_banners()
verify(is_displayed(MainScreenComponents.EMPTY_CHAT_PANEL_IMAGE.value), "Verifying if empty chat panel image is displayed")

def wait_for_splash_animation_ends(self, timeoutMSec: int = 10000):
start = time.time()
Expand Down
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
2 changes: 2 additions & 0 deletions test/ui-test/testSuites/global_shared/scripts/global_names.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
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}
mainWindow_emptyChatPanelImage = {"container": statusDesktop_mainWindow, "objectName": "emptyChatPanelImage", "type": "Image", "visible": True}


# main right panel
mainWindow_RighPanel= {"container": statusDesktop_mainWindow, "type": "ColumnLayout", "objectName": "mainRightView", "visible": True}
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.commonInitSteps 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
1 change: 1 addition & 0 deletions ui/app/AppLayouts/Chat/panels/EmptyChatPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Item {

Image {
id: walkieTalkieImage
objectName: "emptyChatPanelImage"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
source: Style.png("chat/chat@2x")
Expand Down