# -*- 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 hd_simulator = HDSimulator() SCREEN_OBJ1 = names.o_EndTreatmentRinsebackStack_EndTreatmentRinsebackInit_EndTreatmentRinsebackInit SCREEN_OBJ2 = names.o_EndTreatmentRecirculateStack_EndTreatmentBase_EndTreatmentBase SCREEN_OBJ3 = names.o_EndTreatmentEndStack_EndTreatmentBase_EndTreatmentBase SCREEN_OBJ4 = names.o_EndTreatmentEndStack_EndTreatmentBase_EndTreatmentBase NUM_OF_END_TREATMENT_BULLETS = ['SCREEN_OBJ1','SCREEN_OBJ2','SCREEN_OBJ3','SCREEN_OBJ4'] num_of_instructions = 3 # num_of_instructions = {"NUM_OF_END_TREATMENT_RINSE_BACK_BULLETS" : 3, # "NUM_OF_END_TREATMENT_RECIRCULATE_BULLETS": 3, # "NUM_OF_TREATMENT_END_STATE_BULLETS" : 0} rightarrow_obj_names = [names.o_EndTreatmentRinsebackInit_rightImage_Image] leftarrow_obj_names = [names.o_EndTreatmentRinsebackInit_leftImage_Image] # def verify_end_treatment_page_step_title(screen_obj, page_step_title): # """ # Method to verify the Page Step titles [the object which is in down of the screen which indicates the steps passed, current, remained] # @param page_step_title : (int) indicates the Current post-treatment step # """ # # test.startSection("verification of page step indicators") # for page in range(config.END_TREATMENT_PAGE_STEP_TITLES): # bullet_children = object.children(waitForObjectExists(utility.get_bullet_object(screen_obj, page))) # bullet_circle_color = bullet_children[0].color.name # #test.log() # bullet_border_color = bullet_children[0].border.color.name # step_title = waitForObjectExists(utility.get_text_object(screen_obj, config.END_TREATMENT_PAGE_STEP_TITLES[page])) # def get_rightarrow_obj(screen_obj): """ To obtain object for right arrow based on container @param (str) screen_obj: provides the container @returns a real name object """ names.o_right_arrow["container"] = screen_obj return names.o_right_arrow 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_OBJ1,num_of_instructions- 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 navigation_to_end_treatment(): """ Method to navigate to End-Treatment screens """ hd_simulator.cmd_send_hd_operation_mode(op_mode = HDOpModes.MODE_TREA.value , sub_mode=HDOpSubModes.SUBMODE_START.value) hd_simulator.cmd_set_treatment_states_data(sub_mode = TreatmentStates.TREATMENT_RINSEBACK_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 = TreatmentStates.TREATMENT_START_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) # def navigation_to_post_treatment(): # """ # Method for navigating to post treatment disconnection submode. # """ # hd_simulator.cmd_send_hd_operation_mode(op_mode = HDOpModes.MODE_POST.value, sub_mode=PostTreatmentStates.HD_POST_TREATMENT_PATIENT_DISCONNECTION_STATE.value) # if object.exists(get_rightarrow_obj(rightarrow_obj_names[0])): # mouseClick(waitForObject(get_rightarrow_obj(rightarrow_obj_names[0]))) # elif object.exists(get_rightarrow_obj(rightarrow_obj_names[0])): # mouseClick(waitForObject(get_rightarrow_obj(rightarrow_obj_names[0]))) def verify_right_instruction_in_end_treatment_screens(): """. Method to verify right arrow functionality for End - treatment screens """ test.startSection("verifying right arrow functionality Rinse back screens") hd_simulator.cmd_set_treatment_states_data(sub_mode = TreatmentStates.TREATMENT_RINSEBACK_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 = TreatmentStates.TREATMENT_START_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) utility.verify_missing_object(leftarrow_obj_names) for indicator in range(1, num_of_instructions, 3): verify_bullet_navigation(indicator, num_of_instructions,SCREEN_OBJ1 ) if indicator != num_of_instructions: mouseClick(waitForObjectExists(names.o_EndTreatmentRinsebackInit_rightImage_Image)) test.compare(str(waitForObjectExists(names.o_rinse_back_text).text), config.RINSE_BACK_SETUP_TEXT, "Rinseback Setup text must be {}".format(config.RINSE_BACK_SETUP_TEXT)) utility.verify_missing_object(rightarrow_obj_names) test.endSection() test.startSection("verifying right arrow functionality Recirculate 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 = TreatmentStates.TREATMENT_START_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) utility.verify_missing_object(leftarrow_obj_names) for indicator in range(1, num_of_instructions, 3): verify_bullet_navigation(indicator,num_of_instructions,SCREEN_OBJ2) if indicator != num_of_instructions: mouseClick(waitForObjectExists(names.o_EndTreatmentRinsebackInit_rightImage_Image)) test.compare(str(waitForObjectExists(leftarrow_obj_names).text), config.RECIRCULATE_TEXT, "Recirculate text must be {}".format(config.RECIRCULATE_TEXT)) utility.verify_missing_object(names.o_EndTreatmentRinsebackInit_rightImage_Image) test.endSection() def verify_left_instruction_in_end_treatment_screens(): """ Method to verify left arrow functionality for End - treatment screens """ test.startSection("verifying left arrow functionality for End- treatment Rinse back screens") hd_simulator.cmd_set_treatment_states_data(sub_mode = TreatmentStates.TREATMENT_RINSEBACK_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 = TreatmentStates.TREATMENT_START_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) utility.verify_missing_object(rightarrow_obj_names) for indicator in range(num_of_instructions, 0, -1): verify_bullet_navigation(indicator, num_of_instructions) if indicator != 1: mouseClick(waitForObject(names.o_EndTreatmentRinsebackInit_leftImage_Image)) test.compare(str(waitForObjectExists(leftarrow_obj_names).text), config.RINSE_BACK_SETUP_TEXT, "Rinseback Setup text must be {}".format(config.RINSE_BACK_SETUP_TEXT)) utility.verify_missing_object(leftarrow_obj_names) test.endSection() test.startSection("verifying left arrow functionality for End - treatment Recirculate 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 = TreatmentStates.TREATMENT_START_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) utility.verify_missing_object(rightarrow_obj_names) for indicator in range(num_of_instructions, 0, -1): verify_bullet_navigation(indicator,num_of_instructions) if indicator != 1: mouseClick(waitForObject(leftarrow_obj_names)) test.compare(str(waitForObjectExists(leftarrow_obj_names).text), config.RECIRCULATE_TEXT, "Recirculate text must be {}".format(config.RECIRCULATE_TEXT)) utility.verify_missing_object(leftarrow_obj_names) test.endSection() def verify_end_treatment_state(): """ Method to verify End treatment states """ test.startSection("verifying right arrow functionality End treatment state screens") hd_simulator.cmd_set_treatment_states_data(sub_mode = TreatmentStates.TREATMENT_END_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 = TreatmentStates.TREATMENT_START_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(waitForObjectExists(names.leftarrow_obj_names).text), config.END_TREATMENT_COMPLETE_STATE_TEXT, "End treatment complete text must be {}".format(config.END_TREATMENT_COMPLETE_STATE_TEXT)) #test.compare(str(waitForObjectExists(names.leftarrow_obj_names).text), config.END_TREATMENT_COMPLETE_PAUSED_STATE_TEXT, "End treatment complete paused text must be {}".format(config.END_TREATMENT_COMPLETE_PAUSED_STATE_TEXT)) utility.verify_missing_object(names.leftarrow_obj_names) test.endSection() def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) navigation_to_end_treatment() verify_right_instruction_in_end_treatment_screens() verify_left_instruction_in_end_treatment_screens() verify_end_treatment_state()