# -*- 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_post_treatment_disconnection # date 2022/06/06 # author Amol Shinde # author Shweta POlicepatil # author Amrita Debnath # NOTE: # This test contradicts verification of post treatment section. import names import builtins 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, TreatmentStates, TreatmentEndStates, TreatmentRinsebackStates, TreatmentRecircStates hd_simulator = HDSimulator() SCREEN_OBJ1 = names.o_EndTreatmentRinsebackStack_EndTreatmentRinsebackInit_EndTreatmentRinsebackInit SCREEN_OBJ2 = names.o_EndTreatmentRecirculateStack_EndTreatmentBase_EndTreatmentBase SCREEN_OBJ3 = names.o_EndTreatmentEndStack_EndTreatmentBase_EndTreatmentBase NUM_OF_END_TREATMENT_BULLETS = ['SCREEN_OBJ1','SCREEN_OBJ2','SCREEN_OBJ3','SCREEN_OBJ4'] num_of_instructions = 3 rightarrow_obj_names = [names.o_EndTreatmentRinsebackInit_rightImage_Image] leftarrow_obj_names = [names.o_EndTreatmentRinsebackInit_leftImage_Image] def verify_bullet_navigation(num, num_of_instructions, screen_obj): """ Method to verify status of bullets based on number of instruction screen @param num - (int) number of indicator @param num_of_instructions- (int) count the number of instructions @param object - screen_obj - (str) Screen object """ test.startSection("instruction bullet verification for screens") for instruction in range(1, num_of_instructions): bullet_children = object.children(waitForObjectExists(utility.get_bullet_object(screen_obj,(0 + 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(str(instruction) + " Complete bullet") else: test.compare(bullet_circle_color, config.CURRENT_COLOR) test.compare(bullet_border_color,config.INCOMPLETE_COLOR) test.log(str(instruction) + " Incomplete bullet") test.endSection() def verification_of_recirculate_state(): """ Method to verify Treatment Recirculate states """ test.startSection("verifying Treatment Recirculate state screens") test.startSection("verifying Treatment Recirculate Recirculate state screens") hd_simulator.cmd_set_treatment_states_data(sub_mode = TreatmentStates.TREATMENT_RECIRC_STATE.value , uf_state = TreatmentStates.TREATMENT_START_STATE.value, saline_state = TreatmentStates.TREATMENT_START_STATE.value, heparin_state = TreatmentStates.TREATMENT_START_STATE.value,rinseback_state= TreatmentStates.TREATMENT_START_STATE.value, recirculate_state = TreatmentRecircStates.TREATMENT_RECIRC_RECIRC_STATE.value, blood_prime_state = TreatmentStates.TREATMENT_START_STATE.value,treatment_end_state = TreatmentStates.TREATMENT_START_STATE.value, treatment_stop_state = TreatmentStates.TREATMENT_START_STATE.value, dialysis_state = TreatmentStates.TREATMENT_START_STATE.value) test.compare(str(waitForObject(names.o_recirculate_text).text),config.RECIRCULATE_TEXT, "Recirculate text must be {}".format(config.RECIRCULATE_TEXT)) test.compare(str(waitForObjectExists(names.o_EndTreatmentBase_RECONNECT_Text).text), config.RECONNECT_BUTTON_TEXT, "Reconnect button text must be {}".format(config.RECONNECT_BUTTON_TEXT)) test.verify(waitForObjectExists(names.o_EndTreatmentBase_RECONNECT_Text).enabled, "Reconnect button must be active") mouseClick(waitForObject(names.o_EndTreatmentBase_RECONNECT_Text)) verify_right_instruction_in_recirculate_state(num_of_instructions) verify_left_instruction_in_recirculate_state(num_of_instructions) verify_right_instruction_in_recirculate_state(num_of_instructions) test.endSection() test.startSection("verifying Treatment Recirculate stopped state screens") hd_simulator.cmd_set_treatment_states_data(sub_mode = TreatmentStates.TREATMENT_RECIRC_STATE.value , uf_state = TreatmentStates.TREATMENT_START_STATE.value, saline_state = TreatmentStates.TREATMENT_START_STATE.value, heparin_state = TreatmentStates.TREATMENT_START_STATE.value, rinseback_state= TreatmentRinsebackStates.RINSEBACK_STOP_INIT_STATE.value, recirculate_state = TreatmentRecircStates.TREATMENT_RECIRC_STOPPED_STATE.value, blood_prime_state = TreatmentStates.TREATMENT_START_STATE.value,treatment_end_state = TreatmentStates.TREATMENT_START_STATE.value, treatment_stop_state = TreatmentStates.TREATMENT_START_STATE.value, dialysis_state = TreatmentStates.TREATMENT_START_STATE.value) test.compare(str(waitForObject(names.o_EndTreatmentBase_Reconnect_Text).text),config.RECONNECT_TEXT, "Reconnect text must be {}".format(config.RECONNECT_TEXT)) test.endSection() test.endSection() def verify_right_instruction_in_recirculate_state(num_of_instructions): """. Method to verify right arrow functionality @param num_of_instructions - (int) count the number of instructions """ test.startSection("verifying right arrow functionality for recirculate state Screen") utility.verify_missing_object(names.o_EndTreatmentBase_leftImage_Image) for indicator in range(1, num_of_instructions, 1): verify_bullet_navigation(indicator, num_of_instructions, SCREEN_OBJ2) if indicator != num_of_instructions: mouseClick(waitForObject(names.o_EndTreatmentBase_rightImage_Image)) test.compare(str(waitForObjectExists(names.o_recirculate_text).text), config.RECIRCULATE_TEXT, "Recirculate text must be {}".format(config.RECIRCULATE_TEXT)) utility.verify_missing_object(names.o_EndTreatmentBase_rightImage_Image) test.endSection() def verify_left_instruction_in_recirculate_state(num_of_instructions): """ Method to verify left arrow functionality for recirculate state screens """ test.startSection("verifying left arrow functionality for recirculate state screens") utility.verify_missing_object(names.o_EndTreatmentBase_rightImage_Image) for indicator in range(num_of_instructions, 0, -1): verify_bullet_navigation(indicator, num_of_instructions, SCREEN_OBJ2) if indicator != 1: mouseClick(waitForObject(names.o_EndTreatmentBase_leftImage_Image)) test.compare(str(waitForObjectExists(names.o_recirculate_text).text), config.RECIRCULATE_TEXT, "Recirculate text must be {}".format(config.RECIRCULATE_TEXT)) utility.verify_missing_object(names.o_EndTreatmentBase_leftImage_Image) test.endSection() def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) verification_of_recirculate_state()