# -*- coding: utf-8 -*- ## # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_pre_treatment_consumables # date 2022/03/14 # author Bhavana Savanth # author Shwetha Policepatil # author Sai Chaitanya Ela # # NOTE: # This test provides verification of consumables screens in the pretreatment steps. # On the first screen, it verifies the page step indicators, instruction navigation on either sides, # visibility of left & right arrows during navigation, states of the bullets on instruction screens, disabling and enabling of continue button. # On the second screen, it verifies the busy and check indicators as well as the text present. # 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 from dialin.common.hd_defs import PreTreatmentConsumableSelfTestStates hd_simulator = HDSimulator() PRE_TREATMENT_STEP= 2 num_of_instructions = 0 SCREEN_OBJ= names.o_PreTreatmentStack_preTreatmentConsumablesStack_PreTreatmentConsumablesStack def verify_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): verify_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 verify_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): verify_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 verify_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 verify_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 verify_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() 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") 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") 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() def main(): global num_of_instructions utils.tstStart(__file__) startApplication(config.AUT_NAME) utility.navigate_to_pretreatment_screen(mode= PRE_TREATMENT_STEP) utility.verify_page_step_indicator(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") verify_right_instruction_navigation() test.verify(waitForObjectExists(names.o_confirm_button_enabled).enabled, " confirm button must be active") verify_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() 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 ") verify_consumables_states() verify_consumable_states_text() test.endSection() utils.tstDone()