2022-03-29 08:30:38 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
2022-08-19 15:23:09 +00:00
|
|
|
# This file contains hook functions to run as the .feature file is executed
|
2022-03-29 08:30:38 +00:00
|
|
|
|
2022-08-19 15:23:09 +00:00
|
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../testSuites/global_shared/"))
|
2022-07-13 13:14:52 +00:00
|
|
|
sys.path.append(os.path.join(os.path.dirname(__file__), "../../../src/"))
|
2022-05-26 00:28:49 +00:00
|
|
|
|
2022-07-13 13:14:52 +00:00
|
|
|
from utils.FileManager import *
|
2022-03-29 08:30:38 +00:00
|
|
|
|
2022-07-20 12:14:50 +00:00
|
|
|
_status_desktop_app_name = "nim_status_client"
|
|
|
|
_status_data_folder_path = "../../../../../Status/data"
|
|
|
|
_status_qt_path = "../../../../../Status/qt"
|
|
|
|
_app_closure_timeout = 2 #[seconds]
|
2022-03-29 08:30:38 +00:00
|
|
|
|
|
|
|
@OnScenarioStart
|
|
|
|
def hook(context):
|
2022-07-20 12:14:50 +00:00
|
|
|
erase_directory(_status_qt_path)
|
2022-03-29 08:30:38 +00:00
|
|
|
context.userData = {}
|
2022-07-20 12:14:50 +00:00
|
|
|
context.userData["aut_name"] = _status_desktop_app_name
|
|
|
|
context.userData["status_data_folder_path"] = _status_data_folder_path
|
2022-08-18 07:38:47 +00:00
|
|
|
context.userData["fixtures_root"] = os.path.join(os.path.dirname(__file__), "../../../fixtures/")
|
|
|
|
context.userData["search_images"] = os.path.join(os.path.dirname(__file__), "../shared/searchImages/")
|
2022-03-29 08:30:38 +00:00
|
|
|
|
2022-08-19 14:57:09 +00:00
|
|
|
base_path = os.path.join(os.path.dirname(__file__))
|
|
|
|
split_path = base_path.split("/")
|
|
|
|
|
|
|
|
# Remove the last three parts of the path to go back to the fixtures
|
|
|
|
del split_path[len(split_path) - 1]
|
|
|
|
del split_path[len(split_path) - 1]
|
|
|
|
del split_path[len(split_path) - 1]
|
|
|
|
|
|
|
|
joined_path = ""
|
|
|
|
for path_part in split_path:
|
|
|
|
joined_path += path_part + "/"
|
|
|
|
|
|
|
|
context.userData["fixtures_root"] = os.path.join(joined_path, "fixtures/")
|
|
|
|
|
2022-03-29 08:30:38 +00:00
|
|
|
@OnScenarioEnd
|
|
|
|
def hook(context):
|
|
|
|
currentApplicationContext().detach()
|
2022-07-20 12:14:50 +00:00
|
|
|
snooze(_app_closure_timeout)
|
2022-03-29 08:30:38 +00:00
|
|
|
|