Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r6a14a242667488bea0e14dc9faf7655b880faed6 -r6d7bc081f5573e6653fa1fa50a28d9acffe0b7af --- shared/scripts/configuration/utility.py (.../utility.py) (revision 6a14a242667488bea0e14dc9faf7655b880faed6) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 6d7bc081f5573e6653fa1fa50a28d9acffe0b7af) @@ -20,7 +20,6 @@ import squish from dialin.ui.hd_simulator import HDSimulator from builtins import int as pyInt -from builtins import int as pyInt from builtins import format from datetime import datetime from dialin.common.msg_ids import MsgIds @@ -29,68 +28,7 @@ LOG_LOCATION = "/home/denali/Desktop/sd-card/log/*.log" -def start_application(app_name): - """ - Function to start application and verify application status [running] - If application does not start or running status is false, test stops - Argument: - @param app_name : (str) - Name of the application - @param app_executable : (str) - Actual application - @return: handle for the application if the application is in running state, - or error (exist the application) - """ - counter = 0 - while True: - try: - counter += 1 - test.log("Starting {}".format(app_name)) - squish.startApplication(app_name) - if counter == 1: - test.log("Application launched at the "+str(counter)+" st try.") - elif counter == 2: - test.log("Application launched at the "+str(counter)+" nd try.") - elif counter == 3: - test.log("Application launched at the "+str(counter)+" rd try.") - else: - test.log("Application launched at the "+str(counter)+" th try.") - break - except RuntimeError: - if counter == 1: - test.log("Application failed to launch after "+str(counter)+" try - Please refer logs") - elif counter == 20: - test.log("Exiting after "+str(counter)+ " tries..") - sys.exit(1) - else: - test.log("Application failed to launch after "+str(counter)+ " tries - Please refer logs") - except: - logErrorDetails("Failed to start the application") - sys.exit(1) - -def check_if_object_is_within_the_container(obj=None, container=None): - """ - check if an object is inside a container - @param obj - child UI object - @param container - container UI object - @return boolean true/false - """ - container = squish.findObject(container) - containerPos = container.mapToGlobal(squish.QPoint(0, 0)) - container_x, container_y = pyInt(containerPos.x), pyInt(containerPos.y) - container_width, container_height = pyInt(container.width), pyInt(container.height) - - obj = squish.findObject(obj) - objPos = obj.mapToGlobal(squish.QPoint(0, 0)) - obj_x, obj_y = pyInt(objPos.x), pyInt(objPos.y) - obj_width, obj_height = pyInt(obj.width), pyInt(obj.height) - - if obj_x >= container_x and obj_y >= container_y: - if (obj_x + obj_width) <= (container_x + container_width) and (obj_y + obj_height) <= (container_y + container_height): - return True - - return False - - def scroll_to_zone(zone=None, screen_object=None): """ scroll to the numeric if object is hidden Index: tst_ui_logs/test.py =================================================================== diff -u -r6a14a242667488bea0e14dc9faf7655b880faed6 -r6d7bc081f5573e6653fa1fa50a28d9acffe0b7af --- tst_ui_logs/test.py (.../test.py) (revision 6a14a242667488bea0e14dc9faf7655b880faed6) +++ tst_ui_logs/test.py (.../test.py) (revision 6d7bc081f5573e6653fa1fa50a28d9acffe0b7af) @@ -38,7 +38,10 @@ hd_alarm= HDAlarmsSimulator(can_interface=messenger, logger=logger) hd_simulator = HDSimulator() dg_simulator = DGSimulator() +NUMBER_OF_OPMODE = 9 +NUMBER_OF_TREATMENTMODES = 3 + def verify_log(msg_id,msg = None, param = None): utils.waitForGUI(0.2) ack = False @@ -56,8 +59,9 @@ test.log(str(message_extracted)) def main(): - startApplication("denaliSquish") - + utils.tstStart(__file__) + startApplication(config.AUT_NAME) + #HD Broadcast #0x0D00 @@ -164,20 +168,20 @@ #HD Operation Mode #0x2500 - for mode in range(9): + for mode in range(NUMBER_OF_OPMODE): hd_simulator.cmd_send_hd_operation_mode(op_mode = mode, sub_mode = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_OP_MODE.value, msg = "OpMode", param = [mode,0]) #0x5C00 - for s_mode in range(9): + for s_mode in range(NUMBER_OF_OPMODE): hd_simulator.cmd_send_pre_treatment_state_data(sub_mode = s_mode, water_sample_state = 0, consumables_self_test_state = 0, no_cartridge_self_test_state = 0, installation_state = 0, dry_self_test_state = 0, prime_state = 0, recirculate_state = 0, patient_connection_state = 0) verify_log(msg_id = MsgIds.MSG_ID_PRE_TREATMENT_STATE.value, msg = "PreTreatmentStates",param = [s_mode,0,0,0,0,0,0,0,0]) #0x0F00 - for s_mode in range(3): + for s_mode in range(NUMBER_OF_TREATMENTMODES): hd_simulator.cmd_set_treatment_states_data(sub_mode = s_mode, uf_state = 0, saline_state = 0, heparin_state = 0, rinseback_state = 0, recirculate_state = 0, blood_prime_state = 0, treatment_end_state = 0, treatment_stop_state = 0, dialysis_state = 0) @@ -189,7 +193,7 @@ verify_log(msg_id = MsgIds.MSG_ID_HD_POST_TREATMENT_STATE.value, msg = "PostTreatmentStates") #0x7E00 - for s_mode in range(3): + for s_mode in range(NUMBER_OF_TREATMENTMODES): hd_simulator.cmd_send_hd_disinfection_state(sub_mode = s_mode, flush_mode = 0, heat_mode = 0, chemical_mode = 0) verify_log(msg_id = MsgIds.MSG_ID_HD_DISINFECT_STANDBY_DATA.value, msg = "DisinfectStates", param = [s_mode,0,0,0]) @@ -264,11 +268,11 @@ #Events #0xA400 - hd_simulator.cmd_send_hd_general_response(message_id=164, accepted=0, reason=1) + hd_simulator.cmd_send_hd_general_response(message_id=164, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_EVENT.value, msg = "General") #0xA500 - dg_simulator.cmd_send_dg_general_response(message_id=165, accepted=0, reason=1) + dg_simulator.cmd_send_dg_general_response(message_id=165, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_EVENT.value) #Power-On Self-Test [POST] @@ -289,7 +293,7 @@ verify_log(msg_id = MsgIds.MSG_ID_DG_POST_FINAL_TEST_RESULT.value, msg = "POSTDone", param = [0]) #0x9C00 - hd_simulator.cmd_send_hd_general_response(message_id=156, accepted=0, reason=1) + hd_simulator.cmd_send_hd_general_response(message_id=156, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_DG_POST_RESULT_REQUEST.value) #Versions @@ -305,6 +309,7 @@ compatibility_rev=6) verify_log(msg_id = MsgIds.MSG_ID_DG_VERSION.value, msg = "Version", param = [1,1,0,4,5,1,2,3,6]) + #TODO: message is not displaying in log after API call #0x9900 hd_simulator.cmd_send_serial_hd_data(serial = 'AGHHG1234GHJ') verify_log(msg_id = MsgIds.MSG_ID_HD_SERIAL_NUMBER.value, msg = "Serial") @@ -315,7 +320,7 @@ #0x9E00 hd_simulator.cmd_send_hd_request_ui_version() -# verify_log(msg_id = MsgIds.MSG_ID_HD_UI_VERSION_INFO_REQUEST.value, msg = "VersionReq") + verify_log(msg_id = MsgIds.MSG_ID_HD_UI_VERSION_INFO_REQUEST.value, msg = "VersionReq") #DG Broadcast Data @@ -416,11 +421,11 @@ verify_log(msg_id = MsgIds.MSG_ID_DG_SWITCHES_DATA.value, msg = "~DG_Switches_Data") #0xA700 - dg_simulator.cmd_send_dg_general_response(message_id=167, accepted=0, reason=1) + dg_simulator.cmd_send_dg_general_response(message_id=167, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_ALARM_INFO.value, msg = None) #0xAA00 - dg_simulator.cmd_send_dg_general_response(message_id=170, accepted=0, reason=1) + dg_simulator.cmd_send_dg_general_response(message_id=170, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_CONCENTRATE_MIXING_RATIOS_DATA.value, msg = None) #0xA600 @@ -435,13 +440,15 @@ dg_simulator.cmd_send_dg_general_response(message_id=172, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_DG_SCHEDULED_RUNS_INFO.value, msg = "DG scheduled runs info") + #TODO: Msg_Ids need to be update as per patch file #0xAE00 dg_simulator.cmd_send_dg_general_response(message_id=174, accepted=0, reason=1) - verify_log(msg_id = MsgIds.MSG_ID_DG_FILL_MODE_DATA.value, msg = "DG Fill Mode Data") + verify_log(msg_id = MsgIds.MSG_ID_DG_FILL_MODE_DATA.value, msg = None) + #TODO: Msg_Ids need to be update as per patch file #0xAF00 dg_simulator.cmd_send_dg_general_response(message_id=175, accepted=0, reason=1) - verify_log(msg_id = MsgIds.MSG_ID_DG_IDLE_MODE_BAD_FILL_SUB_STATES.value, msg = "DG Idle Mode Bad Fill Sub-states") + verify_log(msg_id = MsgIds.MSG_ID_DG_IDLE_MODE_BAD_FILL_SUB_STATES.value, msg = None) #Alarm @@ -462,17 +469,17 @@ #0x7C00 - hd_simulator.cmd_send_hd_general_response(message_id=124, accepted=0, reason=1) + hd_simulator.cmd_send_hd_general_response(message_id=124, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_ALARM_AUDIO_VOLUME_SET_RESPONSE.value, msg = "AdjustHDAlarmVolume") #0x3F00 - hd_simulator.cmd_send_hd_general_response(message_id=63, accepted=0, reason=1) + hd_simulator.cmd_send_hd_general_response(message_id=63, accepted=1, reason=1) verify_log(msg_id = MsgIds.MSG_ID_ALARM_CONDITION_CLEARED.value, msg = "AlarmCondition") #0x3200 hd_simulator.cmd_send_hd_general_response(message_id=50, accepted=0, reason=1) - verify_log(msg_id = MsgIds.MSG_ID_USER_REQUEST_ALARM_SILENCE.value, msg = "AlarmCondition") + verify_log(msg_id = MsgIds.MSG_ID_USER_REQUEST_ALARM_SILENCE.value, msg = "AlarmSilence") #0x9800 hd_alarm.cmd_send_active_list_response(accept = True, reason = 0, @@ -489,8 +496,8 @@ verify_log(msg_id = MsgIds.MSG_ID_USER_UF_PAUSE_RESUME_RESPONSE.value, msg = "AdjustUFState", param = [1]) #0x1300 - hd_simulator.cmd_send_hd_general_response(message_id=19, accepted=0, reason=1) - verify_log(msg_id = MsgIds.MSG_ID_USER_UF_SETTINGS_CHANGE_RESPONSE.value, msg = None) + hd_simulator.cmd_send_hd_general_response(message_id=19, accepted=1, reason=1) + verify_log(msg_id = MsgIds.MSG_ID_USER_UF_SETTINGS_CHANGE_RESPONSE.value, msg = "AdjustUFEdit") #0x2E00 #parameter mismatch : expected 1 int but 3 integers are logged @@ -639,6 +646,7 @@ verify_log(msg_id = MsgIds.MSG_ID_HD_NO_CART_SELF_TEST_PROGRESS.value, msg = "SelfTestNoCartridge", param = [120,60]) #Pre-Treatment Disposable Installation (sub-mode) + #TODO: Msg_Ids need to be update as per patch file #ID:0xAD00(API is missing, also message id is not present in msgs.py file hd_simulator.cmd_send_hd_general_response(message_id=173, accepted=0, reason=1) verify_log(msg_id = MsgIds.MSG_ID_HD_UI_DISPOSABLE_INSTALLATION_RESPONSE.value, msg = "AdjustDisposablesConfirm", param = [0,1]) @@ -728,7 +736,8 @@ average_venous_pressure = 1.0, device_id = 1, water_sample_test_result = 10) - verify_log(msg_id = MsgIds.MSG_ID_HD_TREATMENT_LOG_DATA_RESPONSE.value, msg = "AdjustTreatmentLog", param =[1,1,1,1,1,1,1,1,1,1,1,1,1.0,1,1,1,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0,1,1.0,1.0,1,1.0,1.0,1.0,0,1,1,1]) + verify_log(msg_id = MsgIds.MSG_ID_HD_TREATMENT_LOG_DATA_RESPONSE.value, msg = "AdjustTreatmentLog", param =[1,1,1,1,1,1,1,1,1,1,1,1,1.0,1,1,1,1.0,1.0,1.0, + 1.0,1.0,1.0,1.0,1.0,1,1.0,1.0,1,1.0,1.0,1.0,0,1,1,1]) #ID:0x9400 hd_simulator.cmd_send_treatment_log_data(blood_flow_rate = 1, dialysate_flow_rate = 1, uf_rate = 1.0,