Index: shared/scripts/configuration/config.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -r01f6e29f2803292662c6b29d867a2fc6c0b1f752 --- shared/scripts/configuration/config.py (.../config.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/configuration/config.py (.../config.py) (revision 01f6e29f2803292662c6b29d867a2fc6c0b1f752) @@ -32,3 +32,63 @@ BLOOD_PRIMING_TEXT = "Blood Priming" SALINE_UNIT = "mL" BLOOD_PRIMING_DEFAULT_VALUE = "0 mL" + +UF_MINIMUM_VALUE = 0 +UF_MAXIMUM_VALUE = 600 +PAUSED_TEXT = "Ultrafiltration Paused" +RESUME_TEXT = "RESUME ULTRAFILTRATION" +EDIT_TEXT = "EDIT ULTRAFILTRATION VOLUME" +TITLE_TEXT = "ULTRAFILTRATION VOLUME (L)" + + +# dictionary of rejection reason from application source code. +# message location -> denali-> Headers-> common-> MsgDefs.h +REJECTION_REASON = { + 0 : "REQUEST_REJECT_REASON_NONE" , # Used when there is no rejection + 1 : "REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE" , # "REQuest is not allowed in the current operating mode + 2 : "REQUEST_REJECT_REASON_TIMEOUT_WAITING_FOR_USER_CONFIRM" , # Validated "REQuest was not confirmed by user in reasonable time + 3 : "REQUEST_REJECT_REASON_NOT_IN_TREATMENT_MODE" , # "REQuest is not allowed if not in treatment mode + 4 : "REQUEST_REJECT_REASON_INVALID_TREATMENT_STATE" , # "REQuest is not allowed in current treatment state + 5 : "REQUEST_REJECT_REASON_TREATMENT_TOO_CLOSE_TO_FINISHED" , # "REQuest is not allowed so near end of treatment + 6 : "REQUEST_REJECT_REASON_TREATMENT_TIME_OUT_OF_RANGE" , # Treatment duration is out of range + 7 : "REQUEST_REJECT_REASON_TREATMENT_TIME_LESS_THAN_CURRENT" , # Treatment time change is less than currently elapsed treatment time + 8 : "REQUEST_REJECT_REASON_BLOOD_FLOW_OUT_OF_RANGE" , # Blood flow is out of range + 9 : "REQUEST_REJECT_REASON_DIAL_FLOW_OUT_OF_RANGE" , # Dialysate flow is out of range + 10 : "REQUEST_REJECT_REASON_DIAL_VOLUME_OUT_OF_RANGE" , # Dialysate flow rate or treatment duration causes dialysate volume to exceed limit + 11 : "REQUEST_REJECT_REASON_UF_VOLUME_OUT_OF_RANGE" , # Ultrafiltration volume is out of range + 12 : "REQUEST_REJECT_REASON_UF_RATE_OUT_OF_RANGE" , # Ultrafiltration rate is out of range + 13 : "REQUEST_REJECT_REASON_TREATMENT_TIME_LESS_THAN_MINIMUM" , # Treatment time change is less than minimum treatment time + 14 : "REQUEST_REJECT_REASON_UF_NOT_IN_PROGESS" , # Ultrafiltration is not currently in progress + 15 : "REQUEST_REJECT_REASON_UF_NOT_PAUSED" , # Ultrafiltration is not currently paused + 16 : "REQUEST_REJECT_REASON_SALINE_BOLUS_IN_PROGRESS" , # A saline bolus is in progress + 17 : "REQUEST_REJECT_REASON_PARAM_OUT_OF_RANGE" , # A treatment parameter is out of range + 18 : "REQUEST_REJECT_REASON_HEPARIN_PRESTOP_EXCEEDS_DURATION" , # The Heparin pre-stop setting is greater than the treatment duration + 19 : "REQUEST_REJECT_REASON_ARTERIAL_PRESSURE_LOW_VS_HIGH" , # Arterial pressure low and high alarm limits are not inconsistent + 20 : "REQUEST_REJECT_REASON_VENOUS_PRESSURE_LOW_VS_HIGH" , # Venous pressure low and high alarm limits are inconsistent + 21 : "REQUEST_REJECT_REASON_SALINE_MAX_VOLUME_REACHED" , # Saline bolus volume maximum has been reached - no more saline allowed + 22 : "REQUEST_REJECT_REASON_SALINE_BOLUS_NOT_IN_PROGRESS" , # A saline bolus is not in progress + 23 : "REQUEST_REJECT_REASON_ACTION_DISABLED_IN_CURRENT_STATE" , # "REQuested user action is disabled in current state + 24 : "REQUEST_REJECT_REASON_ALARM_IS_ACTIVE" , # "REQuested user action not allowed while alarm is active + 25 : "REQUEST_REJECT_REASON_INVALID_COMMAND" , # "REQuested user action invalid + 26 : "REQUEST_REJECT_REASON_TREATMENT_IS_COMPLETED" , # The treatment has been completed + 27 : "REQUEST_REJECT_REASON_ADDL_RINSEBACK_MAX_VOLUME_REACHED" , # Rinseback additional volume maximum has been reached - no more additional rinsebacks allowed + 28 : "REQUEST_REJECT_REASON_UF_VOLUME_NOT_SET" , # Ultrafiltration volume is not set yet + 29 : "REQUEST_REJECT_REASON_NO_PATIENT_CONNECTION_CONFIRM" , # The user has not confirmed patient connection + 30 : "REQUEST_REJECT_REASON_HEPARIN_PAUSE_INVALID_IN_THIS_STATE" , # Heparin cannot be paused if not currently deliverying Heparin + 31 : "REQUEST_REJECT_REASON_HEPARIN_NOT_PAUSED" , # Heparin cannot be resumed if not paused + 32 : "REQUEST_REJECT_REASON_DG_COMM_LOST" , # Treatment cannot initiate if DG comm is lost + 33 : "REQUEST_REJECT_REASON_DRAIN_NOT_COMPLETE" , # Post-treatment reservoirs drain not complete + 34 : "REQUEST_REJECT_REASON_DG_NOT_IN_STANDBY_IDLE_STATE" , # Treatment cannot initiate if DG is not in standby idle state + 35 : "REQUEST_REJECT_REASON_INVALID_REQUEST_FORMAT" , # "REQuest message not formatted properly + 36 : "REQUEST_REJECT_REASON_INVALID_DATE_OR_TIME" , # Given date/time is invalid + 37 : "REQUEST_REJECT_REASON_NO_NEW_TREATMENT_ALARM_TRIGGERED" , # Treatment cannot initiate if an alarm with no new treatment property has triggered before + 38 : "REQUEST_REJECT_REASON_BATTERY_IS_NOT_CHARGED" , # Battery does not have enough charge to start treatment + 39 : "REQUEST_REJECT_REASON_RINSEBACK_NOT_COMPLETED" , # Cannot move on to recirculate without completing full rinseback +} + +NUM_OF_REQUEST_REJECT_REASONS = 39 + + + + + Index: shared/scripts/names.py =================================================================== diff -u -r0cc92d3b75bfb96dc4ecafd760a9ce15e455033b -r01f6e29f2803292662c6b29d867a2fc6c0b1f752 --- shared/scripts/names.py (.../names.py) (revision 0cc92d3b75bfb96dc4ecafd760a9ce15e455033b) +++ shared/scripts/names.py (.../names.py) (revision 01f6e29f2803292662c6b29d867a2fc6c0b1f752) @@ -3,6 +3,15 @@ from objectmaphelper import * +# Top Parents +o_QQuickView = { "type": "QQuickView"} +o_Overlay = {"container": o_QQuickView, "type": "Overlay"} +o_treatmentHome = {"container": o_QQuickView , "id": "_treatmentHome" , "type": "TreatmentHome", "unnamed": 1, "visible": True} +o_treatmentHome_backgroung = {"container": o_treatmentHome, "id": "_backgroundRect" , "type": "Rectangle" , "unnamed": 1, "visible": True} +o_treatmentHome_startTreatment = {"container": o_treatmentHome, "id": "_startTreatmentRect" , "type": "TouchRect" , "unnamed": 1, "visible": True} +o_treatmentHome_createTreatment = {"container": o_treatmentHome, "id": "_createTreatmentRect", "type": "TouchRect" , "unnamed": 1, "visible": True} + + o_Gui_MainView = {"type": "Gui::MainView", "unnamed": 1, "visible": True} o_Overlay = {"container": o_Gui_MainView, "type": "Overlay", "unnamed": 1, "visible": True} o_borderRect_Rectangle = {"container": o_Overlay, "gradient": 0, "id": "_borderRect", "type": "Rectangle", "unnamed": 1, "visible": True} @@ -37,17 +46,31 @@ #in-treatment o_blood_priming = {"container": o_treatmentStack_TreatmentBloodPrime_ScreenItem, "text": "Blood Priming", "type": "Text", "unnamed": 1, "visible": True} o_blood_priming_value_by_default = {"container": o_treatmentStack_TreatmentBloodPrime_ScreenItem, "text": "0 mL", "type": "Text", "unnamed": 1, "visible": True} -o_uf_minimum_value = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "0.000", "type": "Text", "unnamed": 1, "visible": True} -o_uf_maximum_value = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "0.600", "type": "Text", "unnamed": 1, "visible": True} -o_uf_minimum_value_pop_up = {"container": o_Overlay, "text": "0.000", "type": "Text", "unnamed": 1, "visible": True} -o_uf_maximum_value_pop_up = {"container": o_Overlay, "text": "0.600", "type": "Text", "unnamed": 1, "visible": True} o_edit_uf_value = {"container": o_Overlay, "text": "EDIT ULTRAFILTRATION VOLUME", "type": "Text", "unnamed": 1, "visible": True} -o_uf_back_button = {"container": o_Overlay, "text": "BACK", "type": "Text", "unnamed": 1, "visible": True} -o_uf_close_button = {"container": o_Overlay, "id": "_image", "source": "qrc:/images/iClose", "type": "Image", "unnamed": 1, "visible": True} o_fluid_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Volume Delivered", "type": "Text", "unnamed": 1, "visible": True} o_cumulative_fluid_text = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "Cumulative Delivered", "type": "Text", "unnamed": 1, "visible": True} +# Ultrafiltration Section +o_treatmentStart_TreatmentStart = {"container": o_QQuickView, "id": "_treatmentStart", "type": "TreatmentStart", "unnamed": 1, "visible": True} +o_treatmentStart_ultrafiltration_section = {"container": o_treatmentStart_TreatmentStart , "id": "_ultrafiltrationTouchArea", "type": "TreatmentUltrafiltration"} +o_treatmentStart_ultrafiltration_notification = {"container": o_treatmentStart_ultrafiltration_section, "objectName": "NotificationBar" , "type": "NotificationBarSmall" } +o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration = {"container": o_treatmentHome, "id": "_ultrafiltrationTouchArea", "type": "TreatmentUltrafiltration", "unnamed": 1, "visible": True} +o_uf_minimum_value = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "0.000", "type": "Text", "unnamed": 1, "visible": True} +o_uf_maximum_value = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "0.600", "type": "Text", "unnamed": 1, "visible": True} +o_uf_minimum_value_pop_up = {"container": o_Overlay, "text": "0.000", "type": "Text", "unnamed": 1, "visible": True} +o_uf_maximum_value_pop_up = {"container": o_Overlay, "text": "0.600", "type": "Text", "unnamed": 1, "visible": True} +o_uf_edit_ultrafilteration_volume = {"container": o_Overlay, "text": "EDIT ULTRAFILTRATION VOLUME", "type": "Text", "unnamed": 1, "visible": True} +o_treatmentHome_progressbar_start_state = {"container": o_treatmentHome, "id": "_progressbarex", "type": "ProgressBarEx", "unnamed": 1, "visible": True} +o_treatmentHome_progressbar_edit_uf = {"container": o_Overlay, "id": "_rangeProgressBar", "type": "ProgressBarEx", "unnamed": 1, "visible": True} +o_volumeSlider_slider = {"container": o_Overlay,"id": "_volumeSlider", "type": "Slider", "unnamed": 1, "visible": True} +o_treatmenthome_ultrafiltration_paused_text = {"container": o_treatmentHome, "text": "Ultrafiltration Paused", "type": "Text", "unnamed": 1, "visible": True} +o_ultrafiltration_paused_text = {"container": o_Overlay, "text": "Ultrafiltration Paused", "type": "Text", "unnamed": 1, "visible": True} +o_resume_ultrafilteration_text = {"container": o_Overlay, "text": "RESUME ULTRAFILTRATION", "type": "Text", "unnamed": 1, "visible": True} +o_ultrafilteration_volume_text = {"container": o_Overlay, "text": "ULTRAFILTRATION VOLUME (L)", "type": "Text", "unnamed": 1, "visible": True} +o_ultrafilteration_closeButton = {"container": o_Overlay, "id": "_closeButton", "type": "CloseButton", "unnamed": 1, "visible": True} +o_backbutton_backbutton = {"container": o_Overlay, "id": "_backButton", "type": "BackButton", "unnamed": 1, "visible": True} +o_notificationbar_response = {"container": o_Overlay, "objectName": "NotificationBar", "type": "NotificationBar", "visible": True} Index: suite.conf =================================================================== diff -u -r8df6f936193bbd9127d3ec940562e62db0060bcb -r01f6e29f2803292662c6b29d867a2fc6c0b1f752 --- suite.conf (.../suite.conf) (revision 8df6f936193bbd9127d3ec940562e62db0060bcb) +++ suite.conf (.../suite.conf) (revision 01f6e29f2803292662c6b29d867a2fc6c0b1f752) @@ -1,6 +1,6 @@ AUT=denaliSquish LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_environment tst_post tst_standbymode tst_In_treatment +TEST_CASES=tst_environment tst_post tst_standbymode tst_case1 tst_main_treatment_ultrafilteration tst_main_treatment_uf_adjustments VERSION=3 WRAPPERS=Qt Fisheye: Tag 01f6e29f2803292662c6b29d867a2fc6c0b1f752 refers to a dead (removed) revision in file `tst_In_treatment/test.py'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 01f6e29f2803292662c6b29d867a2fc6c0b1f752 refers to a dead (removed) revision in file `tst_In_treatment/verificationPoints/VP1'. Fisheye: No comparison available. Pass `N' to diff? Index: tst_main_treatment_ultrafilteration/test.py =================================================================== diff -u --- tst_main_treatment_ultrafilteration/test.py (revision 0) +++ tst_main_treatment_ultrafilteration/test.py (revision 01f6e29f2803292662c6b29d867a2fc6c0b1f752) @@ -0,0 +1,241 @@ +# -*- 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_main_treatment_ultrafilteration +# date 2020/01/11 +# author Joseph Varghese +# +# NOTE: +# This test contradicts verification of ultrafilteration(uf) from main treatment section. +# section + + +import names +from dialin.ui import utils +from dialin.common.ui_defs import TXStates as uf_states +from dialin.ui.hd_simulator import HDSimulator +from configuration import config + +TREATMENT_ULTRAFILTERATION_FLOW_PARAMETERS = { + "OPTION_1" : [100, 1, 1, 1, 1, 1, 1], + "OPTION_2" : [550, 24, 32, 425, 85, 18, 36], + "OPTION_3" : [80, 125, 187, 257, 530, 458, 985], + "OPTION_4" : [100, 0, 0, 0, 0, 0, 0], + "OPTION_5" : [220, 1.45, 1.45, 1.45, 1.45, 1.45], + } + +TREATMENT_ULTRAFILTERATION_TESTING_OPTION = { + "OPTION_1" : {"uf_maximum" : 600, "uf_minimum" : 120}, + "OPTION_2" : {"uf_maximum" : 500, "uf_minimum" : 0}, + "OPTION_3" : {"uf_maximum" : 550, "uf_minimum" : 0}, + "OPTION_4" : {"uf_maximum" : 300, "uf_minimum" : 0}, + "OPTION_5" : {"uf_maximum" : 280, "uf_minimum" : 0}, + "OPTION_6" : {"uf_maximum" : 765, "uf_minimum" : 500}, + "OPTION_7" : {"uf_maximum" : 680, "uf_minimum" : 450}, + "OPTION_8" : {"uf_maximum" : 480, "uf_minimum" : 380}, + "OPTION_9" : {"uf_maximum" : 390, "uf_minimum" : 675}, + "OPTION_10" : {"uf_maximum" : 290, "uf_minimum" : 125}, + } + + +hd_simulator = HDSimulator() + + +def verification_of_uf_from_main_treatment(): + """ + Tests to verify components of ultrafilteration from dialysis section. + @return: N/A + """ + test.compare(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).visible, True, "ultrafilteration section is visible") + test.compare((waitForObject(names.o_uf_minimum_value).text), format(utils.ml2l(config.UF_MINIMUM_VALUE), '.3f'), "verified ultrafilteration minimum value") + test.compare((waitForObject(names.o_uf_maximum_value).text), format(utils.ml2l(config.UF_MAXIMUM_VALUE), '.3f'), "verified ultrafilteration maximum value") + + +def start_test_treatment_ultrafilteration(ultrafilteration_range, uf_state): + """ + Test slider movement of ultrafilteration volume. + @param ultrafilteration_range: (dictionary) uf minimum and uf maximum volume. + @param uf_state: (int) ultrafilteration state to be set. + @return: N/A + """ + min_uf = ultrafilteration_range["uf_minimum"] + max_uf = ultrafilteration_range["uf_maximum"] + hd_simulator.cmd_set_treatment_parameter_ranges(0, 100, min_uf, max_uf, 0, 0) + for uf_value in range(min_uf, max_uf+1, 1): + hd_simulator.cmd_set_treatment_ultrafiltration_outlet_flow_data(uf_value, uf_value, 0, 0, 0, 0, 0) + test.compare(utils.l2ml(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).value), uf_value, "uf set value should be :" + str(uf_value)) + + if uf_state == uf_states.UF_PAUSED_STATE or uf_state == uf_states.UF_START_STATE: + test.compare(utils.l2ml(waitForObjectExists(names.o_volumeSlider_slider).maximum), max_uf, "maximum uf value should be :" + str(max_uf)) + #FIXME : ultrafilteration minimum range from progressbar should change based on simulator input + test.compare(utils.l2ml(waitForObjectExists(names.o_volumeSlider_slider).minimum), min_uf, "minimum uf value should be :" + str(min_uf)) + + +def reset_treatment_ultrafiltration(): + """ + Test to reset ultrafilteration volume. + @param : N/A + @return: N/A + """ + hd_simulator.cmd_set_treatment_ultrafiltration_outlet_flow_data(0, 0, 0, 0, 0, 0, 0) + test.compare(waitForObjectExists(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration).value, 0, "uf treatment reset to 0") + + +def treatment_ultrafilteration_based_on_flow_parameter(ultrafilteration_flow_parameter): + """ + Test to verify ultrafilteration volume based on flow parameters (Rotational speed, Motor speed, + MC speed, MC current and PWM) + @param ultrafilteration_flow_parameter[0]: (float) Ref UF Volume + @param ultrafilteration_flow_parameter[1]: (float) Measured UF Volume + @param ultrafilteration_flow_parameter[2]: (float) Rot Speed + @param ultrafilteration_flow_parameter[3]: (float) Motor Speed + @param ultrafilteration_flow_parameter[4]: (float) MC Speed + @param ultrafilteration_flow_parameter[5]: (float) MC Current + @param ultrafilteration_flow_parameter[6]: (float) PWM + @return: none + """ + ref_uf_vol = ultrafilteration_flow_parameter[0] + measured_uf_vol = ultrafilteration_flow_parameter[0] + rot_speed = ultrafilteration_flow_parameter[0] + mot_speed = ultrafilteration_flow_parameter[0] + mc_speed = ultrafilteration_flow_parameter[0] + mc_current = ultrafilteration_flow_parameter[0] + pwm = ultrafilteration_flow_parameter[0] + hd_simulator.cmd_set_treatment_ultrafiltration_outlet_flow_data(ref_uf_vol, measured_uf_vol, + rot_speed, mot_speed, mc_speed, + mc_current, pwm) + test.passes("test to verify ultrafilteration flow parameters.") + + +def test_treatment_ultrafilteration(uf_states): + """ + Test to verify slider movement based on edge condition. + @param uf_state: (int) ultrafilteration state to be set. + @return: N/A + """ + test.startSection("verification of uf value on main treatment section") + #FIXME: Slider shows some unexpected behaviour during its movement. + start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_1"], uf_states) + start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_2"], uf_states) + start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_3"], uf_states) + start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_4"], uf_states) + start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_5"], uf_states) + start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_6"], uf_states) + start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_7"], uf_states) + start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_8"], uf_states) + start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_9"], uf_states) + start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_10"],uf_states) + test.endSection() + + +def verify_ultrafilteration_paused_state(uf_states): + """ + Test to verify ultrafilteration paused state. + @param uf_state: (int) ultrafilteration state to be set - pause set. + @return: N/A + """ + test.startSection("verification of ultrafilteration paused state") + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_accepted(state= uf_states) + + mouseClick(waitForObject(names.o_ultrafilteration_closeButton)) + utils.waitForGUI(0.2) + test.compare(waitForObjectExists(names.o_treatmenthome_ultrafiltration_paused_text).text, config.PAUSED_TEXT, "paused text verified ") + mouseClick(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration) + + test.compare(waitForObjectExists(names.o_ultrafiltration_paused_text).text, config.PAUSED_TEXT, "paused text verified ") + test.compare(waitForObjectExists(names.o_resume_ultrafilteration_text).text, config.RESUME_TEXT, "resume text verified ") + test.compare(waitForObjectExists(names.o_uf_edit_ultrafilteration_volume).text, config.EDIT_TEXT, "edit text verified ") + test.compare(waitForObjectExists(names.o_ultrafilteration_volume_text).text, config.TITLE_TEXT, "title text verified ") + + mouseClick(names.o_uf_edit_ultrafilteration_volume) + test.compare(waitForObjectExists(names.o_ultrafiltration_paused_text).text, config.PAUSED_TEXT, "paused text verified ") + + test.endSection() + + +def verify_ultrafilteration_start_state(uf_states): + """ + Test to verify ultrafilteration start state. + @param uf_state: (int) ultrafilteration state to be set - start state. + @return: N/A + """ + test.startSection("verification of ultrafilteration start state") + + mouseClick(waitForObject(names.o_backbutton_backbutton)) + mouseClick(waitForObject(names.o_ultrafilteration_closeButton)) + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_accepted(state= uf_states) + utils.waitForGUI(0.2) + + mouseClick(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration) + test.compare(waitForObjectExists(names.o_uf_edit_ultrafilteration_volume).text, config.EDIT_TEXT, "edit text verified ") + test.compare(waitForObjectExists(names.o_ultrafilteration_volume_text).text, config.TITLE_TEXT, "title text verified ") + + mouseClick(names.o_uf_edit_ultrafilteration_volume) + test.compare(waitForObjectExists(names.o_ultrafilteration_volume_text).text, config.TITLE_TEXT, "title text verified ") + test.endSection() + + +def verify_ultrafilteration_running_state(uf_states): + """ + Test to verify ultrafilteration running state. + @param uf_state: (int) ultrafilteration state to be set - running state. + @return: N/A + """ + test.startSection("verification of ultrafilteration running state") + + mouseClick(waitForObject(names.o_backbutton_backbutton)) + mouseClick(waitForObject(names.o_ultrafilteration_closeButton)) + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_accepted(state= uf_states) + utils.waitForGUI(0.2) + + mouseClick(names.o_treatmentStart_ultrafiltrationTouchArea_TreatmentUltrafiltration) + test.compare(waitForObjectExists(names.o_ultrafilteration_volume_text).text, config.TITLE_TEXT, "title text verified ") + + for rejection in range(1, config.NUM_OF_REQUEST_REJECT_REASONS + 1): + hd_simulator.cmd_set_treatment_adjust_ultrafiltration_rejected(reason = rejection, state = uf_states) + rejection_message = waitForObjectExists(names.o_notificationbar_response) + test.compare(rejection_message.text, config.REJECTION_REASON[rejection], "expected rejection {msg} displayed".format(msg=config.REJECTION_REASON[rejection])) + + test.endSection() + + +def main(): + utils.tstStart(__file__) + startApplication(config.AUT_NAME) + + utils.waitForGUI(2) + + #navigate to dialysis state + 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) + + verification_of_uf_from_main_treatment() + + reset_treatment_ultrafiltration() + + verify_ultrafilteration_paused_state(uf_states.UF_PAUSED_STATE) + test_treatment_ultrafilteration(uf_states.UF_PAUSED_STATE) + + test.startSection("verification of ultrafilteration flow parameters based on uf values") + treatment_ultrafilteration_based_on_flow_parameter(TREATMENT_ULTRAFILTERATION_FLOW_PARAMETERS["OPTION_1"]) + treatment_ultrafilteration_based_on_flow_parameter(TREATMENT_ULTRAFILTERATION_FLOW_PARAMETERS["OPTION_2"]) + treatment_ultrafilteration_based_on_flow_parameter(TREATMENT_ULTRAFILTERATION_FLOW_PARAMETERS["OPTION_3"]) + treatment_ultrafilteration_based_on_flow_parameter(TREATMENT_ULTRAFILTERATION_FLOW_PARAMETERS["OPTION_4"]) + treatment_ultrafilteration_based_on_flow_parameter(TREATMENT_ULTRAFILTERATION_FLOW_PARAMETERS["OPTION_5"]) + test.endSection() + + verify_ultrafilteration_start_state(uf_states.UF_START_STATE) + test_treatment_ultrafilteration(uf_states.UF_START_STATE) + + verify_ultrafilteration_running_state(uf_states.UF_RUNNING_STATE) + test_treatment_ultrafilteration(uf_states.UF_RUNNING_STATE) + + utils.tstDone() +