Index: tst_recirculate/test.py =================================================================== diff -u -ra49e29aede763022e99a44f48857e20351ff127b -r6c88a2beef01f7961d99b85bdf227c2d4ab79228 --- tst_recirculate/test.py (.../test.py) (revision a49e29aede763022e99a44f48857e20351ff127b) +++ tst_recirculate/test.py (.../test.py) (revision 6c88a2beef01f7961d99b85bdf227c2d4ab79228) @@ -17,19 +17,18 @@ # This test contradicts verification of post treatment section. import names -import builtins 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, TreatmentRinsebackStates, TreatmentRecircStates hd_simulator = HDSimulator() -SCREEN_OBJ1 = names.o_EndTreatmentRecirculateStack_EndTreatmentBase_EndTreatmentBase +SCREEN_OBJ = names.o_EndTreatmentRecirculateStack_EndTreatmentBase_EndTreatmentBase -count_down_value = 121 #change it to capitals -timer_default_value = 1 -num_of_instructions = 3 +COUNT_DOWN_VALUE = 121 +TIMER_DEFAULT_VALUE = 1 +NUM_OF_INSTRUCTION = 3 def verification_of_recirculate_recirculate_state(): """ @@ -41,21 +40,21 @@ rinseback_state= TreatmentStates.TREATMENT_START_STATE.value, recirculate_state = TreatmentRecircStates.TREATMENT_RECIRC_RECIRC_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.startSection("Verifying Timer count down timer") - for num in range(timer_default_value,count_down_value): - hd_simulator.cmd_send_treatment_recirculate_data(timeout_total = num, timeout_count_down = num) + test.startSection("Verifying Timer count down timer " + config.RECIRCULATE_TEXT) + for num in range(TIMER_DEFAULT_VALUE, COUNT_DOWN_VALUE): + hd_simulator.cmd_send_treatment_recirculate_data(timeout_total=num, timeout_count_down=num) min = utility.convert_seconds_into_min_and_sec(num, time_format="%M") sec = utility.convert_seconds_into_min_and_sec(num, time_format="%S") - test.compare(str(waitForObject(names.o_EndTreatmentBase_TimeText_minute_Text).text),str(sec),"Verifying seconds appearing on UI")# log need to be changed - test.compare(str(waitForObject(names.o_EndTreatmentBase_TimeText_hour_Text).text),str(min),"Verifying minutes appearing on UI") + test.compare(str(waitForObject(names.o_EndTreatmentBase_TimeText_minute_Text).text), str(sec),"Verifying seconds on Timer in " + config.RECIRCULATE_TEXT) + test.compare(str(waitForObject(names.o_EndTreatmentBase_TimeText_hour_Text).text), str(min),"Verifying minutes on Timer in " + config.RECIRCULATE_TEXT) test.endSection() - test.compare(str(waitForObject(names.o_recirculate_text).text),config.RECIRCULATE_TEXT, "Recirculate text must be {}".format(config.RECIRCULATE_TEXT)) + test.compare(str(waitForObject(names.o_recirculate_text).text), config.RECIRCULATE_TEXT, "Recirculate text must be {}".format(config.RECIRCULATE_TEXT)) test.compare(str(waitForObjectExists(names.o_EndTreatmentBase_RECONNECT_Text).text), config.RECONNECT_BUTTON_TEXT, "Reconnect button text must be {}".format(config.RECONNECT_BUTTON_TEXT)) test.verify(waitForObjectExists(names.o_EndTreatmentBase_RECONNECT_Text).enabled, "Reconnect button must be active") mouseClick(waitForObject(names.o_EndTreatmentBase_RECONNECT_Text)) - verify_right_instruction_in_recirculate_state(num_of_instructions) - verify_left_instruction_in_recirculate_state(num_of_instructions) - verify_right_instruction_in_recirculate_state(num_of_instructions) + verify_right_instruction_in_recirculate_state(NUM_OF_INSTRUCTION) + verify_left_instruction_in_recirculate_state(NUM_OF_INSTRUCTION) + verify_right_instruction_in_recirculate_state(NUM_OF_INSTRUCTION) verify_rejection_messages_for_recirculate() test.endSection() @@ -64,34 +63,34 @@ Method to verify Treatment Recirculate stopped state screens """ test.startSection("verifying Treatment Recirculate stopped state screens") - hd_simulator.cmd_set_treatment_states_data(sub_mode = TreatmentStates.TREATMENT_RECIRC_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= TreatmentRinsebackStates.RINSEBACK_STOP_INIT_STATE.value, recirculate_state = TreatmentRecircStates.TREATMENT_RECIRC_STOPPED_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.startSection("Verifying Timer count down timer") - for num in range(timer_default_value,count_down_value): - hd_simulator.cmd_send_treatment_recirculate_data(timeout_total = num, timeout_count_down = num) + hd_simulator.cmd_set_treatment_states_data(sub_mode=TreatmentStates.TREATMENT_RECIRC_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=TreatmentRinsebackStates.RINSEBACK_STOP_INIT_STATE.value, recirculate_state=TreatmentRecircStates.TREATMENT_RECIRC_STOPPED_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.startSection("Verifying Timer count down timer on Recirculate Stopped state") + for num in range(TIMER_DEFAULT_VALUE, COUNT_DOWN_VALUE): + hd_simulator.cmd_send_treatment_recirculate_data(timeout_total=num, timeout_count_down=num) min = utility.convert_seconds_into_min_and_sec(num, time_format="%M") sec = utility.convert_seconds_into_min_and_sec(num, time_format="%S") - test.compare(str(waitForObject(names.o_EndTreatmentBase_TimeText_minute_Text).text),str(sec),"Verifying seconds appearing on UI")#og need to be changed - test.compare(str(waitForObject(names.o_EndTreatmentBase_TimeText_hour_Text).text),str(min),"Verifying minutes appearing on UI") + test.compare(str(waitForObject(names.o_EndTreatmentBase_TimeText_minute_Text).text), str(sec),"Verifying seconds on Timer in recirculate stopped state") + test.compare(str(waitForObject(names.o_EndTreatmentBase_TimeText_hour_Text).text), str(min),"Verifying minutes on Timer in recirculate stopped state") test.endSection() - test.compare(str(waitForObject(names.o_EndTreatmentBase_Reconnect_Text).text),config.RECONNECT_TEXT, "Reconnect text must be {}".format(config.RECONNECT_TEXT)) + test.compare(str(waitForObject(names.o_EndTreatmentBase_Reconnect_Text).text), config.RECONNECT_TEXT, "Reconnect text must be {}".format(config.RECONNECT_TEXT)) verify_rejection_messages_for_recirculate() test.endSection() -def verify_right_instruction_in_recirculate_state(num_of_instructions): +def verify_right_instruction_in_recirculate_state(NUM_OF_INSTRUCTION): """. Method to verify right arrow functionality @param num_of_instructions - (int) count the number of instructions """ test.startSection("verifying right arrow functionality for recirculate state Screen") utility.verify_missing_object(names.o_EndTreatmentBase_leftImage_Image) - for indicator in range(1, num_of_instructions, 1): - utility.verify_bullet_navigation(indicator, num_of_instructions, SCREEN_OBJ1) - if indicator != num_of_instructions: + for indicator in range(1, NUM_OF_INSTRUCTION, 1): + utility.verify_bullet_navigation(indicator, NUM_OF_INSTRUCTION, SCREEN_OBJ) + if indicator != NUM_OF_INSTRUCTION: mouseClick(waitForObject(names.o_EndTreatmentBase_rightImage_Image)) test.compare(str(waitForObjectExists(names.o_recirculate_text).text), config.RECIRCULATE_TEXT, "Recirculate text must be {}".format(config.RECIRCULATE_TEXT)) utility.verify_missing_object(names.o_EndTreatmentBase_rightImage_Image) @@ -104,8 +103,8 @@ """ test.startSection("verifying left arrow functionality for recirculate state screens") utility.verify_missing_object(names.o_EndTreatmentBase_rightImage_Image) - for indicator in range(num_of_instructions, 0, -1): - utility.verify_bullet_navigation(indicator, num_of_instructions, SCREEN_OBJ1) + for indicator in range(NUM_OF_INSTRUCTION, 0, -1): + utility.verify_bullet_navigation(indicator, NUM_OF_INSTRUCTION, SCREEN_OBJ) if indicator != 1: mouseClick(waitForObject(names.o_EndTreatmentBase_leftImage_Image)) test.compare(str(waitForObjectExists(names.o_recirculate_text).text), config.RECIRCULATE_TEXT, "Recirculate text must be {}".format(config.RECIRCULATE_TEXT))