Skip to content

Commit ea6c541

Browse files
authored
Merge pull request #10 from AutomationSolutionz/local_run
local_run implemented
2 parents ef0477e + 56d1a11 commit ea6c541

File tree

3 files changed

+5
-228
lines changed

3 files changed

+5
-228
lines changed

Framework/MainDriverApi.py

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1455,36 +1455,11 @@ def run_test_case(
14551455
CommonUtil.CreateJsonReport(TCInfo=after_execution_dict)
14561456

14571457
debug = True if run_id.startswith("debug") else False
1458-
# if str(run_id).startswith("debug"):
1459-
# debug = True
1460-
# debug_steps = debug_info["debug_steps"]
1461-
# str_list = str(debug_steps).split("-")
1462-
# debug_steps = str_list[0]
1463-
# debug_steps = str(debug_steps[1:-1]).split(",")
1464-
#
1465-
# if debug and ConfigModule.get_config_value("RunDefinition", "local_run") == "False":
1466-
# CommonUtil.Join_Thread_and_Return_Result("screenshot") # Let the capturing screenshot end in thread
1467-
# executor.submit(cleanup_runid_from_server, run_id)
1468-
# executor.submit(start_sending_log_to_server, run_id, temp_ini_file)
1469-
# executor.submit(start_sending_shared_var_to_server, run_id)
1470-
# executor.submit(start_sending_step_result_to_server, run_id, debug_steps, sTestStepResultList)
1471-
# executor.submit(send_debug_data, run_id, "finished", "yes")
1472-
14731458
if not debug: # if normal run, then write log file and cleanup driver instances
14741459
CommonUtil.Join_Thread_and_Return_Result("screenshot") # Let the capturing screenshot end in thread
14751460
cleanup_driver_instances() # clean up drivers
14761461
shared.Clean_Up_Shared_Variables() # clean up shared variables
14771462
if ConfigModule.get_config_value("RunDefinition", "local_run") == "False":
1478-
# executor.submit(
1479-
# write_log_file_for_test_case,
1480-
# sTestCaseStatus,
1481-
# test_case,
1482-
# run_id,
1483-
# sTestCaseEndTime,
1484-
# TestCaseDuration,
1485-
# temp_ini_file,
1486-
# send_log_file_only_for_fail,
1487-
# )
14881463
write_log_file_for_test_case(
14891464
sTestCaseStatus,
14901465
test_case,
@@ -1725,7 +1700,7 @@ def upload_json_report(Userid, temp_ini_file, run_id, all_run_id_info):
17251700
break
17261701
time.sleep(1)
17271702
else:
1728-
print("Could not Upload json report to server")
1703+
print("Could not Upload the report to server of run_id '%s'" % run_id)
17291704
os.unlink(str(zip_path) + ".zip")
17301705
with open(path, "w") as f:
17311706
json.dump(json_report, f, indent=2)
@@ -1771,8 +1746,7 @@ def main(device_dict, user_info_object):
17711746
cnt += 1
17721747
with open(json_path, "r") as f:
17731748
all_run_id_info = json.loads(f.read())
1774-
with open(Path.cwd().parent / "Projects" / "Local_run.json", "w") as f:
1775-
f.write(json.dumps(all_run_id_info))
1749+
17761750
if len(all_run_id_info) == 0:
17771751
CommonUtil.ExecLog("", "No Test Run Schedule found for the current user : %s" % Userid, 2)
17781752
return False
@@ -1789,7 +1763,6 @@ def main(device_dict, user_info_object):
17891763
path = ConfigModule.get_config_value("sectionOne", "temp_run_file_path", temp_ini_file) / Path(run_id.replace(":", "-"))
17901764
FL.CreateFolder(path)
17911765

1792-
17931766
# Start websocket server if we're in debug mode.
17941767
if run_id.lower().startswith("debug"):
17951768
print("[LIVE LOG] Connecting to Live Log service")
@@ -1828,7 +1801,8 @@ def main(device_dict, user_info_object):
18281801
'Built_In_Driver', 'deepak', 'Built_In_Appium', 'Built_In_NET_Win', 'Jarvis']
18291802
final_run_params = {}
18301803
for param in final_run_params_from_server:
1831-
final_run_params[param] = CommonUtil.parse_value_into_object(list(final_run_params_from_server[param].items())[0][1])
1804+
final_run_params[param] = CommonUtil.parse_value_into_object(list(final_run_params_from_server[param].items())[1][1])
1805+
# final_run_params[param] = CommonUtil.parse_value_into_object(list(final_run_params_from_server[param].items())[0][1])
18321806
# final_run_params[param] = CommonUtil.parse_value_into_object(final_run_params_from_server[param]["subfield"])
18331807
send_log_file_only_for_fail = ConfigModule.get_config_value("RunDefinition", "upload_log_file_only_for_fail")
18341808
send_log_file_only_for_fail = False if send_log_file_only_for_fail.lower() == "false" else True
@@ -1984,9 +1958,6 @@ def kill(process):
19841958
upload_json_report(Userid, temp_ini_file, run_id, all_run_id_info)
19851959
# executor.submit(upload_json_report)
19861960

1987-
# Delete downloaded attachments
1988-
FL.DeleteFolder(ConfigModule.get_config_value("sectionOne", "download_folder", temp_ini_file))
1989-
19901961
# Close websocket connection.
19911962
if run_id.lower().startswith("debug"):
19921963
ws.close()

Projects/Local_run.json

Lines changed: 0 additions & 185 deletions
This file was deleted.

node_cli.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -786,16 +786,7 @@ def Local_run():
786786
device_dict = All_Device_Info.get_all_connected_device_info()
787787
rem_config = {"local_run": True}
788788
ConfigModule.remote_config = rem_config
789-
790-
path = Path.cwd().parent / "Projects" / "Local_run.json"
791-
with open(path, "r") as f:
792-
Json_data = json.load(f)
793-
if isinstance(Json_data, str):
794-
Json_data = json.loads(Json_data)
795-
all_run_id_info = Json_data if isinstance(Json_data, list) else Json_data["json"]
796-
with open(path, "w") as f:
797-
json.dump(all_run_id_info, f, indent=2)
798-
MainDriverApi.main(device_dict, user_info_object, all_run_id_info)
789+
MainDriverApi.main(device_dict, user_info_object)
799790
except Exception as e:
800791
exc_type, exc_obj, exc_tb = sys.exc_info()
801792
fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]

0 commit comments

Comments
 (0)