Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -rf6d23e89ccf01b57313b0e920f013dc1027706d4 -rb8b0f0c6a997f1cd1a4b7da3daa4f32aec2349a4 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision f6d23e89ccf01b57313b0e920f013dc1027706d4) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision b8b0f0c6a997f1cd1a4b7da3daa4f32aec2349a4) @@ -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 -rb8b0f0c6a997f1cd1a4b7da3daa4f32aec2349a4 --- suite_leahi/shared/scripts/names.py (.../names.py) (revision f6d23e89ccf01b57313b0e920f013dc1027706d4) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision b8b0f0c6a997f1cd1a4b7da3daa4f32aec2349a4) @@ -3,81 +3,109 @@ from objectmaphelper import * # Top Parents -o_Gui_MainView = { "type": "Gui::MainView", "unnamed": 1 } -o_QQuickView = { "type": "QQuickView" } -o_Overlay = {"container": o_QQuickView, "type": "Overlay" } +o_Gui_MainView = { "type": "Gui::MainView", "unnamed": 1 } +o_QQuickView = { "type": "QQuickView" } +o_Overlay = {"container": o_QQuickView, "type": "Overlay" } # Solution Infusion -o_standByScreen_MainHome = {"container": o_Gui_MainView, "type": "MainHome" } -treatmentStack = {"container": o_Gui_MainView, "type": "TreatmentStack" } -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 } +o_standByScreen_MainHome = {"container": o_Gui_MainView, "type": "MainHome" } +treatmentStack = {"container": o_Gui_MainView, "type": "TreatmentStack" } +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 } # Main Treatment -o_arterial_RangeBar = {"container": mainTreatmentScreen, "id": "_arterialRangeBar", "type": "TreatmentPressureComponent", "unnamed": 1 } -o_venous_RangeBar = {"container": mainTreatmentScreen, "id": "_venousRangeBar", "type": "TreatmentPressureComponent", "unnamed": 1 } -o_tmp_RangeBar = {"container": mainTreatmentScreen, "id": "_tmpRangeBar", "type": "TreatmentPressureComponent", "unnamed": 1 } -o_treatmentUltrafiltration = {"container": mainTreatmentScreen, "objectName": "treatmentUltrafiltration", "type": "TreatmentUltrafiltration" } -o_UF_Volume_Text = {"container": mainTreatmentScreen, "id": "_ufVolume", "type": "LabelValue", "unnamed": 1 } -o_UF_Rate_Text = {"container": mainTreatmentScreen, "id": "_ufRate", "type": "LabelValue", "unnamed": 1 } -o_treatment_duration = {"container": mainTreatmentScreen, "objectName": "treatmentTime", "type": "TreatmentTime" } -o_UF_Volume_LabelValue = {"container": mainTreatmentScreen, "id": "_ufVolume", "type": "LabelValue", "unnamed": 1 } -o_UF_Rate_LabelValue = {"container": mainTreatmentScreen, "id": "_ufRate", "type": "LabelValue", "unnamed": 1 } -o_Volume_Delivered = {"container": mainTreatmentScreen, "id": "_valueText", "type": "Text", "unnamed": 1 } -o_blood_flow_value = {"container": mainTreatmentScreen, "id": "_bloodFlow", "objectName": "bloodFlowComponent", "type": "TreatmentFlowsComponent" } -o_dial_flow_value = {"container": mainTreatmentScreen, "objectName": "dialysateFlowComponent", "type": "TreatmentFlowsComponent" } -o_dial_tmp_value = {"container": mainTreatmentScreen, "id": "_dialysateTemp", "objectName": "dialysateTempComponent", "type": "TreatmentFlowsComponent" } -o_dial_cond_value = {"container": mainTreatmentScreen, "id": "_dialysateCond", "objectName": "dialysateCondComponent", "type": "TreatmentFlowsComponent" } -o_blood_flow_title_Text = {"container": mainTreatmentScreen, "id": "_bloodFlow", "objectName": "bloodFlowComponent", "type": "TreatmentFlowsComponent" } -o_dialyste_flow_title_Text = {"container": mainTreatmentScreen, "objectName": "dialysateFlowComponent", "type": "TreatmentFlowsComponent" } -o_dialyste_tmp_title_Text = {"container": mainTreatmentScreen, "id": "_dialysateTemp", "objectName": "dialysateTempComponent", "type": "TreatmentFlowsComponent" } -o_dialyste_cond_title_Text = {"container": mainTreatmentScreen, "id": "_dialysateCond", "objectName": "dialysateCondComponent", "type": "TreatmentFlowsComponent" } -o_treatmentTimeNotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "notification", "type": "NotificationBarSmall" } +o_arterial_RangeBar = {"container": mainTreatmentScreen, "id": "_arterialRangeBar", "type": "TreatmentPressureComponent", "unnamed": 1 } +o_venous_RangeBar = {"container": mainTreatmentScreen, "id": "_venousRangeBar", "type": "TreatmentPressureComponent", "unnamed": 1 } +o_tmp_RangeBar = {"container": mainTreatmentScreen, "id": "_tmpRangeBar", "type": "TreatmentPressureComponent", "unnamed": 1 } +o_treatmentUltrafiltration = {"container": mainTreatmentScreen, "objectName": "treatmentUltrafiltration", "type": "TreatmentUltrafiltration" } +o_UF_Volume_Text = {"container": mainTreatmentScreen, "id": "_ufVolume", "type": "LabelValue", "unnamed": 1 } +o_UF_Rate_Text = {"container": mainTreatmentScreen, "id": "_ufRate", "type": "LabelValue", "unnamed": 1 } +o_treatment_duration = {"container": mainTreatmentScreen, "objectName": "treatmentTime", "type": "TreatmentTime" } +o_UF_Volume_LabelValue = {"container": mainTreatmentScreen, "id": "_ufVolume", "type": "LabelValue", "unnamed": 1 } +o_UF_Rate_LabelValue = {"container": mainTreatmentScreen, "id": "_ufRate", "type": "LabelValue", "unnamed": 1 } +o_Volume_Delivered = {"container": mainTreatmentScreen, "id": "_valueText", "type": "Text", "unnamed": 1 } +o_blood_flow_value = {"container": mainTreatmentScreen, "id": "_bloodFlow", "objectName": "bloodFlowComponent", "type": "TreatmentFlowsComponent" } +o_dial_flow_value = {"container": mainTreatmentScreen, "objectName": "dialysateFlowComponent", "type": "TreatmentFlowsComponent" } +o_dial_tmp_value = {"container": mainTreatmentScreen, "id": "_dialysateTemp", "objectName": "dialysateTempComponent", "type": "TreatmentFlowsComponent" } +o_dial_cond_value = {"container": mainTreatmentScreen, "id": "_dialysateCond", "objectName": "dialysateCondComponent", "type": "TreatmentFlowsComponent" } +o_blood_flow_title_Text = {"container": mainTreatmentScreen, "id": "_bloodFlow", "objectName": "bloodFlowComponent", "type": "TreatmentFlowsComponent" } +o_dialyste_flow_title_Text = {"container": mainTreatmentScreen, "objectName": "dialysateFlowComponent", "type": "TreatmentFlowsComponent" } +o_dialyste_tmp_title_Text = {"container": mainTreatmentScreen, "id": "_dialysateTemp", "objectName": "dialysateTempComponent", "type": "TreatmentFlowsComponent" } +o_dialyste_cond_title_Text = {"container": mainTreatmentScreen, "id": "_dialysateCond", "objectName": "dialysateCondComponent", "type": "TreatmentFlowsComponent" } +o_treatmentTimeNotificationBarSmall = {"container": mainTreatmentScreen, "objectName": "notification", "type": "NotificationBarSmall" } # settings_service_export_logs -o_listView_ListView = {"container": o_Gui_MainView, "id": "_listView", "type": "ListView", "unnamed": 1 } -o_listView_delegateControl = {"container": o_listView_ListView, "index": 2, "objectName": "delegateControl", "type": "Item" } -o_Settings_Menu = {"container": o_listView_delegateControl, "objectName": "_touchRect2", "type": "TouchRect" } -o_SettingsHome = {"container": o_Gui_MainView, "objectName": "_SettingsHome", "type": "SettingsHome" } -o_SettingsExportLogs = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsExportLogs" } -o_DeviceSettingsTitleText = {"container": o_SettingsHome, "id":"_titleText", "type": "Text", "unnamed": 1 } -o_SettingsInformation = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase" } -o_USBEjectButton = {"container": o_SettingsExportLogs, "id": "_usbEjectButton", "type": "USBButton", "unnamed": 1 } -o_ExportLogsPageTitleText = {"container": o_SettingsInformation, "id":"_titleText", "type": "Text", "unnamed": 1 } -o_LogTypeComboBox = {"container": o_SettingsInformation, "id": "_logTypeCombo", "type": "ComboBox", "unnamed": 1 } -o_OptionComboBox = {"container": o_Overlay, "type": "Text", "unnamed": 1 } -o_ExportButton = {"container": o_SettingsExportLogs, "id": "_logTypeExportButton", "type": "ExportButton", "unnamed": 1 } -o_ExportLogsProgressRect = {"container": o_SettingsExportLogs, "id": "_progressRect", "type": "ProgressRect", "unnamed": 1 } -o_ExportLogsNotificationBar = {"container": o_SettingsExportLogs, "id": "_information", "type": "NotificationBarSmall" } -o_DeviceSettingsGrid = {"container": o_SettingsHome, "id": "_grid", "type": "Grid", } +o_listView_ListView = {"container": o_Gui_MainView, "id": "_listView", "type": "ListView", "unnamed": 1 } +o_listView_delegateControl = {"container": o_listView_ListView, "index": 2, "objectName": "delegateControl", "type": "Item" } +o_Settings_Menu = {"container": o_listView_delegateControl, "objectName": "_touchRect2", "type": "TouchRect" } +o_SettingsHome = {"container": o_Gui_MainView, "objectName": "_SettingsHome", "type": "SettingsHome" } +o_SettingsExportLogs = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsExportLogs" } +o_DeviceSettingsTitleText = {"container": o_SettingsHome, "id":"_titleText", "type": "Text", "unnamed": 1 } +o_SettingsInformation = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase" } +o_USBEjectButton = {"container": o_SettingsExportLogs, "id": "_usbEjectButton", "type": "USBButton", "unnamed": 1 } +o_ExportLogsPageTitleText = {"container": o_SettingsInformation, "id":"_titleText", "type": "Text", "unnamed": 1 } +o_LogTypeComboBox = {"container": o_SettingsInformation, "id": "_logTypeCombo", "type": "ComboBox", "unnamed": 1 } +o_OptionComboBox = {"container": o_Overlay, "type": "Text", "unnamed": 1 } +o_ExportButton = {"container": o_SettingsExportLogs, "id": "_logTypeExportButton", "type": "ExportButton", "unnamed": 1 } +o_ExportLogsProgressRect = {"container": o_SettingsExportLogs, "id": "_progressRect", "type": "ProgressRect", "unnamed": 1 } +o_ExportLogsNotificationBar = {"container": o_SettingsExportLogs, "id": "_information", "type": "NotificationBarSmall" } +o_DeviceSettingsGrid = {"container": o_SettingsHome, "id": "_grid", "type": "Grid", } #HeaderBar Information Pop up -o_InformationIconButton = {"container": o_Gui_MainView, "id": "_informationButton", "type": "IconButton", "unnamed": 1 } -o_InformationParameters = {"container": o_Overlay, "type": "Text", "unnamed": 1 } -o_VersionColumn = {"container": o_Overlay, "id": "_versionColumn", "type": "Column", "unnamed": 1 } +o_InformationIconButton = {"container": o_Gui_MainView, "id": "_informationButton", "type": "IconButton", "unnamed": 1 } +o_InformationParameters = {"container": o_Overlay, "type": "Text", "unnamed": 1 } +o_VersionColumn = {"container": o_Overlay, "id": "_versionColumn", "type": "Column", "unnamed": 1 } # Device Settings Information Version -o_DeviceSettingsInformation = {"container": o_SettingsHome, "id": "_touchItem", "type": "TouchRect", "unnamed": 1 } -o_InformationPageTitleText = {"container": o_SettingsInformation, "id": "_titleText", "type": "Text", "unnamed": 1 } -o_SettingsBase_SettingsInformation = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase" } -o_SettingsBase_Information_Text = {"container": o_SettingsBase_SettingsInformation, "type": "Text", "unnamed": 1 } -o_SettingsBase_SettingsInformation_2 = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsInformation" } -o_SettingsBase_grid_Grid = {"container": o_SettingsBase_SettingsInformation_2, "id": "_grid", "type": "Grid", "unnamed": 1 } +o_DeviceSettingsInformation = {"container": o_SettingsHome, "id": "_touchItem", "type": "TouchRect", "unnamed": 1 } +o_InformationPageTitleText = {"container": o_SettingsInformation, "id": "_titleText", "type": "Text", "unnamed": 1 } +o_SettingsBase_SettingsInformation = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase" } +o_SettingsBase_Information_Text = {"container": o_SettingsBase_SettingsInformation, "type": "Text", "unnamed": 1 } +o_SettingsBase_SettingsInformation_2 = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsInformation" } +o_SettingsBase_grid_Grid = {"container": o_SettingsBase_SettingsInformation_2, "id": "_grid", "type": "Grid", "unnamed": 1 } #HeaderBar WiFi -o_HeaderBar_WiFi_IconButton = {"container": o_Gui_MainView, "id": "_wifiButton", "type": "IconButton", "unnamed": 1 } -o_HeaderBar_WiFi_Popup = {"container": o_Overlay, "id": "_backgroundRect", "type": "Rectangle", "unnamed": 1 } -o_HeaderBar_Wifi_PopuoParameters = {"container": o_Overlay, "type": "Text", "unnamed": 1 } -o_HeaderBar_WiFi_IconImage = {"container": o_Gui_MainView, "id": "_iconImage", "source": "qrc:/images/iWifi", "type": "Image", "unnamed": 1 } +o_HeaderBar_WiFi_IconButton = {"container": o_Gui_MainView, "id": "_wifiButton", "type": "IconButton", "unnamed": 1 } +o_HeaderBar_WiFi_Popup = {"container": o_Overlay, "id": "_backgroundRect", "type": "Rectangle", "unnamed": 1 } +o_HeaderBar_Wifi_PopuoParameters = {"container": o_Overlay, "type": "Text", "unnamed": 1 } +o_HeaderBar_WiFi_IconImage = {"container": o_Gui_MainView, "id": "_iconImage", "source": "qrc:/images/iWifi", "type": "Image", "unnamed": 1 } #Device Settings Wi-Fi -o_SettingsBase_SettingsInformation = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase" } -o_SettingsBase_Information_Text = {"container": o_SettingsBase_SettingsInformation, "type": "Text", "unnamed": 1 } -o_InformationPageTitleText = {"container": o_SettingsInformation, "id": "_titleText", "type": "Text", "unnamed": 1 } -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" } +o_SettingsBase_SettingsInformation = {"container": o_Gui_MainView, "objectName": "_SettingsBase", "type": "SettingsBase" } +o_SettingsBase_Information_Text = {"container": o_SettingsBase_SettingsInformation, "type": "Text", "unnamed": 1 } +o_InformationPageTitleText = {"container": o_SettingsInformation, "id": "_titleText", "type": "Text", "unnamed": 1 } +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 -rb8b0f0c6a997f1cd1a4b7da3daa4f32aec2349a4 --- suite_leahi/suite.conf (.../suite.conf) (revision f6d23e89ccf01b57313b0e920f013dc1027706d4) +++ suite_leahi/suite.conf (.../suite.conf) (revision b8b0f0c6a997f1cd1a4b7da3daa4f32aec2349a4) @@ -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 b8b0f0c6a997f1cd1a4b7da3daa4f32aec2349a4) @@ -0,0 +1,215 @@ +# 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: +# Heparin: +# 1 Start Leahi Application simulate the TD Dialysis mode and navigate to Heparin screen, +# Verify the Heparin prescription parameters in off state +# 2 Navigate to create treatement and set Heparin dispensing, Heparin bolus and stop values to OFF state +# And Verify the values in haparin page +# 4 Navigate to create treatement and set Heparin dispensing, Heparin bolus and stop values to some state +# And Verify the same parameter displayin in Heparin page +# 5 Navigate to Factory Reset Screen and verify and comapre Title bar text +# And Verify the parameter under Factory Reset screen and Click Conform button +# for factory then Click Cancel on Popup. Angain Click conform on Factory Reset +# then Click conform on Popup and Click Back Button + +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