Index: suite_leahi/shared/scripts/configuration/config.py =================================================================== diff -u -rc091cb2bd9bd4b20538496aa27435e8c8cf39e7a -r2807dd5593235d0424ec9ba288bfc56f7e5c1226 --- suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision c091cb2bd9bd4b20538496aa27435e8c8cf39e7a) +++ suite_leahi/shared/scripts/configuration/config.py (.../config.py) (revision 2807dd5593235d0424ec9ba288bfc56f7e5c1226) @@ -213,5 +213,6 @@ RINSEBACK_PAUSED = "Rinseback Paused" BLOOD_RETURN_COUNTDOWN_DESCRIPTION_TEXT = "Blood return will NOT be allowed in:" BLOOD_RETURN_COMPLETE = "Blood Return Complete!" +TEST_PRIMARY ="Test the primary carbon filter and enter the result below" +TEST_SECONDARY ="Test the secondary carbon filter and enter the result below" - Index: suite_leahi/shared/scripts/names.py =================================================================== diff -u -r4045057acb2ebda3ca38376e140baa6c48b7231a -r2807dd5593235d0424ec9ba288bfc56f7e5c1226 --- suite_leahi/shared/scripts/names.py (.../names.py) (revision 4045057acb2ebda3ca38376e140baa6c48b7231a) +++ suite_leahi/shared/scripts/names.py (.../names.py) (revision 2807dd5593235d0424ec9ba288bfc56f7e5c1226) @@ -141,7 +141,7 @@ o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate = {"container": o_preTreatmentStack_PreTreatmentStack, "objectName": "_PreTreatmentCreate", "type": "PreTreatmentCreate" } o_PreTreatmentCreate_gridSteps_Grid = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_gridSteps", "type": "Grid", "unnamed": 1 } o_PreTreatmentCreate_bloodFlowRate_LabelUnitContainer = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_bloodFlowRate", "type": "LabelUnitContainer", "unnamed": 1 } -o_PatientIDEntry_TextEntry = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_pretreatmentPatientIDEntry", "type": "TextEntry", "unnamed": 1 } + o_PreTreatmentCreate_heparinDispensingRate_LabelUnitContainer = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinDispensingRate", "type": "LabelUnitContainer", "unnamed": 1 } o_PreTreatmentCreate_heparinBolusVolume_LabelUnitContainer = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_heparinBolusVolume", "type": "LabelUnitContainer", "unnamed": 1 } o_PreTreatmentCreate_heparinBolusVolume_Off_Text = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "type": "Text", "unnamed": 1 } @@ -286,5 +286,13 @@ o_dialsateTemperatureContainer_LabelUnitContainer = {"container": o_Overlay, "objectName": "_dialsateTemperatureContainer", "type": "LabelUnitContainer" } o_actualRORejectionPercentageContainer_LabelUnitContainer = {"container": o_Overlay, "objectName": "_actualRORejectionPercentageContainer", "type": "LabelUnitContainer" } -createHDTreatment_TouchRect = {"container": o_standByScreen_MainHome, "id": "_createHDTreatment", "type": "TouchRect", "unnamed": 1 } -o_PreTreatmentCreate_patientID_LabelUnitContainer = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_patientID", "type": "LabelUnitContainer", "unnamed": 1} +o_createHDTreatment_TouchRect = {"container": o_standByScreen_MainHome, "id": "_createHDTreatment", "type": "TouchRect", "unnamed": 1 } +o_PreTreatmentCreate_patientID_LabelUnitContainer = {"container": o_preTreatmentStack_PreTreatmentCreate_PreTreatmentCreate, "id": "_patientID", "type": "LabelUnitContainer", "unnamed": 1 } +o_waterSample_WaterSamplePage = {"container": o_Overlay, "id": "_waterSample", "type": "WaterSamplePage", "unnamed": 1 } +o_LabelUnitValueAdjuster_LabelUnitValueAdjuster = {"container": o_Overlay, "objectName": "_LabelUnitValueAdjuster", "type": "LabelUnitValueAdjuster" } + + + + + + Index: suite_leahi/tst_water_dialysate_blood_sampling/test.py =================================================================== diff -u -r4045057acb2ebda3ca38376e140baa6c48b7231a -r2807dd5593235d0424ec9ba288bfc56f7e5c1226 --- suite_leahi/tst_water_dialysate_blood_sampling/test.py (.../test.py) (revision 4045057acb2ebda3ca38376e140baa6c48b7231a) +++ suite_leahi/tst_water_dialysate_blood_sampling/test.py (.../test.py) (revision 2807dd5593235d0424ec9ba288bfc56f7e5c1226) @@ -1,14 +1,17 @@ -# Subject/Title: LDT -3449 Water, Dialysate, and Blood Sampling - SW - 02 - Water sample & Dialysate Checks - Q&R - 15: SIT - Software Integration Tests - Squish Qt +# Subject/Title : LDT -3449 Water, Dialysate, and Blood Sampling - SW - 02 - Water sample & Dialysate Checks - Q&R - 15: SIT - Software Integration Tests - Squish Qt +# LDT-4207 NON-FEATURE: SW Misc & Enhc - SW - 02 - Water/Dialysate Sample - Q&R # Functionalities: Testing all functionalities of Water, Dialysate, and Blood Sampling checks # # Steps: # Dialsyate and Water Sampling: # 1 Navigate to create treatement and set Acid concentrate value # 2 Click on Water sample option and check Water sample dialog page is visible -# 3 In the Water sample dialog check the FW recieves the result -# a. Select the Chlorine level > 0.1 mg/L value and check FW receieves the result -# b. Select the Chlorine level ≤ 0.1 mg/L value and check FW receieves the result -# 4 +# 3 Press the water sample icon and the FW broadcasted Water Sample Data will provide Valve (1 or 2) +# - Test the string should say primary for valve 1 and secondary for valve 2 +# 4 Test send the Water sample result request and FW receives the value +# - the last result and time stamp should be displayed after the FW response +# 5 Close the dialog. On the Water Sample Data broad case when switching from OFF -> Timed Out the UI should open the water sample dialog +# 6 Navigate to dialysate tab and check the acid concentrate value import names import can @@ -25,6 +28,7 @@ td =TD_Messaging() watersample = None +can_interface = td.can_interface # handler for messages from UI to FW @@ -33,17 +37,59 @@ Called when the user requests to firmware from UI @return: None """ - message = message['message'] - index = MsgFieldPositions.START_POS_FIELD_1 - state,index = conversions.bytearray_to_integer( message, index) global watersample - watersample = state + watersample = True + +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 = waitForObject(obj) + # change range as per your screen count + + left_arrow = utility.findObjectById(parent_obj, "_leftArrow") + right_arrow =utility.findObjectById(parent_obj, "_rightArrow") + + # Read current value (supports invisible text too) + + current_value = round(float(waitForObject(obj).value), 2) + + # 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)) + + current_value = round(float(waitForObject(obj).value), 2) + + test.log(f"Updated value: {current_value}") + + test.log(f" Target value reached: {current_value}") + def set_acid_concentrate(): test.startSection("Set acid concentrate") navigation.navigation_pageIndicator_step(config.CREATERX) - mouseClick(waitForObject(names.o_PreTreatmentCreate_patientID_LabelUnitContainer)) - waitForObject(names.o_PreTreatmentCreate_patientID_LabelUnitContainer).text ="abcd" + patient_id = waitForObject(names.o_PreTreatmentCreate_patientID_LabelUnitContainer) + patient_id_edit = utility.findObjectById(patient_id, "_editButton") + mouseClick(patient_id_edit) + mouseClick(waitForObject(names.o_pretreatmentPatientIDEntry_TextEntry)) + # type(waitForObject(names.o_pretreatmentPatientIDEntry_TextEntry),"Test") + waitForObject(names.o_pretreatmentPatientIDEntry_TextEntry).text ="abcd" + mouseClick(waitForObject(names.o_HeaderBar_WiFi_Popup), 611, 343, Qt.LeftButton) + mouseClick(waitForObject(names.o_confirmButton_ConfirmButton)) utility.select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,config.ACID_CONCENTRATE,2) test.endSection() @@ -55,15 +101,40 @@ td.td_water_sample(valve = 0, timeout = 0 ) - chlorine_level = waitForObject(names.o_Column) - fail_chlorine = utility.findObjectById(chlorine_level, "_failContainer") - mouseClick(waitForObject(fail_chlorine)) - mouseClick(waitForObject(names.o_confirmButton_ConfirmButton_2)) - test.verify(waitFor( lambda: watersample == 0, 3000), "Testing FW received Chlorine level > 0.1 mg/L Value") - pass_chlorine = utility.findObjectById(chlorine_level, "_passContainer") - mouseClick(waitForObject(pass_chlorine)) - mouseClick(waitForObject(names.o_confirmButton_ConfirmButton_2,2000)) - test.verify(waitFor( lambda: watersample == 1, 3000), "Testing FW received Chlorine level ≤ 0.1 mg/L Value") + parent_obj = waitForObject(names.o_waterSample_WaterSamplePage) + test_primary = utility.findObjectById(parent_obj, "_message") + test.compare(test_primary.text, config.TEST_PRIMARY, "{} should be primary when valve is 1".format(test_primary.text)) + td.td_water_sample(valve = 1, + timeout = 0 ) + test_secondary = utility.findObjectById(parent_obj, "_message") + test.compare(test_secondary.text, config.TEST_SECONDARY, "{} should be secondary when valve is 2".format(test_secondary.text)) + set_value_based_on_target(names.o_LabelUnitValueAdjuster_LabelUnitValueAdjuster, 0.14) + mouseClick(names.o_confirmButton_TouchRect) + # handle sent messages from UI + global watersample + if can_interface is not None: + channel_id = CAN.CanChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_WATER_SAMPLE_RESULT_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_water_sample_request) + + test.verify(waitFor(lambda: watersample == True, 3000), f"Testing FW received") + td.td_water_sample_result_response( vAccepted = 1 , + vRejectionReason = 0 , + vValue = 1.0) + mouseClick(names.o_waterSample_IconButton) + last_tested = utility.findObjectById(parent_obj, "_lastRecorded") + test.verify(last_tested.visible, "Last tested text is visible") + last_result = utility.findObjectById(parent_obj,"_lastValue") + test.verify(last_result.visible, "Last result text is visible") + td.td_water_sample_result_response( vAccepted = 1 , + vRejectionReason = 0 , + vValue = 1.0) + td.td_water_sample(valve = 1, + timeout = 1 ) + popup_obj = waitForObject(names.o_PopupItem) + test.verify(popup_obj.visible, "Water sample popup is visible") test.endSection() def dialysate_tab(): @@ -104,28 +175,16 @@ def main(): utils.tstStart(__file__) startApplication(utility.aut("-q")) - can_interface = td.can_interface - global watersample - - # handle sent messages from UI - if can_interface is not None: - channel_id = CAN.CanChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_UI_WATER_SAMPLE_RESULT_REQUEST.value - can_interface.register_receiving_publication_function(channel_id, - message_id, - handle_water_sample_request) - + test.startSection("Verify the water sample, dialysate and Blood sampling ") td.td_operation_mode(TDOpModes.MODE_STAN.value) hemodialysis = waitForObject(names.o_createHDTreatment_TouchRect) hemodialysis_btn = utility.findChildByText(hemodialysis, "Hemodialysis") mouseClick(hemodialysis_btn) td.td_Treatment_Parameters_CreateRx(vRejectionReason =0) td.td_operation_mode(TDOpModes.MODE_PRET.value) - # Nextbutton = utility.setObjectText(obj =names.o_preTreatmentStack_Text, text =config.NEXT) - # mouseClick(waitForObject(Nextbutton)) - # td.td_blood_set_auto_load_response(vRejectionReason = 0) set_acid_concentrate() water_sample_tab() + test.endSection() dialysate_tab() utils.tstDone()