Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -rc0d9893f44e051049320208fef519339f1e78ecb -rfc2ce7fc0911c43127dd55ce45f305618ca8ffc9 --- suite_leahi/shared/scripts/names.py (.../names.py) (revision c0d9893f44e051049320208fef519339f1e78ecb) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision fc2ce7fc0911c43127dd55ce45f305618ca8ffc9) @@ -2,13 +2,106 @@ from objectmaphelper import * -o_Gui_MainView = { "type": "Gui::MainView", "unnamed": 1 } -standByScreen_MainHome = {"container": o_Gui_MainView, "type": "MainHome" } -treatmentStack = {"container": o_Gui_MainView, "type": "TreatmentStack" } -startTreatmentButton = {"container": standByScreen_MainHome, "id": "_startTreatmentRect", "type": "TouchRect", "unnamed": 1 } -mainTreatmentScreen = {"container": treatmentStack, "id": "_treatmentHome", "type": "TreatmentHome", "unnamed": 1 } -startFluidButton = {"container": mainTreatmentScreen, "id": "_startFluidButton", "type": "TouchRect", "unnamed": 1 } -salineDeliveredText = {"container": mainTreatmentScreen, "objectName": "salineDescriptionText", "type": "Text" } -currentBolusVolume = {"container": mainTreatmentScreen, "type": "Label", "unnamed": 1 } -treatmentSaline = {"container": mainTreatmentScreen, "objectName": "treatmentSaline", "type": "TreatmentSaline" } -salineProgressBar = {"container": mainTreatmentScreen, "id": "_fluidProgressBar", "type": "ProgressBar", "unnamed": 1 } +AUT_NAME ="leahi" + +# Top Parents +o_Gui_MainView = { "type": "Gui::MainView", "unnamed": 1 } +o_QQuickView = { "type": "QQuickView"} +o_Overlay = {"container": o_QQuickView, "type": "Overlay"} +standByScreen_MainHome = {"container": o_Gui_MainView, "type": "MainHome" } +treatmentStack = {"container": o_Gui_MainView, "type": "TreatmentStack" } +startTreatmentButton = {"container": o_Gui_MainView, "id": "_startTreatmentRect", "type": "TouchRect", "unnamed": 1 } +mainTreatmentScreen = {"container": treatmentStack, "id": "_treatmentHome", "type": "TreatmentHome", "unnamed": 1 } +startFluidButton = {"container": mainTreatmentScreen, "id": "_startFluidButton", "type": "TouchRect", "unnamed": 1 } +salineDeliveredText = {"container": mainTreatmentScreen, "objectName": "salineDescriptionText", "type": "Text" } +currentBolusVolume = {"container": mainTreatmentScreen, "type": "Label", "unnamed": 1 } +treatmentSaline = {"container": mainTreatmentScreen, "objectName": "treatmentSaline", "type": "TreatmentSaline" } +salineProgressBar = {"container": mainTreatmentScreen, "id": "_fluidProgressBar", "type": "ProgressBar", "unnamed": 1 } +pressure_venous_marker_text = {"container": mainTreatmentScreen, "id": "_rangeMarkerValue", "occurrence": 2, "type": "RangeMarker", "unnamed": 1 } +pressure_tmp_marker_text = {"container": mainTreatmentScreen, "id": "_rangeMarkerValue", "occurrence": 3, "type": "RangeMarker", "unnamed": 1 } +arterial_RangeBar = {"container": mainTreatmentScreen, "id": "_rangeBar", "type": "RangeBar", "unnamed": 1 } +venous_RangeBar = {"container": mainTreatmentScreen, "id": "_rangeBar", "occurrence": 2, "type": "RangeBar", "unnamed": 1 } +tmp_RangeBar = {"container": mainTreatmentScreen, "id": "_rangeBar", "occurrence": 3, "type": "RangeBar", "unnamed": 1 } +treatmentUltrafiltration = {"container": mainTreatmentScreen, "objectName": "treatmentUltrafiltration", "type": "TreatmentUltrafiltration"} +UF_Volume_Text = {"container": mainTreatmentScreen, "text": "UF Volume", "type": "Text", "unnamed": 1 } +UF_Rate_Text = {"container": mainTreatmentScreen, "text": "UF Rate", "type": "Text", "unnamed": 1 } +treatment_duration = {"container": mainTreatmentScreen, "objectName": "treatmentTime", "type": "TreatmentTime"} +UF_Volume_LabelValue = {"container": mainTreatmentScreen, "id": "_ufVolume", "type": "LabelValue", "unnamed": 1 } +UF_Rate_LabelValue = {"container": mainTreatmentScreen, "id": "_ufRate", "type": "LabelValue", "unnamed": 1 } +Volume_Delivered = {"container": mainTreatmentScreen, "id": "_valueText", "type": "Text", "unnamed": 1 } +blood_flow_value = {"container": mainTreatmentScreen, "id": "_bloodFlow", "objectName": "bloodFlowComponent", "type": "TreatmentFlowsComponent" } +dial_flow_value = {"container": mainTreatmentScreen, "objectName": "dialysateFlowComponent", "type": "TreatmentFlowsComponent" } +dial_tmp_value = {"container": mainTreatmentScreen, "id": "_dialysateTemp", "objectName": "dialysateTempComponent", "type": "TreatmentFlowsComponent" } +dial_cond_value = {"container": mainTreatmentScreen, "id": "_dialysateCond", "objectName": "dialysateCondComponent", "type": "TreatmentFlowsComponent" } +Treatment_Parameters_Text = {"container": mainTreatmentScreen, "text": "Treatment Parameters", "type": "Text", "unnamed": 1 } +pressure_arterial_marker_text = {"container": mainTreatmentScreen, "id": "_rangeMarkerValue", "type": "RangeMarker", "unnamed": 1 } +blood_flow_title_Text = {"container": mainTreatmentScreen, "objectName": "title", "text": "Blood Flow" , "type": "Text", } +dialyste_flow_title_Text = {"container": mainTreatmentScreen, "objectName": "title", "text": "Dialysate Flow", "type": "Text", } +dialyste_tmp_title_Text = {"container": mainTreatmentScreen, "objectName": "title", "text": "Dialysate Temp." , "type": "Text", } +dialyste_cond_title_Text = {"container": mainTreatmentScreen, "objectName": "title", "text": "Dialysate Cond." , "type": "Text", } +treatmentTimeNotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "notification", "type": "NotificationBarSmall" } + +#create treatement +prescription_screen = {"container": o_Gui_MainView, "type": "PreTreatmentCreateStack" , "objectName": "_PreTreatmentCreate" } +o_bullet_object = { "type": "StepBullet", "unnamed": 1 } +o_text_object = { "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_PreTreatmentCreate = {"container": prescription_screen, "type": "PreTreatmentCreate" } +o_PreTreatmentCreate_gridSteps_Grid = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_gridSteps", "type": "Grid", "unnamed": 1 } +o_PreTreatmentCreate_Prescription_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Prescription", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_Blood_Flow_Rate_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Blood Flow Rate", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_bloodFlowRate_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_bloodFlowRate", "type": "LabelUnitContainer", "unnamed": 1 } +o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_bloodFlowRateControl", "type": "ValueAdjuster", "unnamed": 1 } +PatientIDEntry_TextEntry = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_pretreatmentPatientIDEntry", "type": "TextEntry", "unnamed": 1 } +keyboard_input = {"container": o_Gui_MainView, "type": "Text", "unnamed": 1, "visible": True } +keyboard_switch = {"container": o_Gui_MainView, "id": "_shiftKeyIcon", "type": "Image", "unnamed": 1, "source": "qrc:/plugins/QtQuick/VirtualKeyboard/Styles/denali/images/iShiftNormal.svg"} +keyboard_switch2 = {"container": o_Gui_MainView, "id": "_shiftKeyIcon", "source": "qrc:/plugins/QtQuick/VirtualKeyboard/Styles/denali/images/iShiftActive.svg", "type": "Image", "unnamed": 1 } +o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_dialysateFlowRateControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_durationControl_ValueAdjuster = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_durationControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinBolusVolumeControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinDispensingRateControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_heparinDispensingRateControl_OffText = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "OFF", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinStopTimeControl", "type": "ValueAdjuster", "unnamed": 1 } +PreTreatmentCreate_heparinStopTime_OffText = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "OFF", "type": "Text", " unnamed": 1, "occurrence": 2, } +o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_dialysateTemperatureControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_salineBolusVolumeControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjuster = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_bpMeasurementIntervalControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_Dialysate_Flow_Rate_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Dialysate Flow Rate", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_Duration_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Duration", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_Heparin_Bolus_Volume_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Heparin Bolus Volume", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_Heparin_Dispensing_Rate_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Heparin Dispensing Rate", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_OFF_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "OFF", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_Heparin_Stop_Time_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Heparin Stop Time", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_dialysateTemperatureControl_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Dialysate Temperature", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_salineBolusVolume_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Saline Bolus Volume", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_bpMeasurementInterval_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "BP Measurement Interval", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_Bicarbonate_Concentrate_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Bicarbonate Concentrate", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox= {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_bicarbonateConcentrateComboBox", "type": "BaseComboBox", "unnamed": 1 } +o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_dialyzerTypeComboBox", "type": "BaseComboBox", "unnamed": 1 } +o_delegate_ItemDelegate = {"container": o_Overlay, "id": "_delegate", "type": "ItemDelegate", "unnamed": 1, "checkable": False, } +o_delegate_ItemDelegate_2 = {"container": o_Overlay, "id": "_delegate", "occurrence": 2, "type": "ItemDelegate", "unnamed": 1, "checkable": False, } +o_PreTreatmentCreate_dialyzerType_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Dialyzer Type", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_acidConcentrate_Text = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "text": "Acid Concentrate", "type": "Text", "unnamed": 1 } +o_PreTreatmentCreate_iconImage_Image = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_editButton", "type": "IconButton", "unnamed": 1, "visible": True } +o_iconImage_Image = {"container": o_Overlay, "id": "_iconImage", "type": "Image", "unnamed": 1, "source": "qrc:/images/iArrowRight" } +o_saveButton_TouchRect = {"container": o_Overlay, "id": "_saveButton", "type": "TouchRect", "unnamed": 1 } +o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_acidConcentrateComboBox", "type": "BaseComboBox", "unnamed": 1 } +o_delegate_ItemDelegate_3 = {"container": o_Overlay, "id": "_delegate", "occurrence": 4, "type": "ItemDelegate", "unnamed": 1, "checkable": False } +o_PreTreatmentCreate_acidConcentrate_Popup_Text = {"container": o_Overlay, "text": "Acid Concentrate", "type": "TitleText", "unnamed": 1 } +o_delegate_ItemDelegate_4 = {"container": o_Overlay, "id": "_delegate", "occurrence": 3, "type": "ItemDelegate", "unnamed": 1 } +o_PreTreatmentCreate_qrCode_Image = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_qrCode", "type": "Image", "unnamed": 1 } +o_PreTreatmentCreate_iconImage_Image_2 = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_iconImage", "type": "Image", "unnamed": 1, "source": "qrc:/images/iArrowRight" } +o_PreTreatmentCreate_iconImage_Image_3 = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_iconImage", "occurrence": 2, "type": "Image", "unnamed": 1, "source": "qrc:/images/iArrowRight" } +confirmButtom = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "objectName": "_confirmButton", "type": "ConfirmButton" } +prescription_menuButton = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_prescriptionMenu", "type": "BaseComboBox", "unnamed": 1, "visible": True } +o_PreTreatmentCreate_dialysateFlowRate_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_dialysateFlowRate", "type": "LabelUnitContainer", "unnamed": 1, "visible": True } +o_PreTreatmentCreate_duration_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_duration", "type": "LabelUnitContainer", "unnamed": 1 } +o_PreTreatmentCreate_heparinBolusVolume_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinBolusVolume", "type": "LabelUnitContainer", "unnamed": 1 } +o_PreTreatmentCreate_heparinDispensingRate_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinDispensingRate", "type": "LabelUnitContainer", "unnamed": 1 } +o_PreTreatmentCreate_heparinStopTime_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinStopTime", "type": "LabelUnitContainer", "unnamed": 1 } +o_PreTreatmentCreate_acidConcentrate_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_acidConcentrate", "type": "LabelUnitContainer", "unnamed": 1 } +o_PreTreatmentCreate_bicarbonateConcentrate_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_bicarbonateConcentrate", "type": "LabelUnitContainer", "unnamed": 1 } +o_PreTreatmentCreate_dialyzerType_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_dialyzerType", "type": "LabelUnitContainer", "unnamed": 1 } +o_PreTreatmentCreate_dialysateTemperature_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_dialysateTemperature", "type": "LabelUnitContainer", "unnamed": 1 } +o_PreTreatmentCreate_salineBolusVolume_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_salineBolusVolume", "type": "LabelUnitContainer", "unnamed": 1 } +o_PreTreatmentCreate_bpMeasurementInterval_LabelUnitContainer = {"container": o_PreTreatmentCreate_PreTreatmentCreate, "id": "_bpMeasurementInterval", "type": "LabelUnitContainer", "unnamed": 1 } + Index: suite_leahi/suite.conf =================================================================== diff -u -r0d29820546bc5f7cc598ac13ca5b20c8ea29926c -rfc2ce7fc0911c43127dd55ce45f305618ca8ffc9 --- suite_leahi/suite.conf (.../suite.conf) (revision 0d29820546bc5f7cc598ac13ca5b20c8ea29926c) +++ suite_leahi/suite.conf (.../suite.conf) (revision fc2ce7fc0911c43127dd55ce45f305618ca8ffc9) @@ -1,6 +1,6 @@ AUT=leahi LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_solution_infusion +TEST_CASES=tst_solution_infusion tst_main_treatment tst_create_treatment VERSION=3 WRAPPERS=Qt Index: suite_leahi/tst_create_treatment/test.py =================================================================== diff -u --- suite_leahi/tst_create_treatment/test.py (revision 0) +++ suite_leahi/tst_create_treatment/test.py (revision fc2ce7fc0911c43127dd55ce45f305618ca8ffc9) @@ -0,0 +1,611 @@ +# Subject/Title: LDT -2174 Treatment Parameters (Create Rx) - SW - 02 - (New Design) - Q&R - 15: SIT - Software Integration Tests - Squish Qt +# +# Functionalities: Testing all functionalities of Treatment parameters validation mode(Create RX) +# +# Steps: +# 1 Create RX: +# - Validate all the values in Create Rx page +# - Verify the validate functionality +# - Verify the confirm button functionality +# - Verify the qr code functionality +# - Verfiy the edit button functionality +# - Verify the clear all button functionality +# - Verify the reject button functionality + +import names + +from names import * + +from leahi_dialin.ui import utils +from configuration import utility +from leahi_dialin.ui.td_messaging import TD_Messaging +from leahi_dialin.common.td_defs import TDOpModes +from builtins import int as pyInt +import squish + +td =TD_Messaging() +PRE_TREATMENT_STEP = 0 +PRE_TREATMENT_SCREENS = ["Create" , "Sample" , "Consumables" , "Disposables" , "Prime" , "BP/HR" , "Ultrafiltration" , "Connection" , "Start"] +COMPLETE_COLOR = '#4696f7' +ENABLED_COLOR = '#fcfcfc' +PRESCRIPTION_TITLE = "Prescription" +BLOOD_FLOW_RATE = "Blood Flow Rate" +DIALYSATE_FLOW_RATE = "Dialysate Flow Rate" +DURATION = "Duration" +HEPARIN_BOLUS_VOLUME = "Heparin Bolus Volume" +SALINE_BOLUS_VOLUME = "Saline Bolus Volume" +OFF_TEXT = "OFF" +HEPARIN_DISPENSING_RATE = "Heparin Dispensing Rate" +HEPARIN_STOP_TIME = "Heparin Stop Time" +DIALYSATE_TEMPERATURE = "Dialysate Temperature" +BLOOD_PRESSURE_MEASUREMENT_INTERVAL = "BP Measurement Interval" +ACID_CONCENTRATE_TITLE = "Acid Concentrate" +BICARBONATE_CONCENTRATE_TITLE = "Bicarbonate Concentrate" +DIALYZER_TYPE_TITLE = "Dialyzer Type" + + + +#dictionary consist of slider [minimum value, slider buffer value, width buffer of slider] +CREATE_TREATMENT_PARAMETER = { + "Blood Flow Rate" : [60.0], + "Dialysate Flow Rate" : [75.0], + "Duration" : [75.0], + "Heparin Bolus Volume" : [0.3], + "Heparin Dispensing Rate" : [0.3], + "Heparin Stop Time" : [75.0], + "Saline Bolus Volume" : [200], + "Dialysate Temperature" : [35.5], + "BP Measurement Interval" : [10], + "Rinseback Flow Rate" : [75], +} +CREATE_TREATMENT_PARAMETER_RANGE = { + "Blood Flow Rate" : [50.0,500.0], + "Dialysate Flow Rate" : [50.0,600.0], + "Duration" : [60.0,480.0], + "Heparin Bolus Volume" : [0.2,2.0], + "Heparin Dispensing Rate" : [0.2,1.0], + "Heparin Stop Time" : [60.0,480.0], + "Saline Bolus Volume" : [100,300], + "Dialysate Temperature" : [35.0, 38.0], + "BP Measurement Interval" : [5,60], + +} + +PATIENT_ID_COMBINATION = { + "qwerty" : "qwerty", + "sampleid" : "sampleid", + "abcdefghijklmnop" : "abcdefghijklmnop", + "patientid" : "patientid", + "username" : "username", + "sA@MpLE#123" : "sAMpLE123", + "A@BH&321" : "ABH321", + "5432@qwerty" : "5432qwerty" +} + +COLOR_CODES = "#ffa500" + +DIALYZER_TYPE = ["Diacap Pro 13H", "Diacap Pro 16H", "Diacap Pro 19H", "Optiflux F160NRe", "Optiflux F180NRe", "Optiflux F200NRe","Optiflux F250NRe"] +KEYBOARD_SWITCH = ["ABC", "&123"] +ACID_CONCENTRATE = ["0.0 K, 0.00 Ca, 1 Mg", "3.0 K, 2.5 Ca, 1 Mg","2.0 K, 2.5 Ca, 1 Mg","1.0 K, 2.5 Ca, 1 Mg"] +CREATE_TREATMENT_PARAMETERS = ["Blood Flow Rate", "Dialysate Flow Rate", "Duration","Heparin Dispensing Rate", + "Heparin Bolus Volume","Heparin Stop Time", "Saline Bolus", "Dialysate Temperature", + "Blood Pressure Measurement Interval"] + + +CREATE_TREATEMENT_OBJ =[names.o_PreTreatmentCreate_bloodFlowRate_LabelUnitContainer ,names.o_PreTreatmentCreate_dialysateFlowRate_LabelUnitContainer, + names.o_PreTreatmentCreate_duration_LabelUnitContainer ,names.o_PreTreatmentCreate_heparinBolusVolume_LabelUnitContainer, + names.o_PreTreatmentCreate_heparinDispensingRate_LabelUnitContainer ,names.o_PreTreatmentCreate_heparinStopTime_LabelUnitContainer, + names.o_PreTreatmentCreate_acidConcentrate_LabelUnitContainer ,names.o_PreTreatmentCreate_bicarbonateConcentrate_LabelUnitContainer, + names.o_PreTreatmentCreate_dialyzerType_LabelUnitContainer ,names.o_PreTreatmentCreate_dialysateTemperature_LabelUnitContainer, + names.o_PreTreatmentCreate_salineBolusVolume_LabelUnitContainer ,names.o_PreTreatmentCreate_bpMeasurementInterval_LabelUnitContainer ] + +def keyboard_object_map_helper(text): + """ + Method for setting custom object property's for keyboard keys + @return: required object property's for keys + """ + if text is not None: + names.keyboard_input["text"] = text + return names.keyboard_input + else: + test.log("Invalid ",text," for object.") + names.o_keyboard_input["text"] = "Q" + + +def keyboard_switching_section(text): + """ + Tests to automate keyboard based on user input + @return: key text (text displayed on keyboard) + """ + keyboard_value = keyboard_object_map_helper(text) + object_status = object.exists(keyboard_value) + if object_status is True: + return text + else: + #Tests to get status of keys in keyboard layout + object_status = object.exists(keyboard_object_map_helper(KEYBOARD_SWITCH[1])) + if object_status is True: + keyboard_value = keyboard_object_map_helper(KEYBOARD_SWITCH[1]) + utils.waitForGUI(.3) + mouseClick(waitForObject(keyboard_value)) + keyboard_value = keyboard_object_map_helper(text) + object_status = object.exists(keyboard_value) + if object_status is True: + return text + object_status = object.exists(keyboard_object_map_helper(KEYBOARD_SWITCH[0])) + if object_status is True: + keyboard_value = keyboard_object_map_helper(KEYBOARD_SWITCH[0]) + mouseClick(waitForObject(keyboard_value)) + keyboard_value = keyboard_object_map_helper(text) + object_status = object.exists(keyboard_value) + if object_status is True: + return text + object_status = object.exists(names.keyboard_switch2) + if object_status is True: + keyboard_value = waitForObject(names.keyboard_switch2) + mouseClick(keyboard_value) + text = text.lower() + keyboard_value = keyboard_object_map_helper(text) + object_status = object.exists(keyboard_value) + if object_status is True: + return text + object_status = object.exists(names.keyboard_switch) + if object_status is True: + keyboard_value = waitForObject(names.keyboard_switch) + mouseClick(keyboard_value) + text = text.lower() + keyboard_value = keyboard_object_map_helper(text) + object_status = object.exists(keyboard_value) + if object_status is True: + return text + + +def verify_valid_patient_id_through_keypad(expected_value, actual_value): + """ + Tests verifies valid patient id set through application keyboard setup . + @return: N/A + """ + patient_id_input = waitForObject(names.PatientIDEntry_TextEntry) + mouseClick(names.PatientIDEntry_TextEntry) + for text in expected_value: + keyword_state = keyboard_switching_section(text) + if keyword_state is not None: + keyboard_value = keyboard_object_map_helper(keyword_state) + mouseClick(waitForObject(keyboard_value)) + utils.waitForGUI(.2) + + test.compare(actual_value, (patient_id_input.text), "Patient id should be -> "+ str(actual_value)) + test.log("User successfully authenticated through patient id -> " + expected_value + "using keypad.") + + # mouseClick(waitForObject(names.o_create_back_button)) +def get_bullet_object(screen_obj, num): + """ + To obtain a bullet object based on occurrence provided. + @param screen_obj: provides the container on which the bullet must be present + @param num: provides the occurrence value + @returns a real name object + """ + names.o_bullet_object["container"] = screen_obj + names.o_bullet_object["occurrence"] = num + 1 + return names.o_bullet_object + +def verify_page_step_indicator(screen_obj, treatment_step, treatment_screens): + """ + Method to verify the Page Step indicators [the object on top of the screen which indicates the steps passed, current, remained] + @param treatment_step : (int) indicates the Current treatment step + """ + test.startSection("verification of page step indicators") + for page in range(len(treatment_screens)): + bullet_children = object.children(squish.waitForObjectExists(get_bullet_object(screen_obj, page))) + bullet_circle_color = bullet_children[0].color.name + bullet_border_color = bullet_children[0].border.color.name + step_title = squish.waitForObjectExists(get_text_object(screen_obj, treatment_screens[page])) + #To verify the step indicators of the completed treatment screens + if page < treatment_step: + test.verify(squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) + test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).current) + test.compare(bullet_circle_color, COMPLETE_COLOR) + test.compare(bullet_border_color, COMPLETE_COLOR) + test.compare(step_title.color.name, ENABLED_COLOR) + #To verify the step indicators of the current treatment screen + elif page == treatment_step: + test.compare(bullet_border_color, COMPLETE_COLOR) + test.compare(step_title.color.name, ENABLED_COLOR) + #To verify the step indicators of the remaining treatment screens + else: + test.verify(not squish.waitForObjectExists(get_bullet_object(screen_obj, page)).complete) + test.compare(bullet_circle_color, CURRENT_COLOR) + test.endSection() + + +def verify_create_custom_treatment_parameter(): + """ + Method to set create custom treatment slider value based on slider buffer + """ + test.startSection("Method to set create custom treatment slider based on positive slider buffer") + + test.compare(waitForObject(names.o_PreTreatmentCreate_Prescription_Text).text, PRESCRIPTION_TITLE, "Title text should be -> "+str(PRESCRIPTION_TITLE)) + # set custom values for parameters + test.startSection("Verification of blood flow values") + test.compare(waitForObject(names.o_PreTreatmentCreate_bloodFlowRate_LabelUnitContainer).text, BLOOD_FLOW_RATE, "Parameter should be -> "+str(BLOOD_FLOW_RATE)) + for blood_flow_rate in CREATE_TREATMENT_PARAMETER_RANGE[BLOOD_FLOW_RATE]: + set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, blood_flow_rate) + test.endSection() + + test.startSection("Verification of dialysate flow values") + test.compare(waitForObject(names.o_PreTreatmentCreate_Dialysate_Flow_Rate_Text).text, DIALYSATE_FLOW_RATE, "Parameter should be -> "+str(DIALYSATE_FLOW_RATE)) + for dialysate_flow_rate in CREATE_TREATMENT_PARAMETER_RANGE[DIALYSATE_FLOW_RATE]: + set_value_based_on_target(names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster, dialysate_flow_rate) + test.endSection() + + test.startSection("Verification of duration values") + test.compare(waitForObject(names.o_PreTreatmentCreate_Duration_Text).text, DURATION, "Parameter should be -> "+str(DURATION)) + for duration in CREATE_TREATMENT_PARAMETER_RANGE[DURATION]: + set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, duration) + test.endSection() + + test.startSection("Verification of heparin bolus volume values") + test.compare(waitForObject(names.o_PreTreatmentCreate_Heparin_Bolus_Volume_Text).text, HEPARIN_BOLUS_VOLUME, "Parameter should be -> "+str(HEPARIN_BOLUS_VOLUME)) + mouseClick(waitForObject(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster)) + test.compare(OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_OFF_Text).text, "OFF text should be enabled") + for heparin_bolus_volume in CREATE_TREATMENT_PARAMETER_RANGE[HEPARIN_BOLUS_VOLUME]: + set_value_based_on_target(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster, heparin_bolus_volume) + test.endSection() + + + test.startSection("Verification of heparin dispensing rate values") + test.compare(waitForObject(names.o_PreTreatmentCreate_Heparin_Dispensing_Rate_Text).text, HEPARIN_DISPENSING_RATE, "Parameter should be -> "+str(HEPARIN_DISPENSING_RATE)) + mouseClick(waitForObject(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster)) + test.compare(OFF_TEXT, waitForObject(names.PreTreatmentCreate_heparinDispensingRateControl_OffText).text, "OFF text should be enabled") + # test.compare(OFF_TEXT, waitForObject(names.PreTreatmentCreate_heparinStopTime_OffText).text, "OFF text should be enabled for heparin stop values") + for heparin_dispensing_rate in CREATE_TREATMENT_PARAMETER_RANGE[HEPARIN_DISPENSING_RATE]: + set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, heparin_dispensing_rate) + test.endSection() + + test.startSection("Verification of heparin stop time values") + set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, "0.2") + set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, "60") + test.compare(waitForObject(names.o_PreTreatmentCreate_Heparin_Stop_Time_Text).text, HEPARIN_STOP_TIME, "Parameter should be -> "+str(HEPARIN_STOP_TIME)) + for heparin_stop_time in CREATE_TREATMENT_PARAMETER_RANGE[HEPARIN_STOP_TIME]: + set_value_based_on_target(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster, heparin_stop_time) + test.endSection() + + test.startSection("Verification of Dialysate Temperature") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialysateTemperatureControl_Text).text,DIALYSATE_TEMPERATURE , "Parameter should be -> "+str(DIALYSATE_TEMPERATURE)) + for dialysate_temperature in CREATE_TREATMENT_PARAMETER_RANGE[DIALYSATE_TEMPERATURE]: + set_value_based_on_target(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,dialysate_temperature) + test.endSection() + + test.startSection("Verification of saline bolus values") + test.compare(waitForObject(names.o_PreTreatmentCreate_salineBolusVolume_Text).text, SALINE_BOLUS_VOLUME, "Parameter should be -> "+str(SALINE_BOLUS_VOLUME)) + for saline_bolus in CREATE_TREATMENT_PARAMETER_RANGE[SALINE_BOLUS_VOLUME]: + set_value_based_on_target(names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster, saline_bolus) + test.endSection() + + test.startSection("Verification of BP Measurement Interval") + test.compare(waitForObject(names.o_PreTreatmentCreate_bpMeasurementInterval_Text).text, BLOOD_PRESSURE_MEASUREMENT_INTERVAL, "Parameter should be -> "+str(BLOOD_PRESSURE_MEASUREMENT_INTERVAL)) + for bp_measurement_interval in CREATE_TREATMENT_PARAMETER_RANGE[BLOOD_PRESSURE_MEASUREMENT_INTERVAL]: + set_value_based_on_target(names.o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjuster,bp_measurement_interval) + test.endSection() + + + test.startSection("Verification of acid concentrate type") + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrate_Text).text, ACID_CONCENTRATE_TITLE, "Parameter should be -> "+str(ACID_CONCENTRATE_TITLE)) + mouseClick(waitForObject(names.o_PreTreatmentCreate_iconImage_Image)) + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrate_Popup_Text).text, ACID_CONCENTRATE_TITLE, "Parameter should be -> "+str(ACID_CONCENTRATE_TITLE)) + mouseClick(waitForObject(names.o_iconImage_Image)) + mouseClick(waitForObject(names.o_iconImage_Image)) + mouseClick(waitForObject(names.o_saveButton_TouchRect)) + mouseClick(waitForObject(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox)) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_3)) + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox).currentText, ACID_CONCENTRATE[0], "Acid concentrate value should be :"+str(ACID_CONCENTRATE[0])) + mouseClick(waitForObject(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox)) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_2)) + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox).currentText, ACID_CONCENTRATE[1], "Acid concentrate value should be :"+str(ACID_CONCENTRATE[1])) + mouseClick(waitForObject(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox)) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_4)) + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox).currentText, ACID_CONCENTRATE[2], "Acid concentrate value should be :"+str(ACID_CONCENTRATE[2])) + mouseClick(waitForObject(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox)) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_3)) + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox).currentText, ACID_CONCENTRATE[3], "Acid concentrate value should be :"+str(ACID_CONCENTRATE[3])) + test.endSection() + + + test.startSection("Verification of dialyzer type") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerType_Text).text, DIALYZER_TYPE_TITLE, "Parameter should be -> "+str(DIALYZER_TYPE_TITLE)) + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox) + mouseClick(waitForObject(names.o_delegate_ItemDelegate)) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[0], "Dialyzer type value should be :"+str(DIALYZER_TYPE[0])) + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_2)) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[1], "Dialyzer type value should be :"+str(DIALYZER_TYPE[1])) + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_2)) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[2], "Dialyzer type value should be :"+str(DIALYZER_TYPE[2])) + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_2)) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[3], "Dialyzer type value should be :"+str(DIALYZER_TYPE[3])) + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_2)) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[4], "Dialyzer type value should be :"+str(DIALYZER_TYPE[4])) + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_2)) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[5], "Dialyzer type value should be :"+str(DIALYZER_TYPE[5])) + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_2)) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[6], "Dialyzer type value should be :"+str(DIALYZER_TYPE[6])) + + test.endSection() + + td.td_Treatment_Parameters_Validation( vAccepted = 1, + vBloodFlowRateRejectReason = 0, + vDialysateFlowRateRejectReason = 0, + vTreatmentDurationRejectReason = 0, + vSalineBolusVolumeRejectReason = 0, + vHeparinStopTimeRejectReason = 0, + vHeparinTypeRejectReason = 0, + vAcidConcentrateRejectReason = 0, + vBicarbonateConcentrateRejectReason = 0, + vDialyzerTypeRejectReason = 0, + vBloodPressureMeasureIntervalRejectReason = 0, + vRinsebackFlowRateRejectReason = 0, + vRinsebackVolumeRejectReason = 0, + vArterialPressureLimitWindowRejectReason = 0, + vVenousPressureLimitWindowRejectReason = 0, + vVenousPressureLimitAsymtrcRejectReason = 0, + vTrancembrncPressureLimitWindowRejectReason = 0, + vDialysateTempRejectReason = 0, + vHeparinDispensingRateRejectReason = 0, + vHeparinBolusVolumeRejectReason = 0 + ) + utils.waitForGUI(3) + test.verify(waitForObjectExists(names.o_PreTreatmentCreate_qrCode_Image), "QR Code is visible") + confirmButton = waitForObject(names.confirmButtom) + test.compare(confirmButton.enabled, True, "Confirm button is enabled") + td.td_operation_mode(TDOpModes.MODE_PRET.value, 0) + test.endSection() + +def verify_editRx_Button(): + test.startSection("Verfiy the edit button functionality") + td.td_operation_mode(TDOpModes.MODE_STAN.value) + td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0 ) + td.td_Treatment_Parameters_Validation( vAccepted = 1, + vBloodFlowRateRejectReason = 0, + vDialysateFlowRateRejectReason = 0, + vTreatmentDurationRejectReason = 0, + vSalineBolusVolumeRejectReason = 0, + vHeparinStopTimeRejectReason = 0, + vHeparinTypeRejectReason = 0, + vAcidConcentrateRejectReason = 0, + vBicarbonateConcentrateRejectReason = 0, + vDialyzerTypeRejectReason = 0, + vBloodPressureMeasureIntervalRejectReason = 0, + vRinsebackFlowRateRejectReason = 0, + vRinsebackVolumeRejectReason = 0, + vArterialPressureLimitWindowRejectReason = 0, + vVenousPressureLimitWindowRejectReason = 0, + vVenousPressureLimitAsymtrcRejectReason = 0, + vTrancembrncPressureLimitWindowRejectReason = 0, + vDialysateTempRejectReason = 0, + vHeparinDispensingRateRejectReason = 0, + vHeparinBolusVolumeRejectReason = 0 + ) + utils.waitForGUI(3) + mouseClick(waitForObjectExists(names.prescription_menuButton)) + mouseClick(waitForObject(names.o_delegate_ItemDelegate)) + test.startSection("Verification of blood flow values") + test.compare(waitForObject(names.o_PreTreatmentCreate_bloodFlowRate_LabelUnitContainer).text, BLOOD_FLOW_RATE, "Parameter should be -> "+str(BLOOD_FLOW_RATE)) + for blood_flow_rate in CREATE_TREATMENT_PARAMETER[BLOOD_FLOW_RATE]: + set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, blood_flow_rate) + test.endSection() + + test.startSection("Verification of dialysate flow values") + test.compare(waitForObject(names.o_PreTreatmentCreate_Dialysate_Flow_Rate_Text).text, DIALYSATE_FLOW_RATE, "Parameter should be -> "+str(DIALYSATE_FLOW_RATE)) + for dialysate_flow_rate in CREATE_TREATMENT_PARAMETER[DIALYSATE_FLOW_RATE]: + set_value_based_on_target(names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster, dialysate_flow_rate) + test.endSection() + + test.startSection("Verification of duration values") + test.compare(waitForObject(names.o_PreTreatmentCreate_Duration_Text).text, DURATION, "Parameter should be -> "+str(DURATION)) + for duration in CREATE_TREATMENT_PARAMETER[DURATION]: + set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, duration) + test.endSection() + + test.startSection("Verification of heparin bolus volume values") + test.compare(waitForObject(names.o_PreTreatmentCreate_Heparin_Bolus_Volume_Text).text, HEPARIN_BOLUS_VOLUME, "Parameter should be -> "+str(HEPARIN_BOLUS_VOLUME)) + mouseClick(waitForObject(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster)) + test.compare(OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_OFF_Text).text, "OFF text should be enabled") + for heparin_bolus_volume in CREATE_TREATMENT_PARAMETER[HEPARIN_BOLUS_VOLUME]: + set_value_based_on_target(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster, heparin_bolus_volume) + test.endSection() + + test.startSection("Verification of heparin dispensing rate values") + test.compare(waitForObject(names.o_PreTreatmentCreate_Heparin_Dispensing_Rate_Text).text, HEPARIN_DISPENSING_RATE, "Parameter should be -> "+str(HEPARIN_DISPENSING_RATE)) + mouseClick(waitForObject(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster)) + test.compare(OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_heparinDispensingRateControl_OffText).text, "OFF text should be enabled") + for heparin_dispensing_rate in CREATE_TREATMENT_PARAMETER[HEPARIN_DISPENSING_RATE]: + set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, heparin_dispensing_rate) + test.endSection() + + + test.startSection("Verification of Dialysate Temperature") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialysateTemperatureControl_Text).text,DIALYSATE_TEMPERATURE , "Parameter should be -> "+str(DIALYSATE_TEMPERATURE)) + for dialysate_temperature in CREATE_TREATMENT_PARAMETER[DIALYSATE_TEMPERATURE]: + set_value_based_on_target(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,dialysate_temperature) + test.endSection() + + test.startSection("Verification of saline bolus values") + test.compare(waitForObject(names.o_PreTreatmentCreate_salineBolusVolume_Text).text, SALINE_BOLUS_VOLUME, "Parameter should be -> "+str(SALINE_BOLUS_VOLUME)) + for saline_bolus in CREATE_TREATMENT_PARAMETER[SALINE_BOLUS_VOLUME]: + set_value_based_on_target(names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster, saline_bolus) + test.endSection() + + test.startSection("Verification of BP Measurement Interval") + test.compare(waitForObject(names.o_PreTreatmentCreate_bpMeasurementInterval_Text).text, BLOOD_PRESSURE_MEASUREMENT_INTERVAL, "Parameter should be -> "+str(BLOOD_PRESSURE_MEASUREMENT_INTERVAL)) + for bp_measurement_interval in CREATE_TREATMENT_PARAMETER[BLOOD_PRESSURE_MEASUREMENT_INTERVAL]: + set_value_based_on_target(names.o_PreTreatmentCreate_bpMeasurementIntervalControl_ValueAdjuster,bp_measurement_interval) + test.endSection() + + td.td_operation_mode(TDOpModes.MODE_PRET.value, 0) + test.endSection() + +def verfiy_clearall_Button(): + test.startSection("Verfiy the clear all button functionality") + td.td_operation_mode(TDOpModes.MODE_STAN.value) + td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0 ) + td.td_Treatment_Parameters_Validation( vAccepted = 1, + vBloodFlowRateRejectReason = 0, + vDialysateFlowRateRejectReason = 0, + vTreatmentDurationRejectReason = 0, + vSalineBolusVolumeRejectReason = 0, + vHeparinStopTimeRejectReason = 0, + vHeparinTypeRejectReason = 0, + vAcidConcentrateRejectReason = 0, + vBicarbonateConcentrateRejectReason = 0, + vDialyzerTypeRejectReason = 0, + vBloodPressureMeasureIntervalRejectReason = 0, + vRinsebackFlowRateRejectReason = 0, + vRinsebackVolumeRejectReason = 0, + vArterialPressureLimitWindowRejectReason = 0, + vVenousPressureLimitWindowRejectReason = 0, + vVenousPressureLimitAsymtrcRejectReason = 0, + vTrancembrncPressureLimitWindowRejectReason = 0, + vDialysateTempRejectReason = 0, + vHeparinDispensingRateRejectReason = 0, + vHeparinBolusVolumeRejectReason = 0 + ) + utils.waitForGUI(3) + mouseClick(waitForObjectExists(names.prescription_menuButton)) + mouseClick(waitForObject(names.o_delegate_ItemDelegate_4)) + button = waitForObjectExists(names.confirmButtom) + test.verify(not button.enabled, "Validate that the button is disabled") + test.endSection() + + +def findObjectById(parent, id): + """ + Recursively searches for a child object by its id. + Returns the found object or None if not found. + """ + if str(parent.id) == id: + return parent + + for child in object.children(parent): + found = findObjectById(child, id) + if found: + return found + + return None + +def set_value_based_on_target(obj, target_value): + """ + obj: dictionary containing object paths + Example: + { + "value_obj": ":mainTreatmentScreen.PressureText", + "left_arrow": ":mainTreatmentScreen.LeftArrow", + "right_arrow": ":mainTreatmentScreen.RightArrow" + } + + target_value: integer or string number, e.g. 220 + """ + target_value = target_value + + # Wait for all objects + parent_obj = waitForObjectExists(obj) + # change range as per your screen count + + left_arrow = findObjectById(parent_obj, "_leftArrow") + right_arrow =findObjectById(parent_obj, "_rightArrow") + + # Read current value (supports invisible text too) + try: + current_value = round(float(findObject(obj).value),1) + except LookupError: + current_value = float(findObject(obj).property("value")) + + # Determine direction + while current_value != float(target_value): + if current_value < float(target_value): + mouseClick(waitForObject(right_arrow)) + + elif current_value > float(target_value): + mouseClick(waitForObject(left_arrow)) + # Update current value after click + try: + current_value = round(float(findObject(obj).value),1) + except Exception: + current_value = float(findObject(obj).property("value")) + + test.log(f"Updated value: {current_value}") + + test.log(f"✅ Target value reached: {current_value}") + +def set_parameter_type(text,obj): + """ + Method to set object property based on text + @param text : (string) treatment parameter text + """ + names.o_operating_parameters["text"] = text + return obj + +def verify_custom_treatment_record_rejected(): + """ + Method to verify custom treatment record, if confirmation rejected + """ + test.startSection("Verifying custom treatment record, if confirmation rejected") + td.td_operation_mode(TDOpModes.MODE_STAN.value) + td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0 ) + td.td_Treatment_Parameters_Validation( vAccepted = 0, + vBloodFlowRateRejectReason = 1, + vDialysateFlowRateRejectReason = 1, + vTreatmentDurationRejectReason = 1, + vSalineBolusVolumeRejectReason = 1, + vHeparinStopTimeRejectReason = 1, + vHeparinTypeRejectReason = 1, + vAcidConcentrateRejectReason = 1, + vBicarbonateConcentrateRejectReason = 1, + vDialyzerTypeRejectReason = 1, + vBloodPressureMeasureIntervalRejectReason = 1, + vRinsebackFlowRateRejectReason = 1, + vRinsebackVolumeRejectReason = 1, + vArterialPressureLimitWindowRejectReason = 1, + vVenousPressureLimitWindowRejectReason = 1, + vVenousPressureLimitAsymtrcRejectReason = 1, + vTrancembrncPressureLimitWindowRejectReason = 1, + vDialysateTempRejectReason = 1, + vHeparinDispensingRateRejectReason = 1, + vHeparinBolusVolumeRejectReason = 1 + ) + + for expected_treatment_title,object in zip(CREATE_TREATMENT_PARAMETERS,CREATE_TREATEMENT_OBJ): + parameter_object = set_parameter_type(text = expected_treatment_title,obj =object) + parameter_text = waitForObject(parameter_object) + parameter_text_color = parameter_text.border.color.name + test.compare(COLOR_CODES, parameter_text_color, "parameter color should be ' \red for' " + expected_treatment_title +" , if the confirmation get rejected !") + test.endSection() + +def main(): + utils.tstStart(__file__) + startApplication(names.AUT_NAME + " -q") + + td.td_operation_mode(TDOpModes.MODE_STAN.value) + + # verify Standby screen + test.verify(waitForObjectExists(names.standByScreen_MainHome), "In Standby") + + td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0 ) + test.compare(waitForObject(names.o_PreTreatmentCreate_Prescription_Text).text, PRESCRIPTION_TITLE, "Title text should be -> "+str(PRESCRIPTION_TITLE)) + + verify_page_step_indicator(screen_obj=names.o_PreTreatmentCreate_gridSteps_Grid, treatment_step=PRE_TREATMENT_STEP, treatment_screens=PRE_TREATMENT_SCREENS) + test.log("Verify the Patient ID field") + mouseClick(waitForObject(names.PatientIDEntry_TextEntry)) + for expected_patient_id, actual_patient_id in PATIENT_ID_COMBINATION.items(): + verify_valid_patient_id_through_keypad(expected_patient_id, actual_patient_id) + + verify_create_custom_treatment_parameter() + verify_editRx_Button() + verfiy_clearall_Button() + + verify_custom_treatment_record_rejected() +