Index: suite_leahi/tst_fluid_bolus/test.py =================================================================== diff -u -r8db28688e2a5c59581798955c6127a63addf100b -rc235d7f9ebda8fa8160306803187cccfa9f17cc7 --- suite_leahi/tst_fluid_bolus/test.py (.../test.py) (revision 8db28688e2a5c59581798955c6127a63addf100b) +++ suite_leahi/tst_fluid_bolus/test.py (.../test.py) (revision c235d7f9ebda8fa8160306803187cccfa9f17cc7) @@ -1,4 +1,18 @@ -# -*- coding: utf-8 -*- +# Subject/Title: LDT-4575 NON-FEATURE: SW Misc & Enhc - SW - 02 - SW Integration - Fluid Bolus - Q&R +# and LDT-2085 Solution Infusion - SW - 02 - Q&R +# +# Functionalities: Testing of Fluid Bolus +# +# Steps: +# 1 Handle fluidBolusStartState sent messages from UI +# 2 Start Leahi Application, simulate TD standby mode and verify Standby screen +# simulate TD Treatment Mode and simulate Treatment Dialysis state verify main treatment screen +# 3 Test the bolus permitted parameter which will handle disabling or enabling the start bolus button +# 4 Click on Start Bolus button in UI and Verify FW receives the request +# 5 Test vTDTreatmentStates.sbRunning, Testing current bolus value text, Testing progress bar current bolus value +# 6 Click on Stop Bolus button in UI and Verify FW receives the request +# 7 Testing progress bar bolus off +# 8 Comparison of Rejection Reasons # Pythons import os @@ -19,20 +33,21 @@ import names -salineBolusStartState = None +fluidBolusStartState = None def main(): + test.startSection("Fluid Bolus") td_interface = TD_Messaging() can_interface = td_interface.can_interface - global salineBolusStartState + global fluidBolusStartState # 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_SOLUTION_INFUSION_REQUEST.value can_interface.register_receiving_publication_function(channel_id, message_id, - handle_solution_infusion_request) + handle_fluid_bolus_request) startApplication(utility.aut("-q")) @@ -59,9 +74,9 @@ # verify main treatment screen test.verify(waitForObjectExists(names.mainTreatmentScreen), "In Main Treatment") - # verify saline text - salineTextObj = waitForObject(names.salineDeliveredText) - test.compare(salineTextObj.text, config.TOTAL_FLUID_DELIVERED, "Testing 'Total Saline Delivered' text") + # verify fluid text + fluidTextObj = waitForObject(names.fluidDeliveredText) + test.compare(fluidTextObj.text, config.TOTAL_FLUID_DELIVERED, "Testing 'Total Fluid Delivered' text") verify_start_bolus_button_state(config.DISABLED, "Comparison of Start Bolus Button Disabled State") @@ -77,7 +92,7 @@ # verify send start bolus req message mouseClick(waitForObject(names.startFluidButton)) - test.verify(waitFor(lambda: salineBolusStartState == 1, 5000), "Testing UI -> TD message start bolus") + test.verify(waitFor(lambda: fluidBolusStartState == 1, 5000), "Testing UI -> TD message start bolus") # change state to in progress td_interface.td_tx_state( @@ -89,18 +104,18 @@ 0 , 0 , 0 , - TXStates.SALINE_BOLUS_STATE_IN_PROGRESS , # saline in progess + TXStates.SALINE_BOLUS_STATE_IN_PROGRESS , # fluid bolus in progess 0 ) # verify isStarted property binding to vTDTreatmentStates.sbRunning - treatmentSaline = waitForObject(names.treatmentSaline) - test.compare(treatmentSaline.isStarted, True, "Testing vTDTreatmentStates.sbRunning") + treatmentFluid = waitForObject(names.treatmentFluid) + test.compare(treatmentFluid.isStarted, True, "Testing vTDTreatmentStates.sbRunning") # verify text - test.compare(salineTextObj.text, config.DELIVERING_FLUID, "Testing Saline Description text") + test.compare(fluidTextObj.text, config.DELIVERING_FLUID, "Testing Fluid Description text") - # verify saline data + # verify fluid data bolusValueInTest = 75 td_interface.td_saline( 100 , # target_volume @@ -109,17 +124,17 @@ 1 # bolus_permitted ) - # verify saline text + # verify fluid text currentBolusTextObj = waitForObject(names.currentBolusVolume) test.compare(currentBolusTextObj.text, str(bolusValueInTest), "Testing current bolus value text") # verify progress bar - progressBarObj = waitForObject(names.salineProgressBar) + progressBarObj = waitForObject(names.fluidProgressBar) test.compare(progressBarObj.value, bolusValueInTest, "Testing progress bar current bolus value") # verify send stop bolus req message mouseClick(waitForObject(names.startFluidButton)) - test.verify(waitFor(lambda: salineBolusStartState == 0, 5000), "Testing UI -> TD message stop bolus") + test.verify(waitFor(lambda: fluidBolusStartState == 0, 5000), "Testing UI -> TD message stop bolus") # change state to idle td_interface.td_tx_state( @@ -131,7 +146,7 @@ 0 , 0 , 0 , - TXStates.SALINE_BOLUS_STATE_IDLE , # saline in idle + TXStates.SALINE_BOLUS_STATE_IDLE , # fluid in idle 0 ) @@ -159,18 +174,20 @@ f"Rejection reason number comparison for reason {rejection_reason}", ) + test.endSection() + # handler for messages from UI to FW -def handle_solution_infusion_request( message, timestamp = 0.0): +def handle_fluid_bolus_request( message, timestamp = 0.0): """ 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 salineBolusStartState - salineBolusStartState = state + global fluidBolusStartState + fluidBolusStartState = state # verify start bolus button enabled or disabled state def verify_start_bolus_button_state(expected_state, message):