Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -rdc699ba85fda9e7196a496a1b5ee79a3ea248be1 -r5a26db0d36200dceb1667403c90d4c901f1a5a6b --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision dc699ba85fda9e7196a496a1b5ee79a3ea248be1) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 5a26db0d36200dceb1667403c90d4c901f1a5a6b) @@ -174,6 +174,7 @@ INSTITUTIONAL_CONFIGURATIONS = "Institutional Configurations" DATE_AND_TIME = "Date and Time" LANGUAGE = "Language" + # Blood Prime TOTAL_FLUID_DELIVERED = "Total Fluid Delivered" DELIVERING_FLUID = "Delivering Fluid" Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -r49df12528c3be2e6c790fea6eec93c73c25bf8f6 -r5a26db0d36200dceb1667403c90d4c901f1a5a6b --- suite_leahi/shared/scripts/names.py (.../names.py) (revision 49df12528c3be2e6c790fea6eec93c73c25bf8f6) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision 5a26db0d36200dceb1667403c90d4c901f1a5a6b) @@ -508,21 +508,5 @@ o_Blood_Return_Complete_Fluid_Bolus_TouchRect = {"container": o_Overlay, "id": "_confirmTouch", "type": "ConfirmButton", "unnamed": 1 } #Trends and Screensaver -o_TreatmentTrends_TreatmentTrends = {"container": treatmentStack, "objectName": "_TreatmentTrends", "type": "TreatmentTrends", "visible": True} -o_TreatmentTrends_valueText_Text = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_valueText", "occurrence": 2, "type": "Text", "visible": True} -o_TreatmentTrends_paramList_ListView = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_paramList", "type": "ListView", "visible": True} -o_TreatmentTrends_paramListArea_Item = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_paramListArea", "type": "Item", "visible": True} -o_TreatmentTrends_paramListDelegate_Column = {"container": o_TreatmentTrends_TreatmentTrends, "id": "_paramListDelegate", "index": 0, "type": "Column", "unnamed": 1, "visible": True} -o_TreatmentTrends_timestampValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_timestampValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_bloodpressureValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_bloodpressureValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_pulseRateValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_pulseRateValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_ufVolumeRemovedValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_ufVolumeRemovedValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_ufRateValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_ufRateValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_arterialPressureValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_arterialPressureValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_venousPressureValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_venousPressureValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_tmpValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_tmpValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_bolusCumulativeDeliveredValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_bolusCumulativeDeliveredValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_bloodFlowRateValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_bloodFlowRateValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_dialysateFlowRateValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_dialysateFlowRateValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_dialysateTemperatureValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_dialysateTemperatureValue", "type": "ValueText", "visible": True} -o_TreatmentTrends_conductivityValue_ValueText = {"container": o_TreatmentTrends_TreatmentTrends, "objectName": "_conductivityValue", "type": "ValueText", "visible": True} +o_TreatmentTrends_TreatmentTrends = {"container": treatmentStack, "objectName": "_TreatmentTrends", "type": "TreatmentTrends", } +o_TreatmentTrends_paramListDelegate_Column = {"container": o_TreatmentTrends_TreatmentTrends, "id": "_paramListDelegate", "index": 0, "type": "Column", "unnamed": 1 } Index: suite_leahi/tst_trends_and_screensaver/test.py =================================================================== diff -u -rdc699ba85fda9e7196a496a1b5ee79a3ea248be1 -r5a26db0d36200dceb1667403c90d4c901f1a5a6b --- suite_leahi/tst_trends_and_screensaver/test.py (.../test.py) (revision dc699ba85fda9e7196a496a1b5ee79a3ea248be1) +++ suite_leahi/tst_trends_and_screensaver/test.py (.../test.py) (revision 5a26db0d36200dceb1667403c90d4c901f1a5a6b) @@ -1,20 +1,30 @@ -# Subject/Title: +# Subject/Title: Trends and Screensaver Screens - SW - 02 - Trends Screen - Q&R +# +# Functionalities: Testing of Trends and Screensaver Screens +# +# Steps: +# 1 Handle vitalsRequest sent messages messages from UI to FW +# 2 Start Leahi application and navigate to Main Treatment screen +# 3 Navigate to Trends Screen, send Trends Data and Compare it +# 4 Click on Vitals Popup Measure Vitals button and verify FW received +# 5 Send Normal and Maximum Trends Data and Compare it +# 6 Compare Rejection reasons of Vitals Popup import names, re -from configuration import utility, config -from leahi_dialin.ui import utils -from leahi_dialin.ui.td_messaging import TD_Messaging -from leahi_dialin.ui.dd_messaging import DD_Messaging -from leahi_dialin.common.td_defs import TDOpModes, TDTreatmentStates -from leahi_dialin.common.ui_defs import TXStates -from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions -from leahi_dialin.protocols import CAN -from leahi_dialin.utils import conversions +from configuration import utility, config, application_init +from leahi_dialin.ui import utils +from leahi_dialin.ui.td_messaging import TD_Messaging +from leahi_dialin.ui.dd_messaging import DD_Messaging +from leahi_dialin.common.td_defs import TDOpModes, TDTreatmentStates +from leahi_dialin.common.msg_defs import MsgIds +from leahi_dialin.protocols import CAN +from configuration.getrejectiontext import ScopedRejectionRepository -td_simulator = TD_Messaging() -dd_simulator = DD_Messaging() -vitalsrequest = None + +td_simulator = TD_Messaging() +dd_simulator = DD_Messaging() +vitalsRequest = None can_interface = td_simulator.can_interface @@ -47,12 +57,12 @@ 0, 0, ) - td_simulator.td_saline(0, cumulative_volume, 0, 0) + td_simulator.td_saline(0, 0, cumulative_volume, 0) td_simulator.td_treatment_set_points(blood_flow, dialysate_flow, dialysate_temp) dd_simulator.dd_conductivity(0, D29, 0, 0, 0) -def verify_trends_data( +def verify_trends_data_column_wise( systolic, diastolic, heartRate, @@ -67,74 +77,66 @@ dialysate_temp, D29, ): - + parent_object = utility.get_object_from_names( + names.o_TreatmentTrends_paramListDelegate_Column + ) test.compare( - utility.get_object_value(names.o_TreatmentTrends_bloodpressureValue_ValueText), + utility.findObjectById(parent_object, "_bloodpressureValue").value, f"{systolic}/{diastolic}", "Bloodpressure Value", ) test.compare( - utility.get_object_value(names.o_TreatmentTrends_pulseRateValue_ValueText), + utility.findObjectById(parent_object, "_pulseRateValue").value, str(heartRate), "Pulse Rate Value", ) test.compare( - utility.get_object_value( - names.o_TreatmentTrends_ufVolumeRemovedValue_ValueText - ), + utility.findObjectById(parent_object, "_ufVolumeRemovedValue").value, str(volume_delivered), "UF Volume Value", ) test.compare( - utility.get_object_value(names.o_TreatmentTrends_ufRateValue_ValueText), + utility.findObjectById(parent_object, "_ufRateValue").value, str(target_rate), "UF Rate Value", ) test.compare( - utility.get_object_value( - names.o_TreatmentTrends_arterialPressureValue_ValueText - ), + utility.findObjectById(parent_object, "_arterialPressureValue").value, str(H2_arterial_pressure), "Arterial Pressure Value", ) test.compare( - utility.get_object_value(names.o_TreatmentTrends_venousPressureValue_ValueText), + utility.findObjectById(parent_object, "_venousPressureValue").value, str(H14_venous_pressure), "Venous Pressure Value", ) test.compare( - utility.get_object_value(names.o_TreatmentTrends_tmpValue_ValueText), + utility.findObjectById(parent_object, "_tmpValue").value, str(tmp_pressure), "TMP Value", ) test.compare( - utility.get_object_value( - names.o_TreatmentTrends_bolusCumulativeDeliveredValue_ValueText - ), + utility.findObjectById(parent_object, "_bolusCumulativeDeliveredValue").value, str(cumulative_volume), "Cumulative Value", ) test.compare( - utility.get_object_value(names.o_TreatmentTrends_bloodFlowRateValue_ValueText), + utility.findObjectById(parent_object, "_bloodFlowRateValue").value, str(blood_flow), "Blood Flow Rate Value", ) test.compare( - utility.get_object_value( - names.o_TreatmentTrends_dialysateFlowRateValue_ValueText - ), + utility.findObjectById(parent_object, "_dialysateFlowRateValue").value, str(dialysate_flow), "Dialysate Flow Rate Value", ) test.compare( - utility.get_object_value( - names.o_TreatmentTrends_dialysateTemperatureValue_ValueText - ), + utility.findObjectById(parent_object, "_dialysateTemperatureValue").value, str(dialysate_temp), "Dialysate Temperature Value", ) test.compare( - utility.get_object_value(names.o_TreatmentTrends_conductivityValue_ValueText), + utility.findObjectById(parent_object, "_conductivityValue").value, str(D29 / 1000), "Conductivity Value", ) @@ -178,11 +180,7 @@ current_value = utility.findObjectById(parent, "_currentItem") current_value = str(current_value.text) - test.log(f"Updated value: {current_value}") - test.log(f"✅ Target value reached: {current_value}") - - def keyboard_object_map_helper(text): """ Method for setting custom object property's for keyboard keys @@ -206,43 +204,28 @@ input_field = waitForObject(input_field_obj) mouseClick(input_field) - # check the title - title = waitForObjectExists( - utility.setObjectText(text=title_name, obj=names.o_title_Text) - ) - test.compare(title_name, title.text, "Title text should be -> " + str(title_name)) - for text in expected_value: keyboard_value = keyboard_object_map_helper(text) utils.waitForGUI(0.2) mouseClick(waitForObjectExists(keyboard_value)) utils.waitForGUI(0.2) - test.compare( - actual_value, (input_field.text), "Value should be -> " + str(actual_value) - ) - test.log( - "User successfully authenticated through patient id -> " - + expected_value - + "using keypad." - ) - # handler for messages from UI to FW def handle_patient_vitals_request(message, timestamp=0.0): """ Called when the user requests to firmware from UI @return: None """ - global vitalsrequest - vitalsrequest = True + global vitalsRequest + vitalsRequest = True -def verify_automatic_vitals_request(): +def verify_vitals_request(): MAX_WAIT = 6 * 60 * 1000 # 5 minutes in seconds test.verify( - waitFor(lambda: vitalsrequest == True, MAX_WAIT), + waitFor(lambda: vitalsRequest == True, MAX_WAIT), "Testing UI -> TD message Vitals Request", ) @@ -260,19 +243,26 @@ can_interface.register_receiving_publication_function( channel_id, message_id, handle_patient_vitals_request ) + conf_path = application_init.configuration_folder_path() + "Alarms/Rejections.conf" + repo = ScopedRejectionRepository(path=conf_path) startApplication(utility.aut("-q")) td_simulator.td_operation_mode(TDOpModes.MODE_PRET.value) td_simulator.td_tx_state( + TDTreatmentStates.TREATMENT_START_STATE.value, 0, 0, 0, 0, 0, 0, 0, 0, 0 + ) + td_simulator.td_tx_state( TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) mouseClick( waitForObject(utility.setObjectText(names.o_listView_Item, config.TRENDS), 3000) ) - trends_data(1.65, 1.18, 150, 240, 200, 150, 132, 167, 15.3, 600) - td_simulator.td_vitals(121, 81, 71) - verify_trends_data(121, 81, 71, 1.65, 1.18, 150, 240, 200, 150, 132, 167, 15.3, 600) + trends_data(0.01, 0.01, 0, 0, 0, 0, 0, 0, 0.0, 0) + td_simulator.td_vitals(0, 0, 0) + test.startSection("Verification of Trends Data at Minimum Values") + verify_trends_data_column_wise(0, 0, 0, 0.01, 0.01, 0, 0, 0, 0, 0, 0, 0.0, 0) + test.endSection() td_simulator.td_operation_mode(TDOpModes.MODE_POST.value) td_simulator.td_operation_mode(TDOpModes.MODE_TREA.value) @@ -289,9 +279,8 @@ names.o_bpMeasurementIntervalControl_ValueAdjusterCustom, 5 ) mouseClick(utility.get_object_from_names(names.o_confirm_button)) + mouseClick(utility.get_object_from_names(names.o_Vitals_Popup_CloseButton)) - # verify_automatic_vitals_request() - mouseClick( waitForObject(utility.setObjectText(names.o_listView_Item, config.TRENDS), 3000) ) @@ -307,7 +296,43 @@ verify_valid_vitals_through_keypad( config.HEARTRATE, names.o_heartRate_TextEntry, "72", "72" ) + mouseClick(waitForObject(names.o_measureVitalsButton_TouchRect)) mouseClick(utility.get_object_from_names(names.o_confirm_button)) - verify_trends_data(122, 82, 72, 1.73, 1.26, 160, 250, 190, 170, 144, 147, 13.4, 700) - verify_automatic_vitals_request() + test.startSection("Verify UI the Vitals Request") + verify_vitals_request() + test.endSection() + + trends_data(9.99, 7.99, 200, 500, 250, 10000, 900, 900, 100.0, 1000) + + td_simulator.td_vitals(300, 200, 200) + test.startSection("Verification of Trends Data at Normal Values") + verify_trends_data_column_wise( + 122, 82, 72, 1.73, 1.26, 160, 250, 190, 170, 144, 147, 13.4, 700 + ) + test.endSection() + + test.startSection("Verification of Trends Data at Maximum Values") + verify_trends_data_column_wise( + 300, 200, 200, 9.99, 7.99, 200, 500, 250, 10000, 900, 900, 100.0, 1000 + ) + test.endSection() + + test.startSection("Verification of Vitals Popup Rejection Reasons") + mouseClick(utility.get_object_from_names(names.o_vitalsButton_VitalsButton)) + for rejection_reason in range(1, 60): + td_simulator.td_vitals_adjustment_response(vRejectionReason=rejection_reason) + + REJECT_TEXT = repo.get(str(rejection_reason), "Title") + vitals_popup_notification = utility.get_object_from_names( + names.o_notification_bar + ) + + vitals_popup_notification_text = str(vitals_popup_notification.text) + test.compare( + vitals_popup_notification_text, + "Rejected Reason: [" + str(rejection_reason) + "] " + REJECT_TEXT, + f"Rejection reason number comparison for reason {rejection_reason}", + ) + + test.endSection()