Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -r75e3ab588237239452761d2ec90e8b3aec6a916b -r8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 75e3ab588237239452761d2ec90e8b3aec6a916b) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab) @@ -87,8 +87,8 @@ COMPLETE = 'Complete' HEPARIN = "Heparin" CREATERX = "Rx" -VALIDATE = "VALIDATE" -CONFIRM = "CONFIRM" +VALIDATE = "Validate" +CONFIRM = "Confirm" NEXT ="Next" Index: suite_leahi/shared/scripts/configuration/navigation.py =================================================================== diff -u -rc7d96b722594bb29a7bbc3689715b90af6e3d616 -r8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab --- suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision c7d96b722594bb29a7bbc3689715b90af6e3d616) +++ suite_leahi/shared/scripts/configuration/navigation.py (.../navigation.py) (revision 8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab) @@ -4,6 +4,8 @@ from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes, TDStandbyStates from configuration import config, utility +from configparser import ConfigParser +from pathlib import Path td_simulator = TD_Messaging() @@ -34,6 +36,26 @@ ), ) + + +def get_ini_value(conf_path: str , section: str, key: str): + path = Path(conf_path) + if not path.exists(): + raise FileNotFoundError(f"Not found: {path}") + parser = ConfigParser() + # Preserve case if needed: + # parser.optionxform = str + parser.read(path, encoding="utf-8") + if not parser.has_section(section): + raise KeyError(f"Section [{section}] not found in {path}") + if not parser.has_option(section, key): + raise KeyError(f"Key '{key}' not found in section [{section}]") + return parser.get(section, key) + +# Example: +# value = get_ini_value("settings.conf", "database", "host") +# print(value) + def navigation_pageIndicator_step(vStep_name): """ Navigate to the specified page using the step indicator component. @@ -45,16 +67,36 @@ """ test.startSection("Method to navigation in the pretreatment page ") + stepcount = squish.waitForObjectExists(names.o_preTreatmentStack_repeater_Repeater) + Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) + squish.mouseClick(squish.waitForObject(Nextbutton)) + autoLoadbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text ="Auto Load") + squish.mouseClick(squish.waitForObject(autoLoadbutton)) + td_simulator.td_blood_set_auto_load_response(vRejectionReason = 0) stepId = squish.waitForObjectExists(names.o_preTreatmentStack_stepIndicator_StepIndicator) values = utility.findAllObjectsById(stepId, "_text") - for index, input_field in enumerate(values[2:]): - test.log(str(index)); - test.log(str(input_field.text)) - if str(input_field.text) == vStep_name: - test.log("Reached the target step") - break - else: - Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) - squish.mouseClick(Nextbutton) + value = get_ini_value("/home/denali/Public/luis/config/configurations/Settings/System.conf", section ="AdvancedMode", key ="AdvancedMode") + if stepcount.count == 9: + for input_field in values[3:]: + test.log(str(input_field.text)) + if str(input_field.text) == "Water Sample": + squish.mouseClick(squish.waitForObject(names.o_PreTreatmentSampleStack_button_TouchRect)) + if str(input_field.text) == vStep_name: + break + else: + Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) + squish.mouseClick(Nextbutton) + else: + for input_field in values[3:]: + test.log(str(input_field.text)) + if str(input_field.text) == "Water Sample": + squish.mouseClick(waitForObject(names.o_PreTreatmentSampleStack_button_TouchRect)) + + if str(input_field.text) == vStep_name: + break + else: + Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) + squish.mouseClick(Nextbutton) + test.endSection() \ No newline at end of file Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -rc7d96b722594bb29a7bbc3689715b90af6e3d616 -r8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision c7d96b722594bb29a7bbc3689715b90af6e3d616) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab) @@ -131,6 +131,7 @@ def verify_create_treatment_parameters(): test.startSection("Pre treatment parameters") navigation.navigation_pageIndicator_step(config.CREATERX) + # squish.mouseClick(names.o_PreTreatmentSampleStack_failContainer_WaterSampleContainer) squish.mouseClick(squish.waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry)) squish.waitForObject(names.o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry).text ="abcd" set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 60) @@ -143,7 +144,7 @@ set_value_based_on_target(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,37.0) select_different_dropdown(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox,config.DIALYZER_TYPE,2) set_value_based_on_target(names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster, 200) - select_different_dropdown(names.o_PreTreatment_vitalsCombobox_BaseCombobox,config.VITALS,1) + set_value_based_on_target(names.o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjusterCustom,5.0) select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,config.BICARBONATE,0) Validatebutton = setObjectText(obj = names.o_preTreatmentStack_Text, text =config.VALIDATE) squish.mouseClick(squish.waitForObject(Validatebutton)) @@ -168,9 +169,7 @@ vHeparinDispensingRateRejectReason = 0, vHeparinBolusVolumeRejectReason = 0 ) - - confirmButton = setObjectText(obj = names.o_preTreatmentStack_Text,text = config.CONFIRM ) - squish.mouseClick(squish.waitForObject(confirmButton)) + squish.mouseClick(names.o_preTreatmentStack_confirmButton_ConfirmButton) test.endSection() def findAllObjectsById(parent, target_id): Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -r0e16f6d7e1f8349a7ccf945c666f6fdab7752d16 -r8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab --- suite_leahi/shared/scripts/names.py (.../names.py) (revision 0e16f6d7e1f8349a7ccf945c666f6fdab7752d16) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision 8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab) @@ -223,4 +223,39 @@ o_PreTreatmentCreate_pretreatmentPatientIDEntry_TextEntry = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_pretreatmentPatientIDEntry", "type": "TextEntry", "unnamed": 1 } o_preTreatmentStack_Text = {"container": o_preTreatmentStack_PreTreatmentStack, "type": "Text", "unnamed": 1 } o_preTreatmentStack_stepIndicator_StepIndicator = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_stepIndicator", "type": "StepIndicator", "unnamed": 1 } - + +#end treatement +o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_PreTreatmentSampleStack", "type": "PreTreatmentWaterSample", "visible": True} +o_PreTreatmentSampleStack_failContainer_WaterSampleContainer = {"container": o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample, "id": "_failContainer", "type": "WaterSampleContainer", "unnamed": 1, "visible": True} +# o_treatmentHome_editButton_IconButton = {"container": mainTreatmentScreen, "id": "_editButton", "occurrence": 3, "type": "IconButton", "unnamed": 1, "visible": True} +o_arterialWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_arterialWindow", "type": "LabelUnitValueAdjuster", "visible": True} +o_venousWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_venousWindow", "type": "LabelUnitValueAdjuster", "visible": True} +o_venousAsymmetricWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_venousAsymmetricWindow", "type": "LabelUnitValueAdjuster", "visible": True} +o_tmpWindow_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_tmpWindow", "type": "LabelUnitValueAdjuster", "visible": True} +o_PreTreatmentSampleStack_button_TouchRect = {"container": o_preTreatmentStack_PreTreatmentSampleStack_PreTreatmentWaterSample, "id": "_button", "occurrence": 2, "type": "TouchRect", "unnamed": 1, "visible": True} +o_preTreatmentStack_repeater_Repeater = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "repeater", "type": "Repeater", "unnamed": 1, "visible": True} +o_preTreatmentStack_gridSteps_Grid = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_gridSteps", "type": "Grid", "unnamed": 1, "visible": True} +o_preTreatmentStack_gridSteps_Grid_2 = {"container": o_preTreatmentStack_PreTreatmentStack, "id": "_gridSteps", "occurrence": 2, "type": "Grid", "unnamed": 1, "visible": True} +o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjusterCustom = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_bpMeasurementIntervalControl", "type": "ValueAdjusterCustom", "unnamed": 1} +o_preTreatmentStack_confirmButton_ConfirmButton = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_confirmButton", "type": "ConfirmButton", "visible": True} +o_preTreatmentStack_Validate_Text = {"container": o_preTreatmentStack_PreTreatmentStack, "text": "Validate", "type": "Text", "unnamed": 1, "visible": True} +o_notification_bar ={"container": o_Overlay, "objectName": "NotificationBar", "type": "NotificationBarSmall"} +# o_treatmentHome_iconImage_Image = {"container": mainTreatmentScreen, "id": "_iconImage", "occurrence": 2, "source": "qrc:/images/iEdit", "type": "Image", "unnamed": 1, "visible": True} +o_treatmentHome_editButton_IconButton = {"container": mainTreatmentScreen, "id": "_editButton", "type": "IconButton", "unnamed": 1 } +o_treatmentHome_treatmentPressures_TreatmentPressures = {"container": mainTreatmentScreen, "objectName": "treatmentPressures", "type": "TreatmentPressures", "visible": True} +o_valueAdjuster_ValueAdjuster = {"container": o_Overlay, "objectName": "_valueAdjuster", "type": "ValueAdjuster", "visible": True} +o_treatmentHome_editButton_IconButton_2 = {"container": mainTreatmentScreen, "id": "_editButton", "type": "IconButton", "unnamed": 1 } +o_treatmentHome_treatmentFlows_TreatmentFlows = {"container": mainTreatmentScreen, "objectName": "treatmentFlows", "type": "TreatmentFlows", "visible": True} +o_dialysateFlowRate_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_dialysateFlowRate", "type": "LabelUnitValueAdjuster", "visible": True} +o_bloodFlowRate_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_bloodFlowRate", "type": "LabelUnitValueAdjuster", "visible": True} +o_dialysateTemperature_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_dialysateTemperature", "type": "LabelUnitValueAdjuster", "visible": True} +o_treatmentHome_upArrowIcon_ArrowButton = {"container": mainTreatmentScreen, "objectName": "upArrowIcon", "type": "ArrowButton", "visible": True} +o_treatmentHome_downArrowIcon_ArrowButton = {"container": mainTreatmentScreen, "objectName": "downArrowIcon", "type": "ArrowButton", "visible": True} +o_treatmentHome_notification_NotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "_notification", "type": "NotificationBarSmall"} +o_ufVolumeRemoved_LabelUnitText = {"container": o_Overlay, "objectName": "_ufVolumeRemoved", "type": "LabelUnitText", "visible": True} +o_ufVolumeGoal_LabelUnitText = {"container": o_Overlay, "objectName": "_ufVolumeGoal", "type": "LabelUnitText", "visible": True} +o_timeElapsed_LabelUnitText = {"container": o_Overlay, "objectName": "_timeElapsed", "type": "LabelUnitText", "visible": True} +o_newTreatmentDuration_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_newTreatmentDuration", "type": "LabelUnitValueAdjuster", "visible": True} +# o_treatmentHome_upArrowIcon_ArrowButton_2 = {"container": mainTreatmentScreen, "objectName": "upArrowIcon", "occurrence": 2, "type": "ArrowButton", "visible": True} + + Index: suite_leahi/tst_edit_parameters/test.py =================================================================== diff -u --- suite_leahi/tst_edit_parameters/test.py (revision 0) +++ suite_leahi/tst_edit_parameters/test.py (revision 8a2c16a0af26e03c9bcb54dcb3c6b88907ffddab) @@ -0,0 +1,512 @@ +# -*- coding: utf-8 -*- + +import names +import squish +from leahi_dialin.ui import utils +from configuration import utility,config,navigation +from configuration import config +from leahi_dialin.ui.td_messaging import TD_Messaging +from leahi_dialin.common.ui_defs import TXStates +from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.utils import conversions +import can +from leahi_dialin.protocols import CAN + +td =TD_Messaging() +# ArtWindow ="0" +# Venouspressurewindow = "0" +# venouspressurelimitasymetric ="0" +# tmppressurelimut ="0" +# salineBolusvalue ="0" + + + +def handle_saline_request( message, timestamp = 0.0): + """ + Called when the user requests to firmware from UI + @return: None + """ + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + + state,index = conversions.bytearray_to_integer( message, index) + global saline + saline = state + +def handle_treatment_request( message, timestamp = 0.0): + """ + Called when the user requests to firmware from UI + @return: None + """ + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + + state,index = conversions.bytearray_to_integer( message, index) + global bloodflowrate + bloodflowrate = state + + state,index = conversions.bytearray_to_integer( message, index) + global dialysateflow + dialysateflow = state + + val,self.index = conversions.bytearray_to_integer( message, self. Index) + global dialysatetemperature + dialysatetemperature = val + + +def handle_pressure_request( message, timestamp = 0.0): + """ + Called when the user requests to firmware from UI + @return: None + """ + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + + state,index = conversions.bytearray_to_integer( message, index) + global ArtWindow + ArtWindow = state + test.log("Inside function") + test.log(str(ArtWindow)) + + state,index = conversions.bytearray_to_integer( message, index) + global Venouspressurewindow + Venouspressurewindow= state + + state,index = conversions.bytearray_to_integer( message, index) + global venouspressurelimitasymetric + venouspressurelimitasymetric = state + + state,index = conversions.bytearray_to_integer( message, index) + global tmppressurelimut + tmppressurelimut = state + +def handle_bloodflow_request(): + message = message['message'] + index = MsgFieldPositions.START_POS_FIELD_1 + state,index = conversions.bytearray_to_integer( message, index) + global bloodflow + bloodflow = state + + +def main(): + can_interface = td.can_interface + global ArtWindow + global Venouspressurewindow + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_pressure_request) + + + utils.tstStart(__file__) + startApplication(config.AUT_NAME) + td.td_operation_mode(TDOpModes.MODE_STAN.value) + # mouseClick(waitForObject(names.o_createTreatmentRect_TouchRect)) + # td.td_operation_mode(TDOpModes.MODE_PRET.value) + # utility.verify_create_treatment_parameters() + td.td_tx_state( TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0) + td.td_pressure(H2_arterial_pressure = 40, + H14_venous_pressure = 50 , + limit_state = 0, + H2_arterial_min = -390, + H2_arterial_max = 220 , + H14_venous_min = -90 , + H14_venous_max = 410 , + H2_arterial_long = 0 , + H14_venous_long = 0 , + tmp_pressure = 43 , + tmp_min = -640 , + tmp_max = 210) + + # mouseClick(waitForObject(names.o_treatmentHome_editButton_IconButton)) + pressureEdit = waitForObject(names.o_treatmentHome_treatmentPressures_TreatmentPressures) + parent = utility.findObjectById(pressureEdit, "_editButton") + mouseClick(parent) + test.log("Check pressure edit values") + #check the values in edit pressure + + venouswindow_value = waitForObject(names.o_venousWindow_LabelUnitValueAdjuster) + test.log(str(venouswindow_value.value)) + tmpwindow_value = waitForObject(names.o_tmpWindow_LabelUnitValueAdjuster) + test.log(str(tmpwindow_value.value)) + utility.set_value_based_on_target(names.o_arterialWindow_LabelUnitValueAdjuster,80) + arterialwindow_value = waitForObject(names.o_arterialWindow_LabelUnitValueAdjuster) + Arterial_Value =arterialwindow_value.value + utility.set_value_based_on_target(names.o_venousWindow_LabelUnitValueAdjuster,60) + utility.set_value_based_on_target(names.o_tmpWindow_LabelUnitValueAdjuster,100) + + #rejection reason is 1 + payload = conversions.integer_to_bytearray(0) + payload += conversions.integer_to_bytearray(1) + td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_PRESSURE_LIMITS_CHANGE_RESPONSE.value, + reason=0, + accepted=1, + is_pure_data = False, + has_parameters = True, + parameters_payload= payload) + + rejectionReason = utility.get_object_from_names(names.o_notification_bar) + test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) + + # handle sent messages from UI + + mouseClick(waitForObject(names.o_confirmButton_TouchRect)) + # if can_interface is not None: + # channel_id = CAN.DenaliChannels.ui_to_td_ch_id + # message_id = MsgIds.MSG_ID_UI_PRESSURE_LIMITS_CHANGE_REQUEST.value + # can_interface.register_receiving_publication_function(channel_id, + # message_id, + # handle_pressure_request) + # + + + + #rejection reason 0 + payload = conversions.integer_to_bytearray(1) + payload += conversions.integer_to_bytearray(0) + td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_PRESSURE_LIMITS_CHANGE_RESPONSE.value, + reason=0, + accepted=1, + is_pure_data = False, + has_parameters = True, + parameters_payload= payload) + + test.log(str(ArtWindow)) + test.verify(Venouspressurewindow == venouswindow_value.value ) + pressurepopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) + test.compare(pressurepopup, True, "Popup is not present") + + + test.startSection("Saline data") + td.td_saline( + 100 , # target_volume + 150 , # cumulative_volume + 75 , # bolus_volume + 0 + ) + + mouseClick(waitForObject(names.o_treatmentHome_editButton_IconButton)) + fluidbolusvolume_value = waitForObject(names.o_valueAdjuster_ValueAdjuster) + test.log(str(fluidbolusvolume_value.value)) + utility.set_value_based_on_target(names.o_valueAdjuster_ValueAdjuster,200) + + payload = conversions.integer_to_bytearray(0) + payload += conversions.integer_to_bytearray(1) + td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_BOLUS_VOLUME_CHANGE_RESPONSE.value, + reason=0, + accepted=1, + is_pure_data = False, + has_parameters = True, + parameters_payload= payload) + + rejectionReason = utility.get_object_from_names(names.o_notification_bar) + test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) + #rejection reason 0 + + + mouseClick(waitForObject(names.o_confirmButton_TouchRect)) + payload = conversions.integer_to_bytearray(1) + payload += conversions.integer_to_bytearray(0) + td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_BOLUS_VOLUME_CHANGE_RESPONSE.value, + reason=0, + accepted=1, + is_pure_data = False, + has_parameters = True, + parameters_payload= payload) + # handle sent messages from UI + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_BOLUS_VOLUME_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_saline_request) + + # test.log(str(salineBolusvalue)) + salinepopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) + test.compare(salinepopup, True, "Popup is not present") + #check the recieved values + test.startSection("Treatment Parameters") + td.td_treatment_set_points( blood_flow = 42, + dialysate_flow = 43, + dialysate_temp = 49) + test.log("Sample") + treatmentEdit = waitForObject(names.o_treatmentHome_treatmentFlows_TreatmentFlows) + treatmentEditbutton = utility.findObjectById(treatmentEdit, "_editButton") + mouseClick(treatmentEditbutton) + bloodFlow = waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster) + bloodflowvalue = utility.findObjectById(bloodFlow, "_valueAdjuster") + test.log(str(bloodflowvalue.value)) + test.log(str(waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + utility.set_value_based_on_target(names.o_bloodFlowRate_LabelUnitValueAdjuster,"50") + test.log(str(bloodflowvalue.value)) + test.log(str(waitForObject(names.o_bloodFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + dialysateFlow = waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster) + dialysateflowvalue = utility.findObjectById(dialysateFlow, "_valueAdjuster") + test.log(str(dialysateflowvalue.value)) + test.log(str(waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + utility.set_value_based_on_target(names.o_dialysateFlowRate_LabelUnitValueAdjuster,"50") + test.log(str(dialysateflowvalue.value)) + test.log(str(waitForObject(names.o_dialysateFlowRate_LabelUnitValueAdjuster).valueTextColor.name)) + dialysateTemp = waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster) + dialysatetempvalue = utility.findObjectById(dialysateTemp, "_valueAdjuster") + test.log(str(dialysatetempvalue.value)) + test.log(str(waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster).valueTextColor.name)) + utility.set_value_based_on_target(names.o_dialysateTemperature_LabelUnitValueAdjuster,"38") + test.log(str(dialysatetempvalue.value)) + test.log(str(waitForObject(names.o_dialysateTemperature_LabelUnitValueAdjuster).valueTextColor.name)) + #rejection reason is 1 + payload = conversions.integer_to_bytearray(0) + payload += conversions.integer_to_bytearray(1) + td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_TREATMENT_SET_POINTS_CHANGE_RESPONSE.value, + reason=0, + accepted=1, + is_pure_data = False, + has_parameters = True, + parameters_payload= payload) + + rejectionReason = utility.get_object_from_names(names.o_notification_bar).text + test.compare(rejectionReason, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) + #rejection reason is 0 + mouseClick(waitForObject(names.o_confirmButton_TouchRect)) + payload = conversions.integer_to_bytearray(1) + payload += conversions.integer_to_bytearray(0) + td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_TREATMENT_SET_POINTS_CHANGE_RESPONSE.value, + reason=0, + accepted=1, + is_pure_data = False, + has_parameters = True, + parameters_payload= payload) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINTS_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_treatment_request) + + # test.log(str(salineBolusvalue)) + treatmentpopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) + test.compare(treatmentpopup, True, "Popup is not present") + test.endSection() + test.startSection("Main treatment screen check the set points") + td.td_treatment_set_points( blood_flow = 70, + dialysate_flow = 70, + dialysate_temp = 36) + + bloodflowUpArrow = waitForObject(names.o_blood_flow_value) + bloodflowUpArrowbutton = utility.findObjectById(bloodflowUpArrow,"_upArrowIcon") + mouseClick(bloodflowUpArrowbutton) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_bloodflow_request) + + #check the value incremented in blood flow + + bloodflowdownArrowbutton = utility.findObjectById(bloodflowUpArrow,"_downArrowIcon") + mouseClick(bloodflowdownArrowbutton) + #check the decremented value + + dialysateflowuparrow = waitForObject(names.o_dial_flow_value) + dialysateflowuparrowbutton = utility.findObjectById(dialysateflowuparrow,"_upArrowIcon") + mouseClick(dialysateflowuparrowbutton) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_DIALYSATE_FLOW_CHANGE_RESPONSE.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_bloodflow_request) + + #check the value incremented in dialysate flow value + + dialysateflowdownArrowbutton = utility.findObjectById(dialysateflowuparrow,"_downArrowIcon") + mouseClick(dialysateflowdownArrowbutton) + #check the decremented value + + dialysatetempuparrow = waitForObject(names.o_dial_tmp_value) + dialysatetempuparrowbutton = utility.findObjectById(dialysatetempuparrow,"_upArrowIcon") + mouseClick(dialysatetempuparrowbutton) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_DIALYSATE_TEMPERATURE_CHANGE_RESPONSE.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_bloodflow_request) + + #check the value incremented in dialysate flow value + + dialysatetempdownArrowbutton = utility.findObjectById(dialysatetempuparrow,"_downArrowIcon") + mouseClick(dialysatetempdownArrowbutton) + + + + #rejection reason is 1 + payload = conversions.integer_to_bytearray(0) + payload += conversions.integer_to_bytearray(1) + td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_RESPONSE.value, + reason=0, + accepted=1, + is_pure_data = False, + has_parameters = True, + parameters_payload= payload) + + rejectionReason = utility.get_object_from_names(names.o_treatmentHome_notification_NotificationBarSmall) + test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) + + #rejection reason is 0 + payload = conversions.integer_to_bytearray(1) + payload += conversions.integer_to_bytearray(0) + td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_RESPONSE.value, + reason=0, + accepted=1, + is_pure_data = False, + has_parameters = True, + parameters_payload= payload) + + #need to verify the response + + td.td_treatment_set_points( blood_flow = 94, + dialysate_flow = 94, + dialysate_temp = 28) + + bloodflowUpArrow = waitForObject(names.o_blood_flow_value) + bloodflowUpArrowbutton = utility.findObjectById(bloodflowUpArrow,"_upArrowIcon") + mouseClick(bloodflowUpArrowbutton) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINT_BLOOD_FLOW_CHANGE_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_bloodflow_request) + + #check the value incremented in blood flow + + dialysateflowuparrow = waitForObject(names.o_dial_flow_value) + dialysateflowuparrowbutton = utility.findObjectById(dialysateflowuparrow,"_upArrowIcon") + mouseClick(dialysateflowuparrowbutton) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_DIALYSATE_FLOW_CHANGE_RESPONSE.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_bloodflow_request) + + #check the value incremented in dialysate flow value + + dialysatetempuparrow = waitForObject(names.o_dial_tmp_value) + dialysatetempuparrowbutton = utility.findObjectById(dialysatetempuparrow,"_upArrowIcon") + mouseClick(dialysatetempuparrowbutton) + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_TD_TREATMENT_SET_POINT_DIALYSATE_TEMPERATURE_CHANGE_RESPONSE.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_bloodflow_request) + + #check the value incremented in dialysate flow value + test.endSection() + + test.startSection("Treatment Duration Edit") + td.td_treatment_time( tx_duration_s = 51 , + tx_elapsed_s = 5 , + tx_remaining_s = 6 ) + td.td_ultrafiltration(10,0.53,0.37,0) + + td.td_param_ranges(min_tx_time_s = 50, + max_tx_time_s = 300, + min_uf_volume_mL = 0.0, + max_uf_volume_mL = 1790, + min_dial_rate_mLH = 0, + max_dial_rate_mLH = 0) + + treatmentEdit = waitForObject(names.o_treatment_duration) + treatmentEditbutton = utility.findObjectById(treatmentEdit,"_editTimeIcon") + mouseClick(treatmentEditbutton) + ufvolumeremoved = waitForObject(names.o_ufVolumeRemoved_LabelUnitText).value + test.log(str(ufvolumeremoved)) + ufvolumegoal =waitForObject(names.o_ufVolumeGoal_LabelUnitText) + test.log(str(ufvolumegoal)) + treatmenttimeelapsed =waitForObject(names.o_timeElapsed_LabelUnitText) + test.log(str(treatmenttimeelapsed)) + utility.set_value_based_on_target(names.o_newTreatmentDuration_LabelUnitValueAdjuster,51) + utility.set_value_based_on_target(names.o_newTreatmentDuration_LabelUnitValueAdjuster,300) + #rejection reason 0 + # payload = conversions.integer_to_bytearray(1) + # payload += conversions.integer_to_bytearray(0) + # td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_DURATION_CONFIRM_RESPONSE.value, + # reason=0, + # accepted=1, + # is_pure_data = False, + # has_parameters = True, + # parameters_payload= payload) + # + # #need to verify the response + # + # + + #rejection reason is 1 + td.td_duration_validate_response(vRejectionReason =1, + vDuration= 78, + vUFVolume= 0.9, + vUFRate= 0.6) + + rejectionReason = utility.get_object_from_names(names.o_notification_bar) + test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) + + td.td_duration_validate_response(vRejectionReason =0, + vDuration= 78, + vUFVolume= 0.9, + vUFRate= 0.6) + + + #need to check the request + #rejection reason is 1 + payload = conversions.integer_to_bytearray(0) + payload += conversions.integer_to_bytearray(1) + td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_DURATION_CONFIRM_RESPONSE.value, + reason=0, + accepted=1, + is_pure_data = False, + has_parameters = True, + parameters_payload= payload) + + rejectionReason = utility.get_object_from_names(names.o_notification_bar).text + test.compare(rejectionReason, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str("[1] Request is not allowed in the current operating mode")) + #rejection reason is 0 + mouseClick(waitForObject(names.o_confirmButton_TouchRect)) + payload = conversions.integer_to_bytearray(1) + payload += conversions.integer_to_bytearray(0) + td.cmd_send_general_response(message_id =MsgIds.MSG_ID_TD_DURATION_CONFIRM_RESPONSE.value, + reason=0, + accepted=1, + is_pure_data = False, + has_parameters = True, + parameters_payload= payload) + # if can_interface is not None: + # channel_id = CAN.DenaliChannels.ui_to_td_ch_id + # message_id = MsgIds.MSG_ID_UI_TREATMENT_SET_POINTS_CHANGE_REQUEST.value + # can_interface.register_receiving_publication_function(channel_id, + # message_id, + # handle_treatment_request) + + + treatmentpopup = waitFor(lambda: not object.exists(names.o_HeaderBar_WiFi_Popup), 3000) + test.compare(treatmentpopup, True, "Popup is not present") + + + + + \ No newline at end of file