Index: tst_cloud_sync - treatment_screen/test.py =================================================================== diff -u -r2c475e06cf2d9f156b3853b547ddaec2ea102913 -rfbc00387efe0d10dea9ac41d5cde7e5c84716528 --- tst_cloud_sync - treatment_screen/test.py (.../test.py) (revision 2c475e06cf2d9f156b3853b547ddaec2ea102913) +++ tst_cloud_sync - treatment_screen/test.py (.../test.py) (revision fbc00387efe0d10dea9ac41d5cde7e5c84716528) @@ -17,21 +17,24 @@ import csv +import names import os from dialin.ui.hd_simulator import HDSimulator from dialin.ui import utils from configuration import utility from configuration import config +from dialin.common.hd_defs import HDOpModes, PreTreatmentSubModes, PostTreatmentStates from dialin.utils.conversions import float_to_bytearray, integer_to_bytearray,unsigned_integer_to_bytearray hd_simulator = HDSimulator() - +POST_TREATMENT_INSTRUCTION_COUNT = 2 CLOUD_SYNC_LOG_LOCATION = '/home/denali/Desktop/sd-card/cloudsync/' MESSAGE_1 = '1639391827,1,0,2008,1,Tx_code' + def get_cloud_sync_input_file(): """ This function is the handler for getting file from log folder. @@ -45,16 +48,23 @@ except: return False -def verify_ui_response(): + +def verify_code_from_treatment_response(): """ This function is used for verify the treatment log changes """ hd_simulator.cmd_send_hd_operation_mode(op_mode=HDOpModes.MODE_POST.value, sub_mode=PostTreatmentStates.HD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE.value) - for indicator in range(1, num_of_instructions, 1): - if indicator != num_of_instructions: + for indicator in range(1, POST_TREATMENT_INSTRUCTION_COUNT, 1): + if indicator != POST_TREATMENT_INSTRUCTION_COUNT: mouseClick(waitForObject(names.o_patient_Disconnection_right_arrow)) + utils.waitForGUI(1.5) + mouseClick(names.o_patientDisconnectionConfirm_CONFIRM_Text) + message_text = MESSAGE_1.split(',') + + utils.waitForGUI(3) #delay for fetching the effect + text_code_label = str(waitForObjectExists(names.o_treatmentReviewConfirm_Code_Tx_code_Label).text) + test.compare(message_text[5], text_code_label.split(': ')[1], "CS2UI message should be verified") - snooze(2) @@ -101,7 +111,7 @@ Through this method file reader act as a handler and it will write custom messages into {current_date}_out.buf """ - with open(location, "a") as filereader: + with open(location, "w") as filereader: filereader.write(message) utils.waitForGUI(5) @@ -117,10 +127,14 @@ utils.waitForGUI(1.5) cloud_out_log = get_cloud_sync_output_file() - set_data_in_cloud_sync_output_file(cloud_out_log, MESSAGE_1) - verify_ui_response() + set_data_in_cloud_sync_output_file(cloud_out_log, MESSAGE_CODE_DISPLAY) + verify_code_from_treatment_response() + + set_data_in_cloud_sync_output_file(cloud_out_log, MESSAGE_2) verify_log_response() + + utils.tstDone()