# -*- coding: utf-8 -*-" import names from dialin.ui import utils from configuration import config, utility from dialin.ui.hd_simulator import HDSimulator from dialin.ui.utils import waitForGUI hd_simulator = HDSimulator() PRE_TREATMENT_STEP= 2 num_of_instructions = 0 SCREEN_OBJ= names.o_PreTreatmentStack_preTreatmentConsumablesStack_PreTreatmentConsumablesStack def verification_of_right_instruction_navigation(): """ The method is used to verify the functionality of the right arrow in the instruction navigation, as well as the visibility of the two arrows """ test.startSection(" rightward instruction navigation") test.verify(not object.exists(names.o_PreTreatmentBase_leftImage_Image), " The left arrow must be missing") for indicator in range(1,num_of_instructions + 1): utils.waitForGUI(1) verification_of_bullet_navigation(indicator) if indicator != num_of_instructions: mouseClick(waitForObject(names.o_PreTreatmentBase_rightImage_Image)) test.verify(not object.exists(names.o_PreTreatmentBase_rightImage_Image), " The right arrow must be missing") test.endSection() def verification_of_left_instruction_navigation(): """ The method is used to verify the functionality of the left arrow in the instruction navigation, as well as the visibility of the two arrows """ test.startSection(" leftward instruction navigation") test.verify(not object.exists(names.o_PreTreatmentBase_rightImage_Image), " The right arrow must be missing") for indicator in range(num_of_instructions, 0, -1): utils.waitForGUI(1) verification_of_bullet_navigation(indicator) if indicator != 1: mouseClick(waitForObject(names.o_PreTreatmentBase_leftImage_Image)) test.verify(not object.exists(names.o_PreTreatmentBase_leftImage_Image), " The left arrow must be missing") test.endSection() def verification_of_bullet_navigation(num): """ This method verifies the properties of the bullets present in the instruction navigation screen """ test.startSection(" instruction bullet verification for screens " + str(num)) for instruction in range(1,num_of_instructions + 1): bullet_children = object.children(waitForObjectExists(utility.get_bullet_object(SCREEN_OBJ,(config.NUM_OF_PRETREATMENT_BULLETS + instruction) - 1))) bullet_circle_color = bullet_children[0].color.name bullet_border_color = bullet_children[0].border.color.name if instruction <= num: test.compare(bullet_circle_color, config.COMPLETE_COLOR) test.compare(bullet_border_color,config.COMPLETE_COLOR) test.log("The bullet " + str(instruction) + " must be a complete bullet") else: test.compare(bullet_circle_color, config.CURRENT_COLOR) test.compare(bullet_border_color,config.INCOMPLETE_COLOR) test.log("The bullet " + str(instruction) + " must be a incomplete bullet") test.endSection() def verification_of_consumable_states_text(): """ Method is to verify the Consumables Self test states' text. """ test.compare(waitForObjectExists(names.o_PreTreatmentBase_Consumables_Self_Test_Text).text ,config.CONSUMABLE_SELF_TEST_TEXT," text must be " + config.CONSUMABLE_SELF_TEST_TEXT) test.compare(waitForObjectExists(names.o_PreTreatmentBase_BiCarb_Pump_Check_Text).text, config.BICARB_PUMP_CHECK_TEXT," text must be " + config.BICARB_PUMP_CHECK_TEXT) test.compare(waitForObjectExists(names.o_PreTreatmentBase_Acid_Pump_Check_Text).text,config.ACID_PUMP_CHECK_TEXT, " text must be from" + config.ACID_PUMP_CHECK_TEXT) test.compare(waitForObjectExists(names.o_PreTreatmentBase_Self_Test_Complete_Text).text,config.SELF_TEST_COMPLETE_TEXT," must be " + config.SELF_TEST_COMPLETE_TEXT ) def verification_of_consumables_states(): """ The method is used to verify the Consumables Self Test states for BiCarb Pump Check Acid Pump Check Self Test Complete. """ test.startSection("Check and busy indicator shouldn't be present") for states in range (config.CONSUMABLE_SELF_TEST_BICARB_PUMP_CHECK_STATE): test.startSection(" consumable self test state = " + str(states)) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=2, water_sample_state=0, consumables_self_test_state=states, no_cartridge_self_test_state=0, installation_state=0, dry_self_test_state=0, prime_state=0, recirculate_state=0, patient_connection_state=0) bicarb_indicator=utility.get_indicators(SCREEN_OBJ,config.BICARB_PUMP_CHECK_TEXT) acid_indicator=utility.get_indicators(SCREEN_OBJ,config.ACID_PUMP_CHECK_TEXT) test.verify(not bicarb_indicator[0].visible, " busy indicator for bicarb pump must not be present") test.verify(not bicarb_indicator[1].visible, " check indicator for bicarb pump must not be present") test.verify(not acid_indicator[0].visible , " busy indicator for acid pump must not be present") test.verify(not acid_indicator[1].visible, " check indicator for acid pump must not be present") test.endSection() test.endSection() utils.waitForGUI(1) test.startSection("Verification of Check and busy indicators") test.log(" consumable self test state = 3") hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=2, water_sample_state=0, consumables_self_test_state=3, no_cartridge_self_test_state=0, installation_state=0, dry_self_test_state=0, prime_state=0, recirculate_state=0, patient_connection_state=0) bicarb_indicator=utility.get_indicators(SCREEN_OBJ,config.BICARB_PUMP_CHECK_TEXT) acid_indicator=utility.get_indicators(SCREEN_OBJ,config.ACID_PUMP_CHECK_TEXT) test.verify(waitForObject(bicarb_indicator[0]).visible,"The Busy indicator for BiCarb Pump must be visible") test.verify(not acid_indicator[0].visible," busy indicator for acid pump must not be present") test.verify(not acid_indicator[1].visible," check indicator for acid pump must not be present") test.log(" consumable self test state = 4") utils.waitForGUI(1) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=2, water_sample_state=0, consumables_self_test_state=4, no_cartridge_self_test_state=0, installation_state=0, dry_self_test_state=0, prime_state=0, recirculate_state=0, patient_connection_state=0) bicarb_indicator=utility.get_indicators(SCREEN_OBJ,config.BICARB_PUMP_CHECK_TEXT) acid_indicator=utility.get_indicators(SCREEN_OBJ,config.ACID_PUMP_CHECK_TEXT) test.verify(waitForObject(bicarb_indicator[1]).visible,"The check indicator for Bicarb Pump must be visible") test.log("BiCarb Pump Check is completed") test.verify(waitForObject(acid_indicator[0]).visible,"The Busy indicator for Acid Pump must be visible") test.log(" consumable self test state = 5") utils.waitForGUI(1) hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=2, water_sample_state=0, consumables_self_test_state=5, no_cartridge_self_test_state=0, installation_state=0, dry_self_test_state=0, prime_state=0, recirculate_state=0, patient_connection_state=0) test.log("Verification for Acid Pump check is done") bicarb_indicator=utility.get_indicators(SCREEN_OBJ,config.BICARB_PUMP_CHECK_TEXT) acid_indicator=utility.get_indicators(SCREEN_OBJ,config.ACID_PUMP_CHECK_TEXT) test.verify(bicarb_indicator[1].visible) test. verify(acid_indicator[1].visible) test.verify(waitForObjectExists(names.o_PreTreatmentBase_Self_Test_Complete_Text).visible) test.log("Self test complete for consumables is done") test.compare(waitForObjectExists(names.o_PreTreatmentBase_Self_Test_Complete_Text).text,config.SELF_TEST_COMPLETE_TEXT," text must be " + config.SELF_TEST_COMPLETE_TEXT ) test.endSection() utils.waitForGUI(1) def main(): global num_of_instructions utils.tstStart(__file__) startApplication(config.AUT_NAME) utility.navigate_to_pretreatment_screen(mode= PRE_TREATMENT_STEP) utility.page_step_indicator_verification(SCREEN_OBJ, PRE_TREATMENT_STEP) test.startSection("verification of instruction navigation ") names.o_bullet_object.pop("occurrence") list_of_bullets = findAllObjects(names.o_bullet_object) num_of_instructions = len(list_of_bullets) - config.NUM_OF_PRETREATMENT_BULLETS test.verify(not waitForObjectExists(names.o_confirm_button_enabled).enabled, " confirm button must not be active") verification_of_right_instruction_navigation() test.verify(waitForObjectExists(names.o_confirm_button_enabled).enabled, " confirm button must be active") verification_of_left_instruction_navigation() test.verify(not waitForObjectExists(names.o_confirm_button_enabled).enabled ," confirm button must not be active") for right_arrow in range(1, num_of_instructions): mouseClick(waitForObject(names.o_PreTreatmentBase_rightImage_Image)) mouseClick(waitForObject(names.o_confirm_button_enabled)) test.endSection() utils.waitForGUI(1) test.startSection("verification of consumable self test ") test.verify(not object.exists(names.o_PreTreatmentBase_Self_Test_Complete_Text),config.SELF_TEST_COMPLETE_TEXT + " must not be present ") verification_of_consumables_states() verification_of_consumable_states_text() test.endSection() utils.tstDone()