# -*- coding: utf-8 -*-" import names from dialin.ui import utils 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.ui.utils import waitForGUI hd_simulator = HDSimulator() contents = [] instructions = [] instruction_textobj = [names.o_instruction_ws_screen_one,names.o_instruction_ws_screen_two,names.o_instruction_ws_screen_three] conf_dict = {} def verify_instruction(): utils.waitForGUI(0.2) with open(utility.INSTRUCTION_CONF_LOCATION, 'r') as conf_file: contents = conf_file.readlines() for line in contents: length =len(line) if line[0] =="[": continue else: conf_data = line.split("=") if length > 2: conf_dict.update([(conf_data[1],conf_data[0])]) instructions.append(conf_dict.get(conf_data[1])) return instructions 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(): 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) instruction_list = verify_instruction() verify_instruction_watersample(instruction_list) waitForGUI(5) test.endSection()