# -*- coding: utf-8 -*-" ## # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_post_treatment_disconnection # date 2022/06/06 # author Amol Shinde # author Shweta POlicepatil # author Amrita Debnath # author Ajina S M # NOTE: # This test contradicts verification of post treatment section. import names from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator from configuration import config from configuration import utility from dialin.common.hd_defs import TreatmentStates, TreatmentEndStates hd_simulator = HDSimulator() def verify_end_treatment_complete_state(): """ Method to verify End treatment Treatment Complete state screens """ test.startSection("Verifying End treatment Treatment Complete state screens") hd_simulator.cmd_set_treatment_states_data(sub_mode= TreatmentStates.TREATMENT_END_STATE.value , uf_state = TreatmentStates.TREATMENT_START_STATE.value, saline_state = TreatmentStates.TREATMENT_START_STATE.value, heparin_state = TreatmentStates.TREATMENT_START_STATE.value,rinseback_state= TreatmentStates.TREATMENT_START_STATE.value, recirculate_state = TreatmentStates.TREATMENT_START_STATE.value, blood_prime_state = TreatmentStates.TREATMENT_START_STATE.value,treatment_end_state = TreatmentStates.TREATMENT_START_STATE.value, treatment_stop_state = TreatmentStates.TREATMENT_START_STATE.value, dialysis_state = TreatmentStates.TREATMENT_START_STATE.value) test.compare(str(waitForObject(names.o_end_treatment_complete_state).text),config.END_TREATMENT_COMPLETE_STATE_TEXT, "Treatment text must be {}".format(config.END_TREATMENT_COMPLETE_STATE_TEXT)) test.compare(str(waitForObjectExists(names.o_start_rinseback_button_text).text), config.RINSEBACK_BUTTON_TEXT, "Rinseback button text must be {}".format(config.RINSEBACK_BUTTON_TEXT)) test.verify(waitForObjectExists(names.o_start_rinseback_button_text).enabled, " Start Rinseback button must be active") mouseClick(waitForObject(names.o_EndTreatmentBase_start_rineback_button_TouchRect)) verify_end_treatment_states_rejection_msg() test.endSection() def verify_end_treatment_paused_state(): """ Method to verify End treatment Treatment Paused state screens """ test.startSection("Verifying End treatment Treatment Paused state screens") hd_simulator.cmd_set_treatment_states_data(sub_mode=TreatmentStates.TREATMENT_END_STATE.value, uf_state=TreatmentStates.TREATMENT_START_STATE.value, saline_state=TreatmentStates.TREATMENT_START_STATE.value, heparin_state=TreatmentStates.TREATMENT_START_STATE.value, rinseback_state=TreatmentStates.TREATMENT_START_STATE.value, recirculate_state=TreatmentStates.TREATMENT_START_STATE.value, blood_prime_state=TreatmentStates.TREATMENT_START_STATE.value, treatment_end_state=TreatmentEndStates.TREATMENT_END_PAUSED_STATE.value, treatment_stop_state=TreatmentStates.TREATMENT_START_STATE.value, dialysis_state=TreatmentStates.TREATMENT_START_STATE.value) test.compare(str(waitForObject(names.o_end_treatment_complete_paused_state).text), config.END_TREATMENT_COMPLETE_PAUSED_STATE_TEXT, "Treatment text must be {}".format(config.END_TREATMENT_COMPLETE_PAUSED_STATE_TEXT)) test.endSection() def verify_end_treatment_states_rejection_msg(): """ Method to verify end treatment rejection messages """ test.startSection("Verifying rejection messages in end treatment screens ") for reason_id in range(1, config.NUM_OF_REQUEST_REJECT_REASONS + 1): hd_simulator.cmd_send_treatment_adjust_end_response(accepted=0, reason=reason_id) rejection_message = waitForObjectExists(utility.end_treatment_states_rejection_msg(text=config.REJECTION_REASON[reason_id])) test.compare(rejection_message.text, config.REJECTION_REASON[reason_id], "expected rejection {msg} displayed".format(msg=config.REJECTION_REASON[reason_id])) test.endSection() def main(): utils.tstStart(__file__) startApplication(config.AUT_NAME) verify_end_treatment_complete_state() verify_end_treatment_paused_state() utils.tstDone()