Index: shared/scripts/configuration/config.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -r05fb0b11e3823a97789661f4d7e598808b137b1a --- shared/scripts/configuration/config.py (.../config.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/configuration/config.py (.../config.py) (revision 05fb0b11e3823a97789661f4d7e598808b137b1a) @@ -32,3 +32,13 @@ BLOOD_PRIMING_TEXT = "Blood Priming" SALINE_UNIT = "mL" BLOOD_PRIMING_DEFAULT_VALUE = "0 mL" + +CURRENT_COLOR = '#000000' +COMPLETE_COLOR= '#000000' +ENABLED_COLOR = '#fcfcfc' +INCOMPLETE_COLOR = '#607a91' +END_TREATMENT_SCREEN = ["Rinseback Setup", "Recirculate", "Treatment Complete", "Treatment Paused State"] +RINSE_BACK_SETUP_TEXT = "Rinseback Setup" +RECIRCULATE_TEXT = "Recirculate" +END_TREATMENT_COMPLETE_STATE_TEXT = "Treatment Complete" +END_TREATMENT_COMPLETE_PAUSED_STATE_TEXT = "Treatment Paused State" \ No newline at end of file Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -r05fb0b11e3823a97789661f4d7e598808b137b1a --- shared/scripts/configuration/utility.py (.../utility.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 05fb0b11e3823a97789661f4d7e598808b137b1a) @@ -12,7 +12,7 @@ # ############################################################################ - +import names import sys import test import squish @@ -108,3 +108,28 @@ raise LookupError("zone object is not in view to the user after " + \ "trying 100 times") + +def get_bullet_object(screen_obj, num): + """ + To obtain a bullet object based on occurrence provided. + @param screen_obj: provides the container on which the bullet must be present + @param num: provides the occurrence value + @returns a real name object + """ + names.o_bullet_object["container"] = screen_obj + names.o_bullet_object["occurrence"] = num + 1 + return names.o_bullet_object + +def verify_missing_object(object_to_check): + """ + Method to verify the given object is invisible or is not present on the screen + @param object_to_check: the object whose invisibility must be verified + """ + try: + squish.testSettings.objectNotFoundDebugging = False + squish.waitForObject(object_to_check,3000) + test.fail("Given object should not be present initially") + except LookupError as _: + test.passes("object is not present as expected") + + squish.testSettings.objectNotFoundDebugging = True \ No newline at end of file Index: shared/scripts/names.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -r05fb0b11e3823a97789661f4d7e598808b137b1a --- shared/scripts/names.py (.../names.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/names.py (.../names.py) (revision 05fb0b11e3823a97789661f4d7e598808b137b1a) @@ -48,6 +48,20 @@ o_cumulative_fluid_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Cumulative Delivered", "type": "Text", "unnamed": 1, "visible": True} - - - +#end -treatment +o_text_object = {"type": "Text", "unnamed": 1, "visible": True} +o_bullet_object = {"type": "StepBullet", "unnamed": 1, "visible": True} +o_EndTreatmentRinsebackStack_EndTreatmentRinsebackStack = {"container": o_Gui_MainView, "objectName": "_EndTreatmentRinsebackStack", "type": "EndTreatmentRinsebackStack", "visible": True} +o_EndTreatmentRinsebackStack_EndTreatmentRinsebackInit_EndTreatmentRinsebackInit = {"container": o_EndTreatmentRinsebackStack_EndTreatmentRinsebackStack, "objectName": "_EndTreatmentRinsebackInit", "type": "EndTreatmentRinsebackInit", "visible": True} +o_EndTreatmentRinsebackInit_rightImage_Image = {"container": o_EndTreatmentRinsebackStack_EndTreatmentRinsebackInit_EndTreatmentRinsebackInit, "id": "_rightImage", "source": "qrc:/images/iArrowRight", "type": "Image", "unnamed": 1, "visible": True} +o_EndTreatmentRinsebackInit_leftImage_Image = {"container": o_EndTreatmentRinsebackStack_EndTreatmentRinsebackInit_EndTreatmentRinsebackInit, "id": "_leftImage", "source": "qrc:/images/iArrowLeft", "type": "Image", "unnamed": 1, "visible": True} +o_EndTreatmentRinsebackStack_EndTreatmentRinsebackStack = {"container": o_Gui_MainView, "objectName": "_EndTreatmentRinsebackStack", "type": "EndTreatmentRinsebackStack", "visible": True} +o_EndTreatmentRinsebackStack_EndTreatmentRinsebackInit_EndTreatmentRinsebackInit = {"container": o_EndTreatmentRinsebackStack_EndTreatmentRinsebackStack, "objectName": "_EndTreatmentRinsebackInit", "type": "EndTreatmentRinsebackInit", "visible": True} +o_EndTreatmentRecirculateStack_EndTreatmentRecirculateStack = {"container": o_Gui_MainView, "objectName": "_EndTreatmentRecirculateStack", "type": "EndTreatmentRecirculateStack", "visible": True} +o_EndTreatmentRecirculateStack_EndTreatmentBase_EndTreatmentBase = {"container": o_EndTreatmentRecirculateStack_EndTreatmentRecirculateStack, "objectName": "_EndTreatmentBase", "type": "EndTreatmentBase", "visible": True} +o_rinse_back_text = {"container": o_EndTreatmentRinsebackStack_EndTreatmentRinsebackInit_EndTreatmentRinsebackInit, "text": "Rinseback Setup", "type": "Text", "unnamed": 1, "visible": True} +o_recirculate_text = {"container": o_EndTreatmentRecirculateStack_EndTreatmentBase_EndTreatmentBase, "text": "Recirculate", "type": "Text", "unnamed": 1, "visible": True} +o_EndTreatmentEndStack_EndTreatmentEndStack = {"container": o_Gui_MainView, "objectName": "_EndTreatmentEndStack", "type": "EndTreatmentEndStack", "visible": True} +o_EndTreatmentEndStack_EndTreatmentBase_EndTreatmentBase = {"container": o_EndTreatmentEndStack_EndTreatmentEndStack, "objectName": "_EndTreatmentBase", "type": "EndTreatmentBase", "visible": True} +o_end_treatment_complete_state = {"container": o_EndTreatmentEndStack_EndTreatmentBase_EndTreatmentBase, "text": "Treatment Complete", "type": "Text", "unnamed": 1, "visible": True} +o_end_treatment_complete_paused_state = {"container": o_EndTreatmentEndStack_EndTreatmentBase_EndTreatmentBase, "text": "Treatment Complete Paused", "type": "Text", "unnamed": 1, "visible": True} \ No newline at end of file Index: tst_end_treatment/test.py =================================================================== diff -u --- tst_end_treatment/test.py (revision 0) +++ tst_end_treatment/test.py (revision 05fb0b11e3823a97789661f4d7e598808b137b1a) @@ -0,0 +1,201 @@ +# -*- 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() +