Index: shared/scripts/names.py =================================================================== diff -u -ra470470339846e1134af7c57024c25180b8778a6 -rdc83f8cff9f4014fedd92c23d153761fd214a5f4 --- shared/scripts/names.py (.../names.py) (revision a470470339846e1134af7c57024c25180b8778a6) +++ shared/scripts/names.py (.../names.py) (revision dc83f8cff9f4014fedd92c23d153761fd214a5f4) @@ -53,10 +53,15 @@ o_pop_up_pressure_text_obj = {"container": o_Overlay, "type": "Text", "unnamed": 1, "visible": True} o_pop_up_close_btn = {"container": o_Overlay, "id": "_image", "source": "qrc:/images/iClose", "type": "Image", "unnamed": 1, "visible": True} o_pop_up_confirm_btn = {"container": o_Overlay, "text": "CONFIRM", "type": "Text", "unnamed": 1, "visible": True} +o_pressure_text_obj = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "type": "Text", "unnamed": 1, "visible": True} +o_pop_up_rejected_msg = {"container": o_Overlay, "type": "Text", "unnamed": 1, "visible": True} def pressure_pop_up_text_obj(text): o_pop_up_pressure_text_obj["text"] = text return o_pop_up_pressure_text_obj +def pressure_text_obj(text): + o_pressure_text_obj["text"] = text + return o_pressure_text_obj Index: tst_main_treatment_pressure/test.py =================================================================== diff -u -ra470470339846e1134af7c57024c25180b8778a6 -rdc83f8cff9f4014fedd92c23d153761fd214a5f4 --- tst_main_treatment_pressure/test.py (.../test.py) (revision a470470339846e1134af7c57024c25180b8778a6) +++ tst_main_treatment_pressure/test.py (.../test.py) (revision dc83f8cff9f4014fedd92c23d153761fd214a5f4) @@ -13,36 +13,123 @@ import names +from builtins import int from configuration.config import * from configuration.utility import * from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator hd = HDSimulator() -def main(): +def verify_arterial_and_venous_value_in_main_treatment_screen(accepted, + art_low, art_high, ven_low, ven_high): + """ + Method to verify Arterial low and high + and Venous low and high value on + main treatment screen + @param accepted: (int) boolean accept/reject response + @param arterial_low: (int) Arterial Pressure Limit Low (mmHg) + @param arterial_high: (int) Arterial Pressure Limit High (mmHg) + @param venous_low: (int) Venous Pressure Limit Low (mmHg) + @param venous_high: (int) Venous Pressure Limit High (mmHg) + @return: none + + """ + test.startSection("Verifying Arterial low and high " + + "and Venous low and high value on main treatment screen") + if accepted==ACCEPTED: + arterial_low = waitForObject(names.pressure_text_obj(text=art_low)) + arterial_low = arterial_low.text.toInt() + arterial_high = waitForObject(names.pressure_text_obj(text=art_high)) + arterial_high = arterial_high.text.toInt() + venous_low = waitForObject(names.pressure_text_obj(text=ven_low)) + venous_low = venous_low.text.toInt() + venous_high = waitForObject(names.pressure_text_obj(text=ven_high)) + venous_high = venous_high.text.toInt() + test.compare(arterial_low, art_low, + "Arterial low value should be " + + "'{low_val}'".format(low_val=art_low)) + + test.compare(arterial_high, art_high, + "Arterial high value should be " + + "'{high_val}'".format(high_val=art_high)) + + test.compare(venous_low, ven_low, + "Venous low value should be " + + "'{low_val}'".format(low_val=ven_low)) + + test.compare(venous_high, ven_high, + "Venous high value should not be " + + "'{high_val}'".format(high_val=ven_high)) + elif accepted==REJECTED: + if object.exists(names.pressure_text_obj(text=art_low)): + test.fail("{art_low} should not exists".format(art_low=art_low)) + if object.exists(names.pressure_text_obj(text=art_high)): + test.fail("{art_high} should not exists".format(art_high=art_high)) + if object.exists(names.pressure_text_obj(text=ven_low)): + test.fail("{ven_low} should not exists".format(ven_low=ven_low)) + if object.exists(names.pressure_text_obj(text=ven_high)): + test.fail("{ven_high} should not exists".format(ven_low=ven_high)) + test.endSection() - utils.tstStart(__file__) - start_application(AUT_NAME) - hd.cmd_send_power_on_self_test_version_request() - hd.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) +def verify_arterial_and_venous_value_on_pressure_pop_up(accepted, reason_id, + art_low, art_high, ven_low, ven_high): + """ + Method to verify Arterial low and high + and Venous low and high value on + main treatment screen + @param accepted: (int) boolean accept/reject response + @param reason_id: (int) rejection reason id + @param arterial_low: (int) Arterial Pressure Limit Low (mmHg) + @param arterial_high: (int) Arterial Pressure Limit High (mmHg) + @param venous_low: (int) Venous Pressure Limit Low (mmHg) + @param venous_high: (int) Venous Pressure Limit High (mmHg) + @return: none + + """ + test.startSection("Verifying Arterial low and high " + + "and Venous low and high value on pressure pop up screen") + arterial_low = waitForObject(names.pressure_pop_up_text_obj(text=art_low)) + arterial_low = arterial_low.text.toInt() + arterial_high = waitForObject(names.pressure_pop_up_text_obj(text=art_high)) + arterial_high = arterial_high.text.toInt() + venous_low = waitForObject(names.pressure_pop_up_text_obj(text=ven_low)) + venous_low = venous_low.text.toInt() + venous_high = waitForObject(names.pressure_pop_up_text_obj(text=ven_high)) + venous_high = venous_high.text.toInt() + if accepted==ACCEPTED: + test.compare(arterial_low, art_low, + "Arterial low value should be " + + "'{low_val}'".format(low_val=art_low)) + + test.compare(arterial_high, art_high, + "Arterial high value should be " + + "'{high_val}'".format(high_val=art_high)) + + test.compare(venous_low, ven_low, + "Venous low value should be " + + "'{low_val}'".format(low_val=ven_low)) + + test.compare(venous_high, ven_high, + "Venous high value should be " + + "'{high_val}'".format(high_val=ven_high)) + elif accepted==REJECTED: + if object.exists(names.pressure_text_obj(text=art_low)): + test.fail("{art_low} should not exists".format(art_low=art_low)) + if object.exists(names.pressure_text_obj(text=art_high)): + test.fail("{art_high} should not exists".format(art_high=art_high)) + if object.exists(names.pressure_text_obj(text=ven_low)): + test.fail("{ven_low} should not exists".format(ven_low=ven_low)) + if object.exists(names.pressure_text_obj(text=ven_high)): + test.fail("{ven_high} should not exists".format(ven_low=ven_high)) + + verify_reject_msg_on_pop_up(reason_id) + test.endSection() - set_arterial_and_venous_pressure(accepted=ACCEPTED, reason=2, - art_low=-150, art_high=150, ven_low=-200, - ven_high=100) - - snooze(5) - - open_pressure_pop_up() - - -def set_arterial_and_venous_pressure(accepted, reason, - art_low, art_high, ven_low, ven_high, \ - ): +def set_arterial_and_venous_pressure(accepted, reason, \ + art_low, art_high, ven_low, ven_high): """ Method to set the Arterial and Venous high and low pressure value @@ -110,18 +197,56 @@ "Venous unit of measurement should be " + "'{uom}'".format(uom=VENOUS_UOM)) test.endSection() + + +def verify_reject_msg_on_pop_up(reason_id): + """ + Method verify the rejection message + on pop up screen + """ + test.startSection("Verify the rejection message " + + "on pop up screen") + reason_msg = waitForObject(names.o_pop_up_rejected_msg) + reason_msg = reason_msg.text.toUtf8().constData() + test.compare(reason_msg, REJECTION_REASON[reason_id], + "{reason} should display on ".format(reason=REJECTION_REASON[reason_id]) + + "on pop up when values are rejected") + test.endSection() + + +def main(): + utils.tstStart(__file__) + start_application(AUT_NAME) + hd.cmd_send_power_on_self_test_version_request() + hd.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) + set_arterial_and_venous_pressure(accepted=ACCEPTED, reason=2, + art_low=-150, art_high=150, ven_low=-200, + ven_high=100) + verify_arterial_and_venous_value_in_main_treatment_screen(accepted=ACCEPTED, + art_low=-150, art_high=150, ven_low=-200, ven_high=100) + snooze(5) + open_pressure_pop_up() + verify_arterial_and_venous_value_on_pressure_pop_up(accepted=ACCEPTED, reason_id=0, + art_low=-150, art_high=150, ven_low=-200, ven_high=100) + set_arterial_and_venous_pressure(accepted=REJECTED, reason=2, + art_low=-120, art_high=120, ven_low=-100, + ven_high=200) + verify_arterial_and_venous_value_in_main_treatment_screen(accepted=REJECTED, + art_low=-120, art_high=120, ven_low=-100, ven_high=200) + snooze(5) + open_pressure_pop_up() + verify_arterial_and_venous_value_on_pressure_pop_up(accepted=REJECTED,reason_id=2, + art_low=-120, art_high=120, ven_low=-100, ven_high=200) - - - - - +