Index: tst_instructions_poc/test.py =================================================================== diff -u -rc8021593406bed7d21e66ecfbec22762f9f0842b -r8d5b89a87fac06a04c2d3fe09971cba40504b54f --- tst_instructions_poc/test.py (.../test.py) (revision c8021593406bed7d21e66ecfbec22762f9f0842b) +++ tst_instructions_poc/test.py (.../test.py) (revision 8d5b89a87fac06a04c2d3fe09971cba40504b54f) @@ -7,7 +7,7 @@ from dialin.ui.hd_simulator import HDSimulator from configuration import config from configuration import utility -from dialin.common.hd_defs import HDOpModes, HDOpSubModes, PreTreatmentSampleWaterStates, PreTreatmentConsumableSelfTestStates, PreTreatmentNoCartSelfTestsStates, PreTreatmentCartridgeInstallStates, PreTreatmentDrySelfTestsStates, PreTreatmentPrimeStates, PreTreatmentRecircStates, PreTreatmentPatientConnectionStates +from dialin.common.hd_defs import HDOpModes, HDOpSubModes, PreTreatmentSubModes, PreTreatmentSampleWaterStates, PreTreatmentConsumableSelfTestStates, PreTreatmentNoCartSelfTestsStates, PreTreatmentCartridgeInstallStates, PreTreatmentDrySelfTestsStates, PreTreatmentPrimeStates, PreTreatmentRecircStates, PreTreatmentPatientConnectionStates from dialin.ui.utils import waitForGUI hd_simulator = HDSimulator() @@ -18,7 +18,8 @@ count_of_instructions = [] title_count_dict = {} conf_dict = {} -obj_names = [names.o_PreTreatmentBase_swipeview_SwipeView,names.o_PreTreatmentBase_swipeview_SwipeView_2] +text_obj_names = [names.o_PreTreatmentBase_swipeview_SwipeView,names.o_PreTreatmentBase_swipeview_SwipeView_2,names.o_preTreatmentDisposablesCartridgeInstallation_swipeview_SwipeView,names.o_preTreatmentDisposablesCartridgeConnetion_swipeview_SwipeView,names.o_preTreatmentDisposablesSalineBag_swipeview_SwipeView,names.o_PreTreatmentBase_swipeview_SwipeView_3] +rightarrow_obj_names = [names.o_preTreatmentConsumablesStack_PreTreatmentBase_TreatmentFlowBase,names.o_preTreatmentDisposablesStack_preTreatmentDisposablesCartridgeInstallation_TreatmentFlowBase,names.o_preTreatmentDisposablesStack_preTreatmentDisposablesCartridgeConnetion_TreatmentFlowBase,names.o_pretreatmentConnectionStack_PreTreatmentBase_TreatmentFlowBase] def get_text_obj(screen_obj,text): """ @@ -29,8 +30,11 @@ names.o_instruction["container"] = screen_obj names.o_instruction["text"] = text return names.o_instruction - +def get_rightarrow_obj(screen_obj): + names.o_right_arrow["container"] = screen_obj + return names.o_right_arrow + def read_data_from_conf_file(): """ This method is used to read the data from Instructions.conf file. @@ -63,6 +67,16 @@ count_of_instructions.append(count) title_count_dict.update(dict(zip(title_list,count_of_instructions))) # return instructions + +# def remove_space_from_instruction(instruction): +# line = instruction.split(".") +# l = line[1] +# test.log(str(l[0])) +# if l[0] == '\\' : +# line[1] = line[1][2:] +# instruction = ". ".join(line) +# test.log(str(instruction)) +# # return txt def verify_instruction(title,index): """ @@ -73,17 +87,21 @@ # test.log(str(instructions)) for i in range((title_count_dict.get(title))): instruction_text = instructions[index] + test.log(str(instruction_text)) +# instruction_text = instruction_text.replace('\\n','') test.log(str(instruction_text)) index += 1 test.log(str(index)) if instruction_text[-1] == " ": instruction_text = instruction_text.rstrip() test.log(str(instruction_text)) - test.compare(str(waitForObject(get_text_obj(obj_names[0],instruction_text)).text),instruction_text, "Instruction from water sample screen should be visible and matched") + test.compare(str(waitForObject(get_text_obj(text_obj_names[0],instruction_text)).text),instruction_text, "Instruction from water sample screen should be visible and matched") if object.exists(names.o_next_button): mouseClick(waitForObject(names.o_next_button)) if object.exists(names.o_fail_button): - mouseClick(waitForObject(names.o_fail_button)) + mouseClick(waitForObject(names.o_fail_button)) + if object.exists(get_rightarrow_obj(rightarrow_obj_names[0])): + mouseClick(waitForObject(get_rightarrow_obj(rightarrow_obj_names[0]))) return index # test.endSection() @@ -112,14 +130,43 @@ index = verify_instruction("Water Sample",index = 0) index = verify_instruction("Water Sample Result",index = index) index = verify_instruction("Water Sample Result Failed",index = index) - hd_simulator.cmd_set_hd_operation_mode_data(HDOpModes.MODE_PRET.value,PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_INSTALL_STATE.value) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_DISINFECT.value, water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value,consumables_self_test_state=PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_INSTALL_STATE.value, no_cartridge_self_test_state=PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value,installation_state=PreTreatmentCartridgeInstallStates.CARTRIDGE_INSTALL_STATE.value, dry_self_test_state=PreTreatmentDrySelfTestsStates.DRY_SELF_TESTS_START_STATE.value, prime_state=PreTreatmentPrimeStates.HD_PRIME_START_STATE.value,recirculate_state=PreTreatmentRecircStates.PRE_TREATMENT_RECIRC_STATE.value, patient_connection_state=PreTreatmentPatientConnectionStates.PATIENT_CONNECTION_STATE.value) - test.log(str(obj_names[0])) - obj_names.pop(0) - test.log(str(obj_names[0])) + text_obj_names.pop(0) index = verify_instruction("Consumables Installation",index = index) -# verify_image_title_water_sample(image_names) + rightarrow_obj_names.pop(0) + + hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.SUBMODE_DG_HEAT_DISINFECT_IN_PROGRESS.value, + water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value, + consumables_self_test_state=PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_INSTALL_STATE.value, + no_cartridge_self_test_state=PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value, + installation_state=PreTreatmentCartridgeInstallStates.CARTRIDGE_INSTALL_STATE.value, + dry_self_test_state=PreTreatmentDrySelfTestsStates.DRY_SELF_TESTS_START_STATE.value, + prime_state=PreTreatmentPrimeStates.HD_PRIME_START_STATE.value, + recirculate_state=PreTreatmentRecircStates.PRE_TREATMENT_RECIRC_STATE.value, + patient_connection_state=PreTreatmentPatientConnectionStates.PATIENT_CONNECTION_STATE.value) + text_obj_names.pop(0) + index = verify_instruction("Cartridge Installation",index = index) + text_obj_names.pop(0) + rightarrow_obj_names.pop(0) + mouseClick(waitForObjectExists(names.o_next_button_cartridge_connection)) + index = verify_instruction("Cartridge Connection",index = index) + text_obj_names.pop(0) + mouseClick(waitForObjectExists(names.o_next_button_cartridge_installation)) + index = verify_instruction("Saline Bag",index = 18) + text_obj_names.pop(0) + rightarrow_obj_names.pop(0) + + hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=PreTreatmentSubModes.HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE.value, + 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) + hd_simulator.cmd_send_pre_treatment_continue_to_treament_response(accepted=True, reason=0) + hd_simulator.cmd_send_uf_treatment_response(accepted = True, reason = 0, volume = 120) + mouseClick(waitForObject(names.o_skip_button)) + index = verify_instruction("Patient Connection",index = index) + hd_simulator.cmd_send_pre_treatment_patient_connection_confirm_response(accepted=True, reason=0) + index = verify_instruction("Start Treatment",index = index) utils.tstDone() \ No newline at end of file