Index: shared/scripts/configuration/config.py =================================================================== diff -u -r8242123c781d022e2c7d9e1d36436ddfde01ffe4 -r30b3e1a07f940f488bc749e2d39438ce2a3f5168 --- shared/scripts/configuration/config.py (.../config.py) (revision 8242123c781d022e2c7d9e1d36436ddfde01ffe4) +++ shared/scripts/configuration/config.py (.../config.py) (revision 30b3e1a07f940f488bc749e2d39438ce2a3f5168) @@ -88,4 +88,4 @@ 39: "REQUEST_REJECT_REASON_RINSEBACK_NOT_COMPLETED", } -NUM_OF_REJECTION_MSG = 39 +NUM_OF_REQUEST_REJECT_REASONS = 39 Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r8242123c781d022e2c7d9e1d36436ddfde01ffe4 -r30b3e1a07f940f488bc749e2d39438ce2a3f5168 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 8242123c781d022e2c7d9e1d36436ddfde01ffe4) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 30b3e1a07f940f488bc749e2d39438ce2a3f5168) @@ -18,46 +18,7 @@ import squish from configuration import config from builtins import int as pyInt - -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 @@ -81,11 +42,6 @@ return False - -def rejection_msg(text): - names.rejection_msg["text"] = text - return names.rejection_msg - def scroll_to_zone(zone=None, screen_object=None): """ scroll to the numeric if object is hidden @@ -112,3 +68,13 @@ raise LookupError("zone object is not in view to the user after " + \ "trying 100 times") + + +def rejection_msg(text): + names.rejection_msg["text"] = text + return names.rejection_msg + + +def expected_heparin_value(val): + names.o_heparin_value["text"] = val + return names.o_heparin_value Index: shared/scripts/names.py =================================================================== diff -u -r8242123c781d022e2c7d9e1d36436ddfde01ffe4 -r30b3e1a07f940f488bc749e2d39438ce2a3f5168 --- shared/scripts/names.py (.../names.py) (revision 8242123c781d022e2c7d9e1d36436ddfde01ffe4) +++ shared/scripts/names.py (.../names.py) (revision 30b3e1a07f940f488bc749e2d39438ce2a3f5168) @@ -48,22 +48,21 @@ o_cumulative_fluid_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Cumulative Delivered", "type": "Text", "unnamed": 1, "visible": True} #Heparin -cumulative_fluid = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Cumulative Delivered", "type": "Text", "unnamed": 1, "visible": True} -heparin_value = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "occurrence": 2, "text": "Volume Delivered", "type": "Text", "unnamed": 1, "visible": True} -o_QQuickView = {"type": "QQuickView"} +o_heparin_value = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Volume Delivered", "type": "Text", "unnamed": 1, "visible": True} +o_QQuickView = {"type": "QQuickView"} o_treatmentStart_TreatmentStart = {"container": o_QQuickView, "id": "_treatmentStart", "type": "TreatmentStart", "unnamed": 1, "visible": True} o_treatmentStart_HeparinSection = {"container": o_treatmentStart_TreatmentStart , "id": "_heparinTouchArea", "type": "TreatmentFluid" } #Heparin_Messages_on_Button -state0_heparin_delivery_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "HEPARIN DELIVERY", "type": "Text", "unnamed": 1, "visible": True} -state2_heparin_state_paused_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "RESUME DELIVERY", "type": "Text", "unnamed": 1, "visible": True} -state4_heparin_state_dispensing_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "PAUSE DELIVERY", "type": "Text", "unnamed": 1, "visible": True} +o_state0_heparin_delivery_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "HEPARIN DELIVERY", "type": "Text", "unnamed": 1, "visible": True} +o_state2_heparin_state_paused_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "RESUME DELIVERY", "type": "Text", "unnamed": 1, "visible": True} +o_state4_heparin_state_dispensing_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "PAUSE DELIVERY", "type": "Text", "unnamed": 1, "visible": True} #Heparin_Statewise_Messages -state0_heparin_delivery_Off_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Heparin Delivery Off", "type": "Text", "unnamed": 1, "visible": True} -state_one_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Heparin Delivery Stopped", "type": "Text", "unnamed": 1, "visible": True} -state3_heparin_state_initial_bolus_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Heparin Bolus Active", "type": "Text", "unnamed": 1, "visible": True} -state5_heparin_state_completed_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Maximum Cumulative Heparin Volume Delivered", "type": "Text", "unnamed": 1, "visible": True} -state6_heparin_state_empty_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Heparin Syringe Empty", "type": "Text", "unnamed": 1, "visible": True} +o_state0_heparin_delivery_Off_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Heparin Delivery Off", "type": "Text", "unnamed": 1, "visible": True} +o_state_one_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Heparin Delivery Stopped", "type": "Text", "unnamed": 1, "visible": True} +o_state3_heparin_state_initial_bolus_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Heparin Bolus 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": "Heparin Syringe Empty", "type": "Text", "unnamed": 1, "visible": True} #Heparin Rejection Message -rejection_msg = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "type": "Text", "unnamed": 1, "visible": True} +o_rejection_msg = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "type": "Text", "unnamed": 1, "visible": True} Index: tst_main_treatment_heparin/test.py =================================================================== diff -u -rdd7e4a5f02b676024a84dce02215515cbd60474e -r30b3e1a07f940f488bc749e2d39438ce2a3f5168 --- tst_main_treatment_heparin/test.py (.../test.py) (revision dd7e4a5f02b676024a84dce02215515cbd60474e) +++ tst_main_treatment_heparin/test.py (.../test.py) (revision 30b3e1a07f940f488bc749e2d39438ce2a3f5168) @@ -12,11 +12,10 @@ from configuration import config, utility from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator -import numpy as np -HIGHER_RANGE = 20.1 -STEP_VALUE = 0.1 +HIGHER_RANGE = 20 +STEP_VALUE = 1 LOWER_RANGE = 0 hd_simulator = HDSimulator() @@ -26,39 +25,30 @@ Verifying cumulative values from heparin delivery section. @param expected_cumulative_value - (str) expected cumulative value. """ - heparin_text = waitForObject(names.cumulative_fluid) - heparin_value = waitForObject(names.heparin_value) - heparin_unit = object.children(heparin_text)[0] - - if heparin_unit.text == config.HEPARIN_UNIT: - heparin_cumulative = object.children(heparin_value)[2] - expected_cumulative_value = str(expected_cumulative_value).replace(".0","") - - test.compare(heparin_cumulative.text, expected_cumulative_value, "Actual heparin cumulative value: {} should be equal to expected heparin cumulative value: {}".format(heparin_cumulative.text, expected_cumulative_value)) - else: - test.fail("The heparin value should not be more than 20ml") - - + 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, "Actual heparin cumulative value: {} should be equal to expected heparin cumulative value: {}".format(heparin_value.text, expected_cumulative_value)) + def constants_for_cumulative_value(): """ Method is used to verify the constants for cumulative value. """ test.startSection("Verifying Heparin State 3 HEPARIN_INITIAL_BOLUS values") hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state= 0, heparin_state= 3, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state= 0, treatment_stop_state=0, dialysis_state=0) - test.compare(str(waitForObjectExists(names.state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) - test.compare((waitForObjectExists(names.state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") - initial_bolus_text = waitForObjectExists(names.state3_heparin_state_initial_bolus_text).text + treatment_end_state= 0, treatment_stop_state=0, dialysis_state= 0) + test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) + test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") + initial_bolus_text = waitForObjectExists(names.o_state3_heparin_state_initial_bolus_text).text test.compare(str(initial_bolus_text), config.HEPARIN_BOLUS_ACTIVE_TEXT, "Notification Message should be {}".format(config.HEPARIN_BOLUS_ACTIVE_TEXT)) - - - for heparin_cumulative in np.arange(LOWER_RANGE, HIGHER_RANGE, STEP_VALUE): - heparin_cumulative = format(heparin_cumulative, ".1f") + HIGHER_VALUE = HIGHER_RANGE * 10 #conversion of decaliter to liter + for heparin_cumulative in range(LOWER_RANGE, HIGHER_VALUE+1, STEP_VALUE): + heparin_cumulative = format(heparin_cumulative/10, ".1f") + test.log(str(heparin_cumulative)) heparin_cumulative = float(heparin_cumulative) - hd_simulator.cmd_set_treatment_heparin_data(cumulative = heparin_cumulative) - verification_of_cumulative_value(expected_cumulative_value = heparin_cumulative) + hd_simulator.cmd_set_treatment_heparin_data(heparin_cumulative) + verification_of_cumulative_value(heparin_cumulative) utils.waitForGUI(1) test.endSection() @@ -72,22 +62,22 @@ """ test.log("Verifying Heparin State 0 - HEPARIN_STATE_OFF") hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state= 0, heparin_state= 0, - rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state= 0, treatment_stop_state=0, dialysis_state=0) - test.compare(str(waitForObjectExists(names.state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) - test.compare((waitForObjectExists(names.state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") + rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, + treatment_end_state= 0, treatment_stop_state= 0, dialysis_state= 0) + test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) + test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") test.log("Verifying Notification Message") - test.compare(str(findObject(names.state0_heparin_delivery_Off_text).text ), config.HEPARIN_DELIVERY_OFF_TEXT,"Notification Message should be {}".format(config.HEPARIN_DELIVERY_OFF_TEXT)) + test.compare(str(findObject(names.o_state0_heparin_delivery_Off_text).text ), config.HEPARIN_DELIVERY_OFF_TEXT,"Notification Message should be {}".format(config.HEPARIN_DELIVERY_OFF_TEXT)) utils.waitForGUI(1) test.log("Verifying Heparin State 1 - HEPARIN_STATE_STOPPED") hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 1, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) - test.compare(str(waitForObjectExists(names.state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) - test.compare((waitForObjectExists(names.state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") + treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) + test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) + test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") test.log("Verifying Notification Message") - test.compare(str(waitForObjectExists(names.state_one_text).text), config.HEPARIN_STOP_TEXT,"Notification Message should be {}".format(config.HEPARIN_STOP_TEXT)) + test.compare(str(waitForObjectExists(names.o_state_one_text).text), config.HEPARIN_STOP_TEXT,"Notification Message should be {}".format(config.HEPARIN_STOP_TEXT)) utils.waitForGUI(1) constants_for_cumulative_value() @@ -96,52 +86,50 @@ test.log("Verifying Heparin State 5 - HEPARIN_STATE_COMPLETED") hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 5, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) + treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) - test.compare(str(waitForObjectExists(names.state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) - test.compare((waitForObjectExists(names.state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") + test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) + test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") test.log("Verifying Notification Message") - test.compare(str(waitForObjectExists(names.state5_heparin_state_completed_text).text), config.HEPARIN_MAXIMUM_VOLUME_DELIVERED_TEXT,"Notification Message should be {}".format(config.HEPARIN_MAXIMUM_VOLUME_DELIVERED_TEXT)) + test.compare(str(waitForObjectExists(names.o_state5_heparin_state_completed_text).text), config.HEPARIN_MAXIMUM_VOLUME_DELIVERED_TEXT,"Notification Message should be {}".format(config.HEPARIN_MAXIMUM_VOLUME_DELIVERED_TEXT)) utils.waitForGUI(1) test.log("Verifying Heparin State 6 - HEPARIN_STATE_EMPTY") hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 6, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) + treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) - test.compare(str(waitForObjectExists(names.state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) - test.compare((waitForObjectExists(names.state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") + test.compare(str(waitForObjectExists(names.o_state0_heparin_delivery_text).text), config.HEPARIN_DELIVERY_TEXT, "Heparin Delivery Text should be {}".format(config.HEPARIN_DELIVERY_TEXT)) + test.compare((waitForObjectExists(names.o_state0_heparin_delivery_text)).enabled, False, "Heparin Delivery should be disabled") test.log("Verifying Notification Message") - test.compare(str(waitForObjectExists(names.state6_heparin_state_empty_text).text), config.HEPARIN_SYRINGE_EMPTY_TEXT,"Notification Message should be {}".format(config.HEPARIN_SYRINGE_EMPTY_TEXT)) + test.compare(str(waitForObjectExists(names.o_state6_heparin_state_empty_text).text), config.HEPARIN_SYRINGE_EMPTY_TEXT,"Notification Message should be {}".format(config.HEPARIN_SYRINGE_EMPTY_TEXT)) utils.waitForGUI(1) - def heparin_pause_resume_states(): """ Verifying 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 """ - hd_simulator.cmd_set_heparin_pause_resume_response(accepted = 1, reason = 1) + hd_simulator.cmd_set_heparin_pause_resume_response(accepted = 1, reason = 1) hd_simulator.cmd_set_treatment_heparin_data(cumulative = 10) hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 2, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) - test.compare(str(waitForObjectExists(names.state2_heparin_state_paused_text).text),config.HEPARIN_RESUME_DELIVERY_TEXT,"Heparin Resume Delivery Text should be {}".format(config.HEPARIN_RESUME_DELIVERY_TEXT)) - test.compare( waitForObjectExists(names.state2_heparin_state_paused_text).enabled, True, "Resume Delivery Button is enabled") + treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) + test.compare(str(waitForObjectExists(names.o_state2_heparin_state_paused_text).text),config.HEPARIN_RESUME_DELIVERY_TEXT,"Heparin Resume Delivery Text should be {}".format(config.HEPARIN_RESUME_DELIVERY_TEXT)) + test.compare( waitForObjectExists(names.o_state2_heparin_state_paused_text).enabled, True, "Resume Delivery Button is enabled") test.log("Heparin delivery is paused, resume delivery to start") utils.waitForGUI(1) hd_simulator.cmd_set_treatment_heparin_data(cumulative = 10.1) hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 4, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) - test.compare(str(waitForObjectExists(names.state4_heparin_state_dispensing_text).text), config.HEPARIN_PAUSE_DELIVERY_TEXT,"Heparin Pause Delivery Text should be {}".format(config.HEPARIN_PAUSE_DELIVERY_TEXT)) - test.compare( waitForObjectExists(names.state4_heparin_state_dispensing_text).enabled , True, "Pause Delivery Button is enabled") + treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) + test.compare(str(waitForObjectExists(names.o_state4_heparin_state_dispensing_text).text), config.HEPARIN_PAUSE_DELIVERY_TEXT,"Heparin Pause Delivery Text should be {}".format(config.HEPARIN_PAUSE_DELIVERY_TEXT)) + test.compare( waitForObjectExists(names.o_state4_heparin_state_dispensing_text).enabled , True, "Pause Delivery Button is enabled") test.log("Heparin delivery is in dispensing state") utils.waitForGUI(1) - def verify_the_rejection_msg(): """ Method to verify rejection messages @@ -150,9 +138,9 @@ test.startSection("Verifying Rejection Messages") hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 4, rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) - for reason_id in range(1, config.NUM_OF_REJECTION_MSG+1): - hd_simulator.cmd_set_heparin_pause_resume_response(accepted=0, reason=reason_id) + treatment_end_state=0, treatment_stop_state= 0, dialysis_state= 0) + for reason_id in range(1, config.NUM_OF_REQUEST_REJECT_REASONS+1): + hd_simulator.cmd_set_heparin_pause_resume_response(accepted=0, reason=reason_id) rejection_msg = waitForObjectExists(utility.rejection_msg(text=config.REJECTION_REASON[reason_id])) test.compare(rejection_msg.text, config.REJECTION_REASON[reason_id], "The rejection message should be {}".format(config.REJECTION_REASON[reason_id])) test.endSection()