Index: suite_leahi/tst_rinseback/test.py =================================================================== diff -u -r81e4dab65efa7ef5b4bd2ecd0bf0a5c60c79dc91 -rfa71e89d96d4822d2174d6ba9650807ef000c1a6 --- suite_leahi/tst_rinseback/test.py (.../test.py) (revision 81e4dab65efa7ef5b4bd2ecd0bf0a5c60c79dc91) +++ suite_leahi/tst_rinseback/test.py (.../test.py) (revision fa71e89d96d4822d2174d6ba9650807ef000c1a6) @@ -1,32 +1,56 @@ -# -*- coding: utf-8 -*- - +# Subject/Title: LDT - 2953 Rinseback - SW - 02 - Q&R - 15: SIT - Software Integration Tests - Squish Qt +# Functionalities: Testing all functionalities of Rinseback feature in the treatment screen +# +# Steps: +# Rinseback Feature: +# Navigate to the treatment and change the submode to Rinseback state +# Send the pressure container values from the FW +# Verify UI displays the correct values which are send from the FW +# Send the rinseback data from FW and verify +# 1. Progress circle show correct values +# 2. Flow rate value displayed in the UI +# Click on pause rinseback button Verify the following +# 1. FW gets the request with correct opmode +# Test Rejection +# Verify the error message in the UI +# Test accepted +# Orange progress bar should be displayed +# "Rinseback Paused" text should be displayed +# Verify the timeout text in the UI +# Click on Resume rinseback button on the UI +# Verify the FW gets the request with correct opmode +# Change the rinseback submode to RUN state +# Click on increment and decrement rinseback button +# Verify the FW gets the request with correct opmode +# Click on End Rinseback button +# Verify the FW gets the request with correct opmode +# Change the rinseback submode to Stop state and verify the screen changes to Rinseback complete page import names import can # plugin specific from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions from leahi_dialin.protocols import CAN from leahi_dialin.ui import utils -from configuration import utility,config,navigation -from configuration import config +from configuration import utility,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 +from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates from leahi_dialin.utils import conversions td =TD_Messaging() can_interface = td.can_interface rinsebackrequest = None -request ="[1] Request is not allowed in the current operating mode" +# request ="[1] Request is not allowed in the current operating mode" -def change_treatmentstates(state): +def change_treatmentstates(state,substate): test.startSection("Change the treatment parameter") td.td_tx_state( state, 0 , 0 , 0 , 0 , - TXStates.RINSEBACK_RUN_STATE , + substate, 0 , 0 , 0 , @@ -43,19 +67,11 @@ state,index = conversions.bytearray_to_integer( message, index) global rinsebackrequest rinsebackrequest = state - -def main(): - utils.tstStart(__file__) - startApplication(config.AUT_NAME) - if can_interface is not None: - channel_id = CAN.DenaliChannels.ui_to_td_ch_id - message_id = MsgIds.MSG_ID_UI_RINSEBACK_CMD_REQUEST.value - can_interface.register_receiving_publication_function(channel_id, - message_id, - handle_rinseback_request) - test.startSection("Verify the rinseback page") + +def verify_pressure_value(): + test.startSection("Verify the pressure container values") td.td_operation_mode(TDOpModes.MODE_STAN.value) - change_treatmentstates(TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value) + change_treatmentstates(TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value,TXStates.RINSEBACK_RUN_STATE) td.td_pressure(H2_arterial_pressure = -151, H14_venous_pressure = -12, limit_state = 0, @@ -68,19 +84,24 @@ tmp_pressure = -100 , tmp_min = -500 , tmp_max = -50) - value = waitForObject(names.o_EndTreatmentRinseback_arterialRangeBar_TreatmentPressureComponent,3000) - arterial_rangeBar = utility.get_object_from_names(value, error_message="arterial rangeBar object is missing") + arterial = waitForObject(names.o_EndTreatmentRinseback_arterialRangeBar_TreatmentPressureComponent,3000) + arterial_rangeBar = utility.get_object_from_names(arterial, error_message="arterial rangeBar object is missing") arterial_low = arterial_rangeBar.lowerBound arterial_high = arterial_rangeBar.upperBound - arterial_element = waitForObject(names.o_EndTreatmentRinseback_arterialRangeBar_TreatmentPressureComponent) - arterial_value = utility.findObjectById(arterial_element, "_value") - test.log(str(arterial_value)) - venous_rangeBar = utility.get_object_from_names(names.o_EndTreatmentRinseback_venousRangeBar_TreatmentPressureComponent, error_message="venous rangeBar object is missing") + arterial_value = utility.findObjectById(arterial, "_value") + venous = waitForObject(names.o_EndTreatmentRinseback_venousRangeBar_TreatmentPressureComponent) + venous_rangeBar = utility.get_object_from_names(venous, error_message="venous rangeBar object is missing") venous_low = venous_rangeBar.lowerBound venous_high = venous_rangeBar.upperBound - tmp_RangeBar = utility.get_object_from_names(names.o_EndTreatmentRinseback_tmpRangeBar_TreatmentPressureComponent, error_message="trancememberance rangeBar object is missing") + venous_value = utility.findObjectById(venous, "_value") + tmp = waitForObject(names.o_EndTreatmentRinseback_tmpRangeBar_TreatmentPressureComponent) + tmp_RangeBar = utility.get_object_from_names(tmp, error_message="trancememberance rangeBar object is missing") trancememberance_low = tmp_RangeBar.lowerBound trancememberance_high = tmp_RangeBar.upperBound + tmp_value = utility.findObjectById(tmp, "_value") + test.compare(str(arterial_value.text),str(-151), "Arterial value should be '{}'".format(arterial_value.text)) + test.compare(str(venous_value.text),str(-12), "Venous value should be '{}'".format(venous_value.text)) + test.compare(str(tmp_value.text),str(-100), "Trancememberance value should be '{}'".format(tmp_value.text)) test.compare(arterial_low, -390, "Arterial low value should be '{}'".format(arterial_low)) @@ -91,14 +112,17 @@ "Venous low value should be '{}'".format(venous_low)) test.compare(venous_high, 410, - "Venous high value should not be '{}'".format(venous_high)) + "Venous high value should be '{}'".format(venous_high)) test.compare(trancememberance_low, -500, "Trancememberance low value should be '{}'".format(trancememberance_low)) test.compare(trancememberance_high, -50, - "Trancememberance high value should not be '{}'".format(trancememberance_high)) + "Trancememberance high value should be '{}'".format(trancememberance_high)) + test.endSection() +def verify_flow_values_rinseback(): + test.startSection("Verify the Flow Rate values") td.td_rinseback_progress( vTargetVolume = 32, vDeliveredVolume = 13, vFlowRate = 150, @@ -107,36 +131,30 @@ vIsCompleted = 0) delivered_volume = waitForObject(names.o_EndTreatmentRinseback_deliveredVolumeText_Text) delivered_volume_text = delivered_volume.text - test.log(str(delivered_volume_text)) + test.compare(str(delivered_volume_text),str("13 mL"),"Delivered Volume value should be '{}'".format(delivered_volume_text)) flow_rate = waitForObject(names.o_EndTreatmentRinseback_flowRateValue_Text) flow_rate_text =flow_rate.text - test.log(str(flow_rate_text)) + test.compare(str(flow_rate_text),str("150"),"Flow rate value should be '{}'".format(delivered_volume_text)) + test.endSection() + +def verify_pause_rinseback(): + test.startSection("Verify the Pause rinseback state") mouseClick(waitForObject(names.o_EndTreatmentRinseback_pauseResumeButton_TouchRect, 2000)) - # handle_solution_infusion_request(MsgIds.MSG_ID_UI_RINSEBACK_CMD_REQUEST.value) - global rinsebackrequest - test.log(str(rinsebackrequest)) - test.verify(waitFor( lambda: rinsebackrequest == 3, 5000), "Testing FW received Arterial Window Value") - #test rejection + test.verify(waitFor( lambda: rinsebackrequest == 3, 3000), "Testing FW received Pause Rinseback request") td.td_rinseback_cmd_response(vRejectionReason = 1) - rejectionReason = waitForObject(utility.setObjectText(text=request ,obj =names.o_EndTreatmentRinseback_NotificationBar_NotificationBarSmall)) - test.compare(rejectionReason.text, "[1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str(rejectionReason.text)) + rejectionReason = waitForObject(utility.setObjectText(text=config.REQUEST,obj =names.o_EndTreatmentRinseback_NotificationBar_NotificationBarSmall)) + test.compare(rejectionReason.text,config.REQUEST, "Rejection Reason text should be :" + str(rejectionReason.text)) td.td_rinseback_cmd_response(vRejectionReason = 0) - td.td_tx_state( TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value, - 0 , - 0 , - 0 , - 0 , - TXStates.RINSEBACK_PAUSED_STATE , - 0 , - 0 , - 0 , - 0) + change_treatmentstates( TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value, + TXStates.RINSEBACK_PAUSED_STATE) + progressbar_color = waitForObject(names.o_EndTreatmentRinseback_targetVolumeProgress_ProgressCircle).color.name + test.compare(progressbar_color, "#9b864e", "Progress bar should be'{}'".format(progressbar_color)) + rinseback = waitForObject(utility.setObjectText(text=config.RINSEBACK_PAUSED ,obj =names.o_EndTreatmentRinseback)) + test.compare(rinseback.text, config.RINSEBACK_PAUSED, "Rinseback paused text should be'{}'".format(rinseback.text)) + test.endSection() - - color = waitForObject(names.o_EndTreatmentRinseback_targetVolumeProgress_ProgressCircle).color.name - test.log(str(color)) - rinseback = waitForObject(utility.setObjectText(text="Rinseback Paused" ,obj =names.o_EndTreatmentRinseback)) - test.log(str(rinseback.text)) +def verify_resume_rinseback(): + test.startSection("Verify the resume rinseback state") td.td_rinseback_progress( vTargetVolume = 32, vDeliveredVolume = 13, vFlowRate = 150, @@ -146,39 +164,39 @@ timeouttext = waitForObject(names.o_EndTreatmentRinseback_timeout_TimeText, 2000) test.log(str(timeouttext.time)) mouseClick(waitForObject(names.o_EndTreatmentRinseback_pauseResumeButton_TouchRect, 2000)) - test.log(str(rinsebackrequest)) - test.verify(waitFor( lambda: rinsebackrequest == 4, 5000), "Testing FW received Arterial Window Value") - td.td_tx_state( TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value, - 0 , - 0 , - 0 , - 0 , - TXStates.RINSEBACK_RUN_STATE , - 0 , - 0 , - 0 , - 0) + test.verify(waitFor( lambda: rinsebackrequest == 4, 3000), "Testing FW received Arterial Window Value") + change_treatmentstates( TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value, + TXStates.RINSEBACK_RUN_STATE) + test.endSection() +def main(): + utils.tstStart(__file__) + startApplication(config.AUT_NAME) + global rinsebackrequest + if can_interface is not None: + channel_id = CAN.DenaliChannels.ui_to_td_ch_id + message_id = MsgIds.MSG_ID_UI_RINSEBACK_CMD_REQUEST.value + can_interface.register_receiving_publication_function(channel_id, + message_id, + handle_rinseback_request) + + verify_pressure_value() + verify_flow_values_rinseback() + verify_pause_rinseback() + verify_resume_rinseback + #Increment and decremenet Rinseback - incrementButton = waitForObject(names.o_EndTreatmentRinseback_incrementFlowRateButton_ArrowButton) + incrementButton = waitForObject(names.o_EndTreatmentRinseback_incrementFlowRateButton_ArrowButton,1000) mouseClick(incrementButton) - #Verify FW receives request with correct opmode - decrementButton =waitForObject(names.o_EndTreatmentRinseback_decrementFlowRateButton_ArrowButton) + test.verify(waitFor( lambda: rinsebackrequest == 1, 3000), "Testing FW received Arterial Window Value") + decrementButton =waitForObject(names.o_EndTreatmentRinseback_decrementFlowRateButton_ArrowButton,1000) mouseClick(decrementButton) - #End Rinseback - endRinseback = waitForObject(names.o_EndTreatmentRinseback_endButton_TouchRect) + test.verify(waitFor( lambda: rinsebackrequest == 2, 3000), "Testing FW received Arterial Window Value") + endRinseback = waitForObject(names.o_EndTreatmentRinseback_endButton_TouchRect,2000) mouseClick(endRinseback) - # verify fw gets request with correct opmode - td.td_tx_state( TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value, - 0 , - 0 , - 0 , - 0 , - TXStates.RINSEBACK_STOP_STATE , - 0 , - 0 , - 0 , - 0) + test.verify(waitFor( lambda: rinsebackrequest == 5, 3000), "Testing FW received Arterial Window Value") + change_treatmentstates( TDTreatmentStates.TREATMENT_RINSEBACK_STATE.value, + TXStates.RINSEBACK_STOP_STATE) test.verify(waitForObjectExists(names.o_EndTreatmentRinsebackComplete_instructionView_InstructionView), "In Rinseback complete page")