Index: tst_instructions_poc/test.py =================================================================== diff -u -rd9160e9049fec8daa9ff8eabd5dc03ea839793a7 -r7102ce1220edcd2ae6a08e13f8e815528dba654f --- tst_instructions_poc/test.py (.../test.py) (revision d9160e9049fec8daa9ff8eabd5dc03ea839793a7) +++ tst_instructions_poc/test.py (.../test.py) (revision 7102ce1220edcd2ae6a08e13f8e815528dba654f) @@ -3,49 +3,56 @@ import names from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator -from dialin.ui.dg_simulator import DGSimulator 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.ui.utils import waitForGUI hd_simulator = HDSimulator() -YES = 'Y' +contents = [] +instructions = [] +instruction_textobj = [names.o_instruction_one,names.o_instruction_two,names.o_instruction_three] +conf_dict = {} def verify_instruction(): utils.waitForGUI(0.2) - f = open(utility.INSTRUCTION_CONF_LOCATION, 'r') - answer = {} - for line in f: - (k, v) = line.strip().split('^') - answer[k.strip()] = v.strip() - test.log(str(answer)) - f.close() - + with open(utility.INSTRUCTION_CONF_LOCATION, 'r') as f: + contents = f.readlines() + for i in contents: + length =len(i) + if i[0] =="[": + continue + else: + p = i.split("=") + if length > 2: + conf_dict.update([(p[1],p[0])]) + instructions.append(conf_dict.get(p[1])) + return instructions - if msg_id in msg_defs.ACK_NOT_REQUIRED: - ack = None - message_extracted = utility.get_current_log_details(message_ack = ack, message_text = msg) - if ack == YES: - test.verify(config.ACK_REQ_STATUS in message_extracted, "ack request is verified") - test.verify(config.ACK_BAK_STATUS in message_extracted, "ack back is verified") - message_id_hex = builtins.hex(builtins.int(msg_id)) - message_id_str = builtins.str(message_id_hex) - test.log(str(message_extracted)) - test.log(message_id_str) - test.verify(message_id_str in message_extracted, "message ID is verified") - if param != None: - test.verify(param in message_extracted, "message and its parameters are verified") - test.log(str(message_extracted)) - +def verify_instruction_watersample(instruction_list): + index = 0 +# test.log(str(instruction_list)) + for text_obj in instruction_textobj: + instruction_text = instruction_list[index] +# test.log(str(instruction_text)) + if instruction_text[-1] == " ": + instruction_text = instruction_text.rstrip() + test.compare(str(waitForObject(text_obj).text),instruction_text, "Instruction from water sample screen should be visible and matched") + index += 1 + 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)) + def main(): - test.log("Hello World") startApplication(config.AUT_NAME) test.startSection("Verify the water sample instruction") hd_simulator.cmd_set_hd_operation_mode_data(HDOpModes.MODE_PRET.value,PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=HDOpSubModes.SUBMODE_WAIT_FOR_TREATMENT.value, water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_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) - verify_instruction() + prime_state=PreTreatmentPrimeStates.HD_PRIME_START_STATE.value,recirculate_state=PreTreatmentRecircStates.PRE_TREATMENT_RECIRC_STATE.value, patient_connection_state=PreTreatmentPatientConnectionStates.PATIENT_CONNECTION_STATE.value) + instruction_list = verify_instruction() + verify_instruction_watersample(instruction_list) + waitForGUI(5) test.endSection() \ No newline at end of file