Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -rf6d23e89ccf01b57313b0e920f013dc1027706d4 -rb4159c6b117c974b5a24377c295a822cadac75af --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision f6d23e89ccf01b57313b0e920f013dc1027706d4) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision b4159c6b117c974b5a24377c295a822cadac75af) @@ -1,6 +1,18 @@ import squish import test import object +from squish import * +import names +from leahi_dialin.ui.td_messaging import TD_Messaging +from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates + +td =TD_Messaging() + + +ACID_CONCENTRATE = ["1.0 K, 2.50 Ca, 1 Mg","2.0 K, 2.50 Ca, 1 Mg","3.0 K, 2.50 Ca, 1 Mg"] +DIALYZER_TYPE = ["Diacap Pro 13H","Diacap Pro 16H", "Diacap Pro 19H", "Optiflux F160NRe", "Optiflux F180NRe", "Optiflux F200NRe","Optiflux F250NRe"] +VITALS = ["OFF","5","10","15","20","30","60"] +BICARBONATE = ["Sodium Bicarbonate"] def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): """ @@ -40,3 +52,105 @@ found = findChildByText(child, target_text) if found: return found + +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 = squish.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): + squish.mouseClick(squish.waitForObject(right_arrow)) + + elif current_value > float(target_value): + squish.mouseClick(squish.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 select_different_dropdown(object,type,whichTypeIndex): + type_combo_box = get_object_from_names(object, error_message="Combo box object is missing") + if type_combo_box is not None: + squish.mouseClick(squish.waitForObjectExists(object)) + + type_option = get_object_from_names(setObjectText(obj = names.o_option_combo_box,text = type[whichTypeIndex]),error_message=f"Option {type[whichTypeIndex]} object is missing",timeout_ms=5000) + if type_option is not None: + squish.mouseClick(type_option) + return True + return False # default return if not successful + +def verify_create_treatment_parameters(): + test.startSection("Pre treatment parameters") + squish.mouseClick(waitForObject(names.o_PatientIDEntry_TextEntry)) + squish.waitForObject(names.o_PatientIDEntry_TextEntry).text ="abcd" + set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 90) + set_value_based_on_target(names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster, 100) + set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, 105) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster, 0.4) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, 0.5) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster, 105) + select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,2) + set_value_based_on_target(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,37.0) + select_different_dropdown(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,2) + set_value_based_on_target(names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster, 100) + select_different_dropdown(names.o_PreTreatment_vitalsCombobox_BaseCombobox,VITALS,1) + select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,BICARBONATE,0) + squish.mouseClick(waitForObject(names.o_PreTreatmentButtom)) + 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 + ) + + confirmButton = waitForObject(names.o_PreTreatmentButtom) + squish.mouseClick(waitForObject(confirmButton)) + td.td_operation_mode(TDOpModes.MODE_PRET.value, 0) + test.endSection() + + + Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -rf6d23e89ccf01b57313b0e920f013dc1027706d4 -rb4159c6b117c974b5a24377c295a822cadac75af --- suite_leahi/shared/scripts/names.py (.../names.py) (revision f6d23e89ccf01b57313b0e920f013dc1027706d4) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision b4159c6b117c974b5a24377c295a822cadac75af) @@ -81,3 +81,32 @@ o_SettingsBase_SettingsWiFi = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsWiFi" } o_SettingsBase_WifiScreen_ScanButton = {"container": o_SettingsBase_SettingsWiFi, "id": "_scanButton", "type": "TouchRect", "unnamed": 1 } o_SettingsBase_WifiScreen_BackButton = {"container": o_SettingsBase_SettingsWiFi, "objectName": "_backButton", "type": "BackButton" } + +#Heparin +o_listView_Item = {"container": o_Gui_MainView, "type": "Item", "unnamed": 1 } +o_treatmentHeparin_TreatmentHeparin = {"container": o_Gui_MainView, "id": "_treatmentHeparin", "type": "TreatmentHeparin", "unnamed": 1 } +o_treatmentHeparin_contentArea_ContentArea = {"container": o_treatmentHeparin_TreatmentHeparin, "id": "_contentArea", "type": "ContentArea", "unnamed": 1 } +o_treatmentHeparin_Prescription_Column = {"container": o_treatmentHeparin_TreatmentHeparin, "id": "_heparinPrescriptionContent", "type": "Column", "unnamed": 1 } +o_treatmentHeparin_heparinButton_TouchRect = {"container": o_treatmentHeparin_TreatmentHeparin, "id": "_heparinButton", "type": "TouchRect", "unnamed": 1 } +o_treatmentHeparin_status_Rectangle = {"container": o_treatmentHeparin_TreatmentHeparin, "id": "_status", "type": "Rectangle", "unnamed": 1 } + +o_PreTreatmentCreateStack_PreTreatmentCreateStack = {"container": o_Gui_MainView, "objectName": "_PreTreatmentCreateStack","type": "PreTreatmentCreateStack", } +o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate = {"container": o_PreTreatmentCreateStack_PreTreatmentCreateStack, "objectName": "_PreTreatmentCreate", "type": "PreTreatmentCreate", } +o_PatientIDEntry_TextEntry = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_pretreatmentPatientIDEntry", "type": "TextEntry", "unnamed": 1 } + +o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_bloodFlowRateControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_dialysateFlowRateControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_durationControl_ValueAdjuster = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_durationControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinBolusVolumeControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinDispensingRateControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinStopTimeControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_dialysateTemperatureControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_salineBolusVolumeControl", "type": "ValueAdjuster", "unnamed": 1 } +o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox= {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_bicarbonateConcentrateComboBox", "type": "BaseComboBox", "unnamed": 1 } +o_createTreatmentRect_TouchRect = {"container": o_standByScreen_MainHome, "id": "_createTreatmentRect", "type": "TouchRect", "unnamed": 1 } +o_PreTreatment_vitalsCombobox_BaseCombobox = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_bpMeasurementIntervalControl", "type": "BaseComboBox", "unnamed": 1 } +o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_acidConcentrateComboBox", "type": "BaseComboBox", "unnamed": 1 } +o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_dialyzerTypeComboBox", "type": "BaseComboBox", "unnamed": 1 } +o_vitalsButton_VitalsButton = {"container": o_Gui_MainView, "id": "_vitalsButton", "type": "VitalsButton", "unnamed": 1 } +o_option_combo_box = {"container": o_Overlay, "type": "Text", "unnamed": 1 } +o_PreTreatmentButtom = {"container": o_PreTreatmentCreateStack_PreTreatmentCreate_PreTreatmentCreate, "objectName": "_confirmButton", "type": "ConfirmButton" } Index: suite_leahi/suite.conf =================================================================== diff -u -rf6d23e89ccf01b57313b0e920f013dc1027706d4 -rb4159c6b117c974b5a24377c295a822cadac75af --- suite_leahi/suite.conf (.../suite.conf) (revision f6d23e89ccf01b57313b0e920f013dc1027706d4) +++ suite_leahi/suite.conf (.../suite.conf) (revision b4159c6b117c974b5a24377c295a822cadac75af) @@ -1,6 +1,6 @@ AUT=leahi LANGUAGE=Python OBJECTMAPSTYLE=script -TEST_CASES=tst_solution_infusion tst_main_treatment tst_service_export_logs tst_device_settings_information_version tst_headerbar_information_popup tst_headerbar_wifi_indicator tst_device_settings_wifi +TEST_CASES=tst_solution_infusion tst_main_treatment tst_service_export_logs tst_device_settings_information_version tst_headerbar_information_popup tst_headerbar_wifi_indicator tst_device_settings_wifi tst_heparin VERSION=3 WRAPPERS=Qt Index: suite_leahi/tst_heparin/test.py =================================================================== diff -u --- suite_leahi/tst_heparin/test.py (revision 0) +++ suite_leahi/tst_heparin/test.py (revision b4159c6b117c974b5a24377c295a822cadac75af) @@ -0,0 +1,210 @@ +# Subject/Title: LDT -2973 Heparin - SW - 02 - Q&R - 15: SIT - Software Integration Tests - Squish Qt +# Functionalities: Testing all functionalities of Heparin in the main treatment screen +# +# Steps: +# 1 Heparin: +# Consists of the Prescription Rx parameters for Heparing and the menu tab inside of main treatment +# +# Test the confirmed prescription Rx matches the left container in the heparin page. Right container consists of FW messages of the Heparin data and displaying the status of different heparin states (HEPARING_STATE_DISPENSING, HEPARING_STATE_PAUSED, HEPARING_STATE_COMPLETED) +# +# Test also scenarion in prescription Rx if user sets all heparin to "OFF" then when treatment starts al the data should show empty "- -" + +import names +from leahi_dialin.ui import utils +from configuration import utility +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 + +td =TD_Messaging() + +heparin_off = { "Heparin Type" :"OFF", + "Dispensing Rate" :"OFF", + "Bolus Volume" :"OFF", + "Stop Time" :"OFF"} + +heparin_values = { "Heparin Type" :"Unfractionated 1,000 IU/mL", + "Dispensing Rate" :"0.5", + "Bolus Volume" :"0.4", + "Stop Time" :"105"} + +PAUSE = 'Pause' +ACTIVE = 'Active' +RESUME = 'Resume' +COMPLETE = 'Complete' +HEPARIN = "Heparin" + +def verify_heparin_precription_parameters(heparin_value): + test.startSection("Verify prescription rx parameters in heparin page") + column = waitForObject(names.o_treatmentHeparin_Prescription_Column) + + # Get a list of the children to use with zip() + children = object.children(column) + + # Using zip() to iterate through children and the dictionary's items + for child, (key, expected_value) in zip(children, heparin_value.items()): + value = utility.findObjectById(child, "_value") + if value: + test.compare(str(value.text), expected_value, + " Comparison of Heparin Prescription '" + key + "'", + ) + + test.endSection() + +def verify_status_heparinStates(heparin_state,buttonState,status): + test.startSection("Verify the heparin states in Heparin page") + td.td_tx_state( + TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + heparin_state # Heparin state + ) + #check the pause button + Button = waitForObject(names.o_treatmentHeparin_heparinButton_TouchRect) + value = utility.findObjectById(Button, "_text") + test.compare(buttonState, value.text,"Button text should be ->"+str(buttonState)) + statusValue = waitForObject(names.o_treatmentHeparin_status_Rectangle) + statustext = utility.findObjectById(statusValue,'_statusText') + test.compare(status, statustext.text,"Status text should be ->"+str(status)) + test.endSection() + +def change_treatmentstates(state): + test.startSection("Change the treatment paramters") + td.td_tx_state( state, + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0) + test.endSection() + +def verify_create_treatment_parameters_Heparin_OFF(): + test.startSection("Pre treatment parameters") + mouseClick(waitForObject(names.o_PatientIDEntry_TextEntry)) + waitForObject(names.o_PatientIDEntry_TextEntry).text ="abcd" + utility.set_value_based_on_target(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster, 50) + utility.set_value_based_on_target(names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster, 50) + utility.set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, 60) + mouseClick(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster) + mouseClick(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster) + utility.set_value_based_on_target(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster,37.5) + utility.set_value_based_on_target(names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster, 200) + utility.select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,utility.ACID_CONCENTRATE,2) + utility.select_different_dropdown(names.o_PreTreatmentCreate_dialyzerTypeComboBox_BaseComboBox,utility.DIALYZER_TYPE,2) + utility.select_different_dropdown(names.o_PreTreatment_vitalsCombobox_BaseCombobox,utility.VITALS,1) + utility.select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,utility.BICARBONATE,0) + mouseClick(waitForObject(names.o_PreTreatmentButtom)) + 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 + ) + + confirmButton = waitForObject(names.o_PreTreatmentButtom) + mouseClick(waitForObject(confirmButton)) + td.td_operation_mode(TDOpModes.MODE_PRET.value, 0) + test.endSection() + +def main(): + utils.tstStart(__file__) + startApplication(config.AUT_NAME) + td.td_operation_mode(TDOpModes.MODE_STAN.value) + + # verify Standby screen + test.verify(waitForObjectExists(names.o_standByScreen_MainHome), "In Standby") + change_treatmentstates(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value) + + test.startSection("Check the heparin values in Heparin page") + heparin = utility.setObjectText(text=HEPARIN, obj=names.o_listView_Item) + mouseClick(waitForObject(heparin)) + #check the off values + verify_heparin_precription_parameters(heparin_off) + test.endSection() + + test.startSection("Verify the heparin state is off state") + td.td_operation_mode(TDOpModes.MODE_STAN.value) + td.td_operation_mode(TDOpModes.MODE_TPAR.value) + verify_create_treatment_parameters_Heparin_OFF() + change_treatmentstates(TDTreatmentStates.TREATMENT_PAUSED_STATE.value) + change_treatmentstates(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value) + heparin = utility.setObjectText(text=HEPARIN, obj=names.o_listView_Item) + mouseClick(waitForObject(heparin)) + verify_heparin_precription_parameters(heparin_off) + test.endSection() + + test.startSection("Verify prescription rx parameters in heparin page") + td.td_operation_mode(TDOpModes.MODE_STAN.value) + td.td_operation_mode(TDOpModes.MODE_TPAR.value) + utility.verify_create_treatment_parameters() + change_treatmentstates(TDTreatmentStates.TREATMENT_PAUSED_STATE.value) + change_treatmentstates(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value) + heparin = utility.setObjectText(text=HEPARIN, obj=names.o_listView_Item) + mouseClick(waitForObject(heparin)) + verify_heparin_precription_parameters(heparin_values) + test.endSection() + + test.startSection("Verify the Heparin states") + td.td_heparin(target = 0.4 , + cumulative = 0.8 , + time_remaining = 2646 ) + + + verify_status_heparinStates(4,PAUSE,ACTIVE) + + pauseButton = waitForObject(names.o_treatmentHeparin_heparinButton_TouchRect) + pauseText = utility.findObjectById(pauseButton, "_text") + mouseClick(pauseText) + + verify_status_heparinStates(2,RESUME,PAUSE) + + td.td_tx_state(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 0 , + 5 # Heparin Complete state + ) + status = waitForObject(names.o_treatmentHeparin_status_Rectangle) + statustext = utility.findObjectById(status,'_statusText') + test.compare(COMPLETE, statustext.text,"Status text should be ->"+str(COMPLETE)) + test.endSection() + + utils.tstDone() + + + + + + + \ No newline at end of file