Index: shared/scripts/configuration/config.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -r28eaad74b094db5832e72f1d66f19e534045393f --- shared/scripts/configuration/config.py (.../config.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/configuration/config.py (.../config.py) (revision 28eaad74b094db5832e72f1d66f19e534045393f) @@ -32,3 +32,22 @@ BLOOD_PRIMING_TEXT = "Blood Priming" SALINE_UNIT = "mL" BLOOD_PRIMING_DEFAULT_VALUE = "0 mL" + +#tst_pretreatment_screens +PRE_TREATMENT_SCREENS = ["Create" , "Sample" , "Consumables" , "Disposables" , "Prime" , "Ultrafiltration" , "BP/HR" , "Connection" , "Start"] +NUM_OF_PRETREATMENT_BULLETS = len(PRE_TREATMENT_SCREENS) + +#tst_pretreatment_screens color palettes +CURRENT_COLOR = '#000000' +COMPLETE_COLOR= '#4290ec' +ENABLED_COLOR = '#fcfcfc' +INCOMPLETE_COLOR = '#607a91' + +CONSUMABLE_SELF_TEST_TEXT = "Consumables Self Test" +BICARB_PUMP_CHECK_TEXT = "BiCarb Pump Check" +ACID_PUMP_CHECK_TEXT = "Acid Pump Check" +SELF_TEST_COMPLETE_TEXT = "Self Test Complete!" + +CONSUMABLE_SELF_TEST_BICARB_PUMP_CHECK_STATE = 3 + + Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -r28eaad74b094db5832e72f1d66f19e534045393f --- shared/scripts/configuration/utility.py (.../utility.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 28eaad74b094db5832e72f1d66f19e534045393f) @@ -12,52 +12,16 @@ # ############################################################################ - -import sys +import object +import names import test import squish from configuration import config from builtins import int as pyInt +from dialin.ui.hd_simulator import HDSimulator +hd_simulator = HDSimulator() -def start_application(app_name): - """ - Function to start application and verify application status [running] - If application does not start or running status is false, test stops - Argument: - @param app_name : (str) - Name of the application - @param app_executable : (str) - Actual application - @return: handle for the application if the application is in running state, - or error (exist the application) - """ - counter = 0 - while True: - try: - counter += 1 - test.log("Starting {}".format(app_name)) - squish.startApplication(app_name) - if counter == 1: - test.log("Application launched at the "+str(counter)+" st try.") - elif counter == 2: - test.log("Application launched at the "+str(counter)+" nd try.") - elif counter == 3: - test.log("Application launched at the "+str(counter)+" rd try.") - else: - test.log("Application launched at the "+str(counter)+" th try.") - break - except RuntimeError: - if counter == 1: - test.log("Application failed to launch after "+str(counter)+" try - Please refer logs") - elif counter == 20: - test.log("Exiting after "+str(counter)+ " tries..") - sys.exit(1) - else: - test.log("Application failed to launch after "+str(counter)+ " tries - Please refer logs") - except: - logErrorDetails("Failed to start the application") - sys.exit(1) - - def check_if_object_is_within_the_container(obj=None, container=None): """ check if an object is inside a container @@ -108,3 +72,92 @@ raise LookupError("zone object is not in view to the user after " + \ "trying 100 times") + + +def navigate_to_pretreatment_screen(mode): + + """ + Method to navigate to sub mode under pre-treatment screen + @param mode - (int) pre treatment state + """ + hd_simulator.cmd_set_hd_operation_mode_data(5,0) + + hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=mode, water_sample_state=0,consumables_self_test_state=0, + no_cartridge_self_test_state=0,installation_state=0, dry_self_test_state=0, + prime_state=0,recirculate_state=0, patient_connection_state=0) + +def page_step_indicator_verification(screen_obj, pre_treatment_step): + """ + Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] + @param pre_treatment_step : indicates the Current pre-treatment step + """ + + test.startSection("verification of page step indicators") + for page in range(len(config.PRE_TREATMENT_SCREENS)): + bullet_children = object.children(squish.waitForObjectExists(get_bullet_object(screen_obj, page))) + bullet_circle_color = bullet_children[0].color.name + bullet_border_color = bullet_children[0].border.color.name + step_title = squish.waitForObjectExists(get_text_object(screen_obj, config.PRE_TREATMENT_SCREENS[page])) + + if page < pre_treatment_step: + test.log("To verify the step indicator of the completed pre-treatment screen " + config.PRE_TREATMENT_SCREENS[page]) + test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) + test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current) + test.compare(bullet_circle_color, config.COMPLETE_COLOR, " the bullet color must be " + str(config.COMPLETE_COLOR)) + test.compare(bullet_border_color, config.COMPLETE_COLOR," the bullet border color must be " + str(config.COMPLETE_COLOR)) + test.compare(step_title.color.name, config.ENABLED_COLOR, " the text color must be " + str(config.ENABLED_COLOR)) + + elif page == pre_treatment_step: + test.log("To verify the step indicators of the current pre-treatment screen " + config.PRE_TREATMENT_SCREENS[page]) + test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current) + test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) + test.compare(bullet_circle_color,config.CURRENT_COLOR," the bullet color must be " + str(config.CURRENT_COLOR)) + test.compare(bullet_border_color,config.COMPLETE_COLOR, " the bullet border color must be " + str(config.COMPLETE_COLOR)) + test.compare(step_title.color.name,config.ENABLED_COLOR, " the text color must be " + str(config.ENABLED_COLOR)) + test.verify(step_title.font.bold, " the current text must be in bold") + + else: + test.log("To verify the step indicators of the remaining pre-treatment screen " + config.PRE_TREATMENT_SCREENS[page]) + test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current,) + test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete,) + test.compare(step_title.color.name,config.INCOMPLETE_COLOR, " the text color must be " + str(config.INCOMPLETE_COLOR)) + test.compare(bullet_circle_color,config.CURRENT_COLOR," the bullet color must be " + str(config.CURRENT_COLOR)) + test.compare(bullet_border_color,config.INCOMPLETE_COLOR, " the bullet border color must be " + str(config.INCOMPLETE_COLOR)) + test.endSection() + +def get_text_object(screen_obj, txt): + """ + To obtain a text object based on text provided + @param screen_obj: provides the container on which the txt must be present + @returns a real name object + """ + names.o_text_object["container"] = screen_obj + names.o_text_object["text"] = txt + return names.o_text_object + + +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 get_indicators(screen_obj, txt): + """ + Verifying the busy indicators for BiCarb Pump Check and Acid Pump Check. + indicator object of expected txt + @param step - (str) expected txt + @return indicators - (obj) list of busy and check indicator + """ + parent_obj = object.parent(squish.waitForObjectExists(get_text_object(screen_obj,txt))) + children_obj = object.children(parent_obj) + indicator_parent = children_obj[2] + indicators = object.children(indicator_parent) + return indicators + + Index: shared/scripts/names.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -r28eaad74b094db5832e72f1d66f19e534045393f --- shared/scripts/names.py (.../names.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/names.py (.../names.py) (revision 28eaad74b094db5832e72f1d66f19e534045393f) @@ -48,6 +48,25 @@ o_cumulative_fluid_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Cumulative Delivered", "type": "Text", "unnamed": 1, "visible": True} +# Pre treatment Consumables +o_PreTreatmentStack_PreTreatmentStack = {"container": o_Gui_MainView, "objectName": "_PreTreatmentStack", "type": "PreTreatmentStack", "visible": True} +o_PreTreatmentStack_PreTreatmentConsumblesStack_PreTreatmentConsumablesStack = {"container": o_PreTreatmentStack_PreTreatmentStack, "objectName": "_PreTreatmentConsumblesStack", "type": "PreTreatmentConsumablesStack", "visible": True} +o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase = {"container": o_PreTreatmentStack_PreTreatmentConsumblesStack_PreTreatmentConsumablesStack, "objectName": "_PreTreatmentBase", "type": "TreatmentFlowBase", "visible": True} +o_confirm_button_disabled={"container": o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase, "gradient": 0, "objectName": "_confirmButton", "type": "TouchRect", "visible": True} +o_msg_installation={"container": o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase, "text": "Consumables Installation", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_rightImage_Image={"container": o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase, "id": "_rightImage", "source": "qrc:/images/iArrowRight", "type": "Image", "unnamed": 1, "visible": True} +o_confirm_button_enabled={"container": o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase, "text": "CONFIRM", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_leftImage_Image = {"container": o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase, "id": "_leftImage", "source": "qrc:/images/iArrowLeft", "type": "Image", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Consumables_Self_Test_Text = {"container": o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase, "text": "Consumables Self Test", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_BiCarb_Pump_Check_Text = {"container": o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase, "text": "BiCarb Pump Check", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Acid_Pump_Check_Text = {"container": o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase, "text": "Acid Pump Check", "type": "Text", "unnamed": 1, "visible": True} +o_PreTreatmentBase_Self_Test_Complete_Text = {"container": o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase, "text": "Self Test Complete!", "type": "Text", "unnamed": 1, "visible": True} + +o_separatorLine_text={"container": o_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase, "gradient": 0, "id": "_separatorLine", "type": "Line", "unnamed": 1, "visible": True} +o_text_object = {"type": "Text", "unnamed": 1, "visible": True} +o_bullet_object = {"type": "StepBullet", "unnamed": 1, "visible": True} + + Index: tst_pre_treatment_consumables/test.py =================================================================== diff -u --- tst_pre_treatment_consumables/test.py (revision 0) +++ tst_pre_treatment_consumables/test.py (revision 28eaad74b094db5832e72f1d66f19e534045393f) @@ -0,0 +1,193 @@ +# -*- 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_PreTreatmentConsumblesStack_PreTreatmentBase_TreatmentFlowBase + + +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.compare(bicarb_indicator[1].visible, False, " 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.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() + + + + + + + + + + + + + + + + + + + +