Index: shared/scripts/configuration/config.py =================================================================== diff -u -rb1f71b788540a259b19ed0ce19a2e8736be88b7a -re7f8ae16883b598da38add7ab5cd3bfa48ab408e --- shared/scripts/configuration/config.py (.../config.py) (revision b1f71b788540a259b19ed0ce19a2e8736be88b7a) +++ shared/scripts/configuration/config.py (.../config.py) (revision e7f8ae16883b598da38add7ab5cd3bfa48ab408e) @@ -16,7 +16,7 @@ import os from configuration.strings import * -AUT_NAME = "denaliSquish" +AUT_NAME = "denaliSquish -k -K -S" COMMON_PATH = os.environ['HOME']+"/Projects" @@ -32,3 +32,7 @@ #main-treatment heparin NUM_OF_REQUEST_REJECT_REASONS = 46 + +#heparin cumualtive values +HEPARIN_VALUES = {"Cumulative Value": [0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 1.0, 15.0, 17.8, 20.0]} + Index: shared/scripts/configuration/strings.py =================================================================== diff -u -rb1f71b788540a259b19ed0ce19a2e8736be88b7a -re7f8ae16883b598da38add7ab5cd3bfa48ab408e --- shared/scripts/configuration/strings.py (.../strings.py) (revision b1f71b788540a259b19ed0ce19a2e8736be88b7a) +++ shared/scripts/configuration/strings.py (.../strings.py) (revision e7f8ae16883b598da38add7ab5cd3bfa48ab408e) @@ -31,6 +31,8 @@ HEPARIN_PAUSE_DELIVERY_TEXT = "PAUSE DELIVERY" HEPARIN_MAXIMUM_VOLUME_DELIVERED_TEXT = "Maximum Cumulative Heparin Volume Delivered" HEPARIN_SYRINGE_EMPTY_TEXT = "Syringe Empty" +VOLUME_DELIVERED_TEXT = "Volume Delivered" +VOLUME_DELIVERED = "0.0" # dictionary of rejection reason from application source code. # message location -> denali-> Headers-> common-> MsgDefs.h @@ -83,6 +85,4 @@ 45: "REQUEST_REJECT_REASON_DG_CONCENTRATE_CAP_OPEN", # Concentrate cap open 46: "NUM_OF_REQUEST_REJECT_REASONS" # Number of settings change reject codes } - - \ No newline at end of file Index: shared/scripts/names.py =================================================================== diff -u -rca337dfc84368ebfb87c7c28e82ab1c9cd3a8798 -re7f8ae16883b598da38add7ab5cd3bfa48ab408e --- shared/scripts/names.py (.../names.py) (revision ca337dfc84368ebfb87c7c28e82ab1c9cd3a8798) +++ shared/scripts/names.py (.../names.py) (revision e7f8ae16883b598da38add7ab5cd3bfa48ab408e) @@ -68,8 +68,7 @@ o_state4_heparin_state_dispensing_active_text ={"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Dispensing Active", "type": "Text", "unnamed": 1, "visible": True} o_state5_heparin_state_completed_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Maximum Cumulative Heparin Volume Delivered", "type": "Text", "unnamed": 1, "visible": True} o_state6_heparin_state_empty_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Syringe Empty", "type": "Text", "unnamed": 1, "visible": True} + #Heparin Rejection Message o_rejection_msg = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "type": "Text", "unnamed": 1, "visible": True} - - - +o_volume_delivered_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "occurrence": 2, "text": "Volume Delivered", "type": "Text", "unnamed": 1, "visible": True} Index: tst_main_treatment_heparin/test.py =================================================================== diff -u -r425385c23586c7e90256f541a98218d5a4bc4af3 -re7f8ae16883b598da38add7ab5cd3bfa48ab408e --- tst_main_treatment_heparin/test.py (.../test.py) (revision 425385c23586c7e90256f541a98218d5a4bc4af3) +++ tst_main_treatment_heparin/test.py (.../test.py) (revision e7f8ae16883b598da38add7ab5cd3bfa48ab408e) @@ -11,32 +11,23 @@ from configuration import config, utility from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator -from dialin.common.hd_defs import PreTreatmentSubModes, HDOpModes, HDOpSubModes, TreatmentStates, HeparinStates +from dialin.common.hd_defs import TreatmentStates, HeparinStates -HIGHER_RANGE = 20 -STEP_VALUE = 1 -LOWER_RANGE = 0 HEPARIN_BUTTON_STATES = {0: "OFF", 1: "HEPARIN DELIVERY", 2: "RESUME DELIVERY", 3: "HEPARIN DELIVERY", 4: "PAUSE DELIVERY", 5: "OFF", 6: "HEPARIN DELIVERY"} + HEPARIN_STATE_MSGS = {"STATE_0_OFF_MESSAGE": "", "STATE_1_HEPARIN DELIVERY_MESSAGE": "Delivery Stopped", "STATE_2_RESUME DELIVERY_MESSAGE": "Delivery Paused", "STATE_3_HEPARIN DELIVERY_MESSAGE": "Bolus Active", "STATE_4_PAUSE DELIVERY_MESSAGE": "Dispensing Active", "STATE_5_OFF_MESSAGE": "Maximum Cumulative Heparin Volume Delivered", "STATE_6_HEPARIN DELIVERY_MESSAGE": "Syringe Empty"} -hd_simulator = HDSimulator() -def verify_cumulative_value(expected_cumulative_value): - """ - Method to verify cumulative values from heparin delivery section. - @param expected_cumulative_value - (str) expected cumulative value. - """ - expected_cumulative_value =str(expected_cumulative_value).replace(".0","") - heparin_value = waitForObjectExists(utility.expected_heparin_value(expected_cumulative_value)) - test.compare(heparin_value.text, expected_cumulative_value, utility.msg("Actual heparin cumulative value: {} should be equal to expected heparin cumulative value: {}".format(heparin_value.text, expected_cumulative_value))) +hd_simulator = HDSimulator() + def constants_for_cumulative_value(): """ Method is used to verify the constants for cumulative value. @@ -52,33 +43,45 @@ test.compare(str(initial_bolus_text), config.HEPARIN_BOLUS_ACTIVE_TEXT, utility.msg("Notification Message should be {}".format(config.HEPARIN_BOLUS_ACTIVE_TEXT))) utils.waitForGUI(1) - HIGHER_VALUE = HIGHER_RANGE * 10 #conversion of decaliter to liter - - for heparin_cumulative in range(LOWER_RANGE, HIGHER_VALUE+1, STEP_VALUE): - - if LOWER_RANGE <101: - - heparin_cumulative = format(heparin_cumulative/10, ".1f") - heparin_cumulative = float(heparin_cumulative) - hd_simulator.cmd_set_treatment_heparin_data(heparin_cumulative) - verify_cumulative_value(LOWER_RANGE) - utils.waitForGUI(1) - - elif 100 == LOWER_RANGE: - verify_rejection_msg_id(False) - utils.waitForGUI(1) - verify_rejection_msg_id(True) - test.log("Lower range works") - hd_simulator.cmd_set_treatment_states_data(sub_mode=TreatmentStates.TREATMENT_DIALYSIS_STATE.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_START_STATE.value, heparin_state=HeparinStates.HEPARIN_STATE_INITIAL_BOLUS.value, + for index in range(10): + utils.waitForGUI(0.2) + hd_simulator.cmd_set_treatment_heparin_data(cumulative = config.HEPARIN_VALUES["Cumulative Value"][index]) + parameter_text = object.children(waitForObjectExists(names.o_volume_delivered_text)) + test.compare((str(parameter_text[2].text)), str(config.HEPARIN_VALUES["Cumulative Value"][index]) , "parameter value should be "+str(config.HEPARIN_VALUES["Cumulative Value"][index])) + test.endSection() + + +def heparin_pause_resume_states(): + """ + Method to verify pause/resume delivery when HEPARIN DELIVERY button is active or deactive using heparin states + HEPARIN STATE 2 -> HEPARIN_STATE_PAUSED + HEPARIN STATE 4 -> HEPARIN_STATE_DISPENSING + """ + test.startSection("Verifying Heparin State ->2 HEPARIN_STATE_PAUSED") + hd_simulator.cmd_set_treatment_states_data(sub_mode=TreatmentStates.TREATMENT_DIALYSIS_STATE.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_START_STATE.value, heparin_state=HeparinStates.HEPARIN_STATE_PAUSED.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) - heparin_cumulative = format(heparin_cumulative/10, ".1f") - heparin_cumulative = float(heparin_cumulative) - hd_simulator.cmd_set_treatment_heparin_data(heparin_cumulative) - verify_cumulative_value(LOWER_RANGE) - + hd_simulator.cmd_set_heparin_pause_resume_response(accepted=1, reason=0) + test.compare(str(waitForObjectExists(names.o_state2_heparin_state_paused_text).text),config.HEPARIN_RESUME_DELIVERY_TEXT, utility.msg("Heparin Resume Delivery Text should be {}".format(config.HEPARIN_RESUME_DELIVERY_TEXT))) + test.compare( waitForObjectExists(names.o_state2_heparin_state_paused_text).enabled, True, utility.msg("Resume Delivery Button is enabled")) + mouseClick(waitForObject(names.o_state2_heparin_state_paused_text)) + + test.log("Heparin delivery is paused, resume delivery to start") + utils.waitForGUI(1) test.endSection() - + + test.startSection("Verifying Heparin State ->4 HEPARIN_STATE_DISPENSING") + hd_simulator.cmd_set_treatment_states_data(sub_mode=TreatmentStates.TREATMENT_DIALYSIS_STATE.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_START_STATE.value, heparin_state=HeparinStates.HEPARIN_STATE_DISPENSING.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.o_state4_heparin_state_dispensing_text).text), config.HEPARIN_PAUSE_DELIVERY_TEXT, utility.msg("Heparin Pause Delivery Text should be {}".format(config.HEPARIN_PAUSE_DELIVERY_TEXT))) + test.compare( waitForObjectExists(names.o_state4_heparin_state_dispensing_text).enabled , True, utility.msg("Pause Delivery Button is enabled")) + mouseClick(waitForObject(names.o_state4_heparin_state_dispensing_text)) + test.compare(str(waitForObjectExists(names.o_state4_heparin_state_dispensing_active_text).text), config.HEPARIN_BOLUS_DISPENSING_TEXT, utility.msg("Heparin Pause Delivery Text should be {}".format(config.HEPARIN_BOLUS_DISPENSING_TEXT))) + test.log("Heparin delivery is in dispensing state") + test.endSection() + + def heparin_stop_states_in_main_treatment(): """ Method to verify the heparin states when heparin cumulative is '0' at @@ -130,36 +133,7 @@ test.compare(str(waitForObjectExists(names.o_state6_heparin_state_empty_text).text), config.HEPARIN_SYRINGE_EMPTY_TEXT, utility.msg("Notification Message should be {}".format(config.HEPARIN_SYRINGE_EMPTY_TEXT))) utils.waitForGUI(1) -def heparin_pause_resume_states(): - """ - Method to verify pause/resume delivery when HEPARIN DELIVERY button is active or deactive using heparin states - HEPARIN STATE 2 -> HEPARIN_STATE_PAUSED - HEPARIN STATE 4 -> HEPARIN_STATE_DISPENSING - """ - test.startSection("Verifying Heparin State ->2 HEPARIN_STATE_PAUSED") - hd_simulator.cmd_set_treatment_states_data(sub_mode=TreatmentStates.TREATMENT_DIALYSIS_STATE.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_START_STATE.value, heparin_state=HeparinStates.HEPARIN_STATE_PAUSED.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) - hd_simulator.cmd_set_heparin_pause_resume_response(accepted=1, reason=0) - test.compare(str(waitForObjectExists(names.o_state2_heparin_state_paused_text).text),config.HEPARIN_RESUME_DELIVERY_TEXT, utility.msg("Heparin Resume Delivery Text should be {}".format(config.HEPARIN_RESUME_DELIVERY_TEXT))) - test.compare( waitForObjectExists(names.o_state2_heparin_state_paused_text).enabled, True, utility.msg("Resume Delivery Button is enabled")) - mouseClick(waitForObject(names.o_state2_heparin_state_paused_text)) - - test.log("Heparin delivery is paused, resume delivery to start") - utils.waitForGUI(1) - test.endSection() - - test.startSection("Verifying Heparin State ->4 HEPARIN_STATE_DISPENSING") - hd_simulator.cmd_set_treatment_states_data(sub_mode=TreatmentStates.TREATMENT_DIALYSIS_STATE.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_START_STATE.value, heparin_state=HeparinStates.HEPARIN_STATE_DISPENSING.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.o_state4_heparin_state_dispensing_text).text), config.HEPARIN_PAUSE_DELIVERY_TEXT, utility.msg("Heparin Pause Delivery Text should be {}".format(config.HEPARIN_PAUSE_DELIVERY_TEXT))) - test.compare( waitForObjectExists(names.o_state4_heparin_state_dispensing_text).enabled , True, utility.msg("Pause Delivery Button is enabled")) - mouseClick(waitForObject(names.o_state4_heparin_state_dispensing_text)) - test.compare(str(waitForObjectExists(names.o_state4_heparin_state_dispensing_active_text).text), config.HEPARIN_BOLUS_DISPENSING_TEXT, utility.msg("Heparin Pause Delivery Text should be {}".format(config.HEPARIN_BOLUS_DISPENSING_TEXT))) - test.log("Heparin delivery is in dispensing state") - test.endSection() - + def verify_the_rejection_msg(reason_id): """ Method to verify rejection messages @@ -169,6 +143,7 @@ test.compare(rejection_msg.text, config.REJECTION_REASON[reason_id], utility.msg("The rejection message should be {}".format(config.REJECTION_REASON[reason_id]))) test.endSection() + def verify_rejection_messages_for_heparin_states(): """ Method to test current states and rejection messages @@ -202,12 +177,13 @@ test.compare(waitForObjectExists(utility.expected_heparin_value(msg)).text, msg, utility.msg("{} text should be displayed".format(msg))) test.endSection() + def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) heparin_stop_states_in_main_treatment() verify_rejection_messages_for_heparin_states() - + utils.tstDone() \ No newline at end of file