Index: suite_leahi/tst_recirculate/test.py =================================================================== diff -u -r834a1140f64954a507508ac12ab2b77f9c1c4880 -r1d0e60a5615bf3ee78da8ff25c7c15a78a2049a3 --- suite_leahi/tst_recirculate/test.py (.../test.py) (revision 834a1140f64954a507508ac12ab2b77f9c1c4880) +++ suite_leahi/tst_recirculate/test.py (.../test.py) (revision 1d0e60a5615bf3ee78da8ff25c7c15a78a2049a3) @@ -12,13 +12,15 @@ import names -from configuration import config, utility -from leahi_dialin.ui import utils -from leahi_dialin.ui.td_messaging import TD_Messaging -from leahi_dialin.common.td_defs import TDOpModes, TDTreatmentStates, TDTreaRecircStates -from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions -from leahi_dialin.protocols import CAN -from leahi_dialin.utils import conversions +import re +from configuration import config, utility, navigation, application_init +from leahi_dialin.ui import utils +from leahi_dialin.ui.td_messaging import TD_Messaging +from leahi_dialin.common.td_defs import TDOpModes, TDTreatmentStates, TDTreaRecircStates +from leahi_dialin.common.msg_defs import MsgIds, MsgFieldPositions +from leahi_dialin.protocols import CAN +from leahi_dialin.utils import conversions +from configuration.getrejectiontext import ScopedRejectionRepository td_simulator = TD_Messaging() can_interface = td_simulator.can_interface @@ -58,56 +60,59 @@ f"Testing FW received {log_message}", ) - -def verify_recirculation_rejection(): + # REJECT_TEXT = repo.get("1", "Title") + # auto_load_reject_notification = utility.findChildByText( + # pre_treatment, "[1] "+REJECT_TEXT + # ) +def verify_recirculation_rejection(REJECT_TEXT): """Comparison of Rejection Reason""" td_simulator.td_recirculate_cmd_response(0, 1) rejectionReason = waitForObject( utility.setObjectText( - text=config.REJECTION_REASON, obj=names.o_EndTreatmentBase_NotificationBar_NotificationBarSmall, + text="[1] "+REJECT_TEXT, ) ) test.compare( rejectionReason.text, - config.REJECTION_REASON, + "[1] "+REJECT_TEXT, "Rejection Reason text should be :" + str(rejectionReason.text), ) -def verify_recirculation_in_progress_screen_rejection(): +def verify_recirculation_in_progress_screen_rejection(REJECT_TEXT): """Comparison of Rejection Reason""" td_simulator.td_recirculate_cmd_response(0, 1) rejectionReason = waitForObject( utility.setObjectText( - text=config.REJECTION_REASON, + text="[1] "+REJECT_TEXT, obj=names.o_Recirculate_InProgress_Screen_NotificationBar, ) ) test.compare( rejectionReason.text, - config.REJECTION_REASON, + "[1] "+REJECT_TEXT, "Rejection Reason text should be :" + str(rejectionReason.text), ) -def verify_reconnect_to_patient_screen_rejection(): +def verify_reconnect_to_patient_screen_rejection(REJECT_TEXT): """Comparison of Rejection Reason""" td_simulator.td_recirculate_cmd_response(0, 1) rejectionReason = waitForObject( utility.setObjectText( - text=config.REJECTION_REASON, + text="[1] "+REJECT_TEXT, obj=names.o_EndTreatmentBase_NotificationBar_NotificationBarSmall_2, ) ) test.compare( rejectionReason.text, - config.REJECTION_REASON, + "[1] "+REJECT_TEXT, "Rejection Reason text should be :" + str(rejectionReason.text), ) -def recirculate_set_up_screen(): +def recirculate_set_up_screen(REJECT_TEXT): test.startSection("Verify Recirculate Set Up Screen") td_simulator.td_tx_state( TDTreatmentStates.TREATMENT_RECIRC_STATE.value, @@ -127,18 +132,18 @@ click_and_verify_fw_request( names.o_EndTreatmentBase_ButtonEndTreatment, 3, "End Treatment Button Value" ) - verify_recirculation_rejection() + verify_recirculation_rejection(REJECT_TEXT) click_and_verify_fw_request( names.o_EndTreatmentBase_ButtonStartRecirculate, 4, "Start Recirculation Button Value", ) - verify_recirculation_rejection() + verify_recirculation_rejection(REJECT_TEXT) test.endSection() -def recirculate_in_progress_screen(): +def recirculate_in_progress_screen(REJECT_TEXT): test.startSection("Verify Recirculate In Progress Screen") td_simulator.td_tx_state( TDTreatmentStates.TREATMENT_RECIRC_STATE.value, @@ -184,16 +189,16 @@ 3, "End Treatment Button Value", ) - verify_recirculation_in_progress_screen_rejection() + verify_recirculation_in_progress_screen_rejection(REJECT_TEXT) click_and_verify_fw_request( names.o_EndTreatmentBase_ButtonResume, 0, "Resume Button Value" ) - verify_recirculation_in_progress_screen_rejection() + verify_recirculation_in_progress_screen_rejection(REJECT_TEXT) test.endSection() -def reconnect_to_patient_screen(): +def reconnect_to_patient_screen(REJECT_TEXT): test.startSection("Verify Reconnect To Patient Screen") td_simulator.td_tx_state( TDTreatmentStates.TREATMENT_RECIRC_STATE.value, @@ -213,14 +218,14 @@ click_and_verify_fw_request( names.o_EndTreatmentBase_ButtonEndTreatment_2, 3, "End Treatment Button Value" ) - verify_reconnect_to_patient_screen_rejection() + verify_reconnect_to_patient_screen_rejection(REJECT_TEXT) click_and_verify_fw_request( names.o_EndTreatmentBase_ButtonResume_2, 1, "Start Resume Treatment Button Value", ) - verify_reconnect_to_patient_screen_rejection() + verify_reconnect_to_patient_screen_rejection(REJECT_TEXT) test.endSection() @@ -238,12 +243,16 @@ channel_id, message_id, handle_recirculate_request ) + conf_path = "/home/denali/Public/luis/config/configurations/Alarms/Rejections.conf" + repo = ScopedRejectionRepository(path=conf_path) + REJECT_TEXT = repo.get("1", "Title") + startApplication(utility.aut("-q")) td_simulator.td_operation_mode(TDOpModes.MODE_TREA.value, 0) td_simulator.td_tx_state( TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value, 0, 0, 0, 0, 0, 0, 0, 0, 0 ) - recirculate_set_up_screen() - recirculate_in_progress_screen() - reconnect_to_patient_screen() + recirculate_set_up_screen(REJECT_TEXT) + recirculate_in_progress_screen(REJECT_TEXT) + reconnect_to_patient_screen(REJECT_TEXT) utils.tstDone()