Index: tst_pre_treatment_patient_connection/test.py =================================================================== diff -u -r98f13c9198e630726f86fa3288e452554d3b2cf5 -r7882eef58dfd3755ab3a6f2709a6e81f8662a0a2 --- tst_pre_treatment_patient_connection/test.py (.../test.py) (revision 98f13c9198e630726f86fa3288e452554d3b2cf5) +++ tst_pre_treatment_patient_connection/test.py (.../test.py) (revision 7882eef58dfd3755ab3a6f2709a6e81f8662a0a2) @@ -46,40 +46,149 @@ "Heart Rate": [181, 200, 39, 20]} PRE_TREATMENT_PATIENT_CONNECTION_MODE = 8 -PRE_TREATMENT_STEPS = 5 +UF_PRE_TREATMENT_STEPS = 5 +BP_HR_PRE_TREATMENT_STEPS = 6 - TREATMENT_ULTRAFILTERATION_TESTING_OPTION = { "OPTION_1" : {"uf_maximum" : 800, "uf_minimum" : 0}, "OPTION_2" : {"uf_maximum" : 500, "uf_minimum" : 0}, "OPTION_3" : {"uf_maximum" : 550, "uf_minimum" : 0}, "OPTION_4" : {"uf_maximum" : 300, "uf_minimum" : 0}, "OPTION_5" : {"uf_maximum" : 280, "uf_minimum" : 0}, - "OPTION_6" : {"uf_maximum" : 765, "uf_minimum" : 500}, - "OPTION_7" : {"uf_maximum" : 680, "uf_minimum" : 450}, - "OPTION_8" : {"uf_maximum" : 480, "uf_minimum" : 380}, - "OPTION_9" : {"uf_maximum" : 390, "uf_minimum" : 100}, - "OPTION_10" : {"uf_maximum" : 800, "uf_minimum" : 0}, - + "OPTION_6" : {"uf_maximum" : 765, "uf_minimum" : 0}, + "OPTION_7" : {"uf_maximum" : 680, "uf_minimum" : 0}, + "OPTION_8" : {"uf_maximum" : 1500, "uf_minimum" : 0}, + "OPTION_9" : {"uf_maximum" : 390, "uf_minimum" : 0}, + "OPTION_10" : {"uf_maximum" : 800, "uf_minimum" : 0} } + + + def test_rejection_message_patient_connection(accept_status): """ verification of rejection messages during patient connection. @param accept_status: (int) boolean accept/reject response - @param target: (int) saline bolus Target volume - @param saline_states: (int) saline bolus transition State @return: none """ test.startSection("verification of rejection messages on saline bolus") for rejection in range(1, config.NUM_OF_REQUEST_REJECT_REASONS): hd_simulator.cmd_send_uf_treatment_response(accepted = accept_status, reason = rejection, volume = config.UF_VALID_RANGE) - rejection_message = findObject(names.o_treatment_notification_bar) + rejection_message = waitForObject(names.o_PreTreatmentUltrafiltration_NotificationBar_NotificationBar) test.compare(rejection_message.text, config.REJECTION_REASON[rejection], "expected rejection {msg} displayed".format(msg=config.REJECTION_REASON[rejection])) test.endSection() + +def verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val, dia_val, heart_rate, save): + """ + method to enter systolic, diastolic and heart rate value and save or unsave it and verify + same is updated in pre-treatment screen. + @param sys_val - (int) user expected systolic pressure + @param dia_val - (int) user expected diastolic pressure + @param heart_rate - (int) user expected heart rate + @param save - (bool) True/False + """ + test.startSection("Verify the entered systolic, diastolic and heart rate value updated in main-treatement screen") + mouseClick(waitForObject(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry)) + erase_entered_value(waitForObject(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry)) + type(waitForObject(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry), sys_val) + test.compare(str(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry).enabled, True, "Tutorial text should be enabled.")) + test.compare(str(waitForObjectExists(names.o_swipeview_tutorial_text).text, config.TUTORIAL_TEXT[screen_indicator], "Tutorial text should be {msg}".format(msg=config.TUTORIAL_TEXT[screen_indicator]))) + + + + verify_entered_value_in_pop_up(value=str(sys_val), input_field=systolic, + vital=SYSTOLIC_TEXT) + verify_color_of_entry(entry=sys_val, vital_parameter=SYSTOLIC_TEXT, + input_field=systolic) + diastolic = waitForObject(names.o_pop_up_diastolic_input_field) + mouseClick(diastolic) + erase_entered_value(diastolic) + enter_keypad_value(str(dia_val)) + verify_entered_value_in_pop_up(value=str(dia_val), input_field=diastolic, + vital=DIASTOLIC_TEXT) + verify_color_of_entry(entry=dia_val, vital_parameter=DIASTOLIC_TEXT, + input_field=diastolic) + hr = waitForObject(names.o_pop_up_heart_rate_input_field) + mouseClick(hr) + erase_entered_value(hr) + enter_keypad_value(str(heart_rate)) + verify_entered_value_in_pop_up(value=str(heart_rate), input_field=hr, + vital=HEART_RATE_TITLE) + verify_color_of_entry(entry=heart_rate, vital_parameter=HEART_RATE_TITLE, + input_field=hr) + + if save: + test.log("Clicking confirm button") + confirm_button = waitForObjectExists(names.o_vitals_confrim_btn) + test.compare(confirm_button.enabled, True, "Valid Blood Pressure and Heart is entered therefore confirm button is enabled") + saved_time = get_current_date_and_time() + mouseClick(confirm_button) + verify_last_read_time(saved_time) + elif save is False: + mouseClick(waitForObject(names.o_vitals_close_btn)) + test.log("'Vitals pop is closed") + + expected_blood_pressure = "{sys} / {dia}".format(sys=sys_val, dia=dia_val) + verify_entered_value_in_main_treatment_screen(value=expected_blood_pressure, + vital=BLOOD_PRESSURE_TITLE, save=save) + verify_entered_value_in_main_treatment_screen(value=heart_rate, vital=HEART_RATE_TITLE, save=save) + test.endSection() + + +def verify_color_of_entry(entry, vital_parameter, input_field): + """ + Method to verify the color of entry + of systolic, diastolic and heart rate + @param entry: (int) user user entered value + @param vital_parameter - (str) parameter name under which user is entering value (sys/dia/heart rate) + @param input_field - (obj) object of input field + """ + test.startSection("Verify the color of {} value {}".format(vital_parameter, entry)) + input_field_color = input_field.color.name + entry = builtins.int(entry) + if vital_parameter is SYSTOLIC_TEXT: + if (entry < SYSTOLIC_LOWER_LIMIT) or (entry > SYSTOLIC_UPPER_LIMIT): + test.compare(input_field_color, OUT_OF_RANGE_COLOR, "systolic value {} is out of range, systolic value should be in range of {} and {}".format(entry, SYSTOLIC_LOWER_LIMIT, SYSTOLIC_UPPER_LIMIT)) + elif (entry >= SYSTOLIC_LOWER_LIMIT) and (entry <= SYSTOLIC_UPPER_LIMIT): + test.compare(input_field_color, IN_RANGE_COLOR, "systolic value {} is in range of {} and {}".format(entry, SYSTOLIC_LOWER_LIMIT, SYSTOLIC_UPPER_LIMIT)) + elif vital_parameter is DIASTOLIC_TEXT: + if (entry < DIASTOLIC_LOWER_LIMIT) or (entry > DIASTOLIC_UPPER_LIMIT): + test.compare(input_field_color, OUT_OF_RANGE_COLOR, "diastolic value {} is out of range, diastolic value should be in range of {} and {}".format(entry, DIASTOLIC_LOWER_LIMIT, DIASTOLIC_UPPER_LIMIT)) + elif (entry >= DIASTOLIC_LOWER_LIMIT) and (entry <= DIASTOLIC_UPPER_LIMIT): + test.compare(input_field_color, IN_RANGE_COLOR, "diastolic value {} is in range of {} and {}".format(entry, DIASTOLIC_LOWER_LIMIT, DIASTOLIC_UPPER_LIMIT)) + elif vital_parameter is HEART_RATE_TITLE: + if (entry < HEART_RATE_LOWER_LIMIT) or (entry > HEART_RATE_UPPER_LIMIT): + test.compare(input_field_color, OUT_OF_RANGE_COLOR, "Heart Rate value {} is out of range, Heart Rate value should be in range of {} and {}".format(entry, HEART_RATE_LOWER_LIMIT, HEART_RATE_UPPER_LIMIT)) + elif (entry >= HEART_RATE_LOWER_LIMIT) and (entry <= HEART_RATE_UPPER_LIMIT): + test.compare(input_field_color,IN_RANGE_COLOR, "Heart Rate value {} is in range of {} and {}".format(entry, HEART_RATE_LOWER_LIMIT, HEART_RATE_UPPER_LIMIT)) + test.endSection() + + +def verify_entered_value_in_main_treatment_screen(value, vital, save): + """ + method to verify the user entered value in main-treatment screen + @param value: (int) user user entered value + @param vital - (str) parameter name under which user is entering value (sys/dia/heart rate) + @param input_field - (obj) object of input field + @return N/A + """ + test.startSection("Verify the user entered {} value {} in main-treatment screen".format(vital, value)) + if save: + input_field = waitForObject(vitals_reading_obj(value)) + entered_value = input_field.text + value = str(value) + test.compare(str(entered_value), value, + "Expected {} value: {} should be equal to Actual {} value: {}".format(vital, value, vital, entered_value)) + elif (save is False): + if object.exists(vitals_reading_obj(value)) is False: + test.log("Entered is not saved and is not updated in main-treatment screen") + + test.endSection() + + def test_patient_connection_instruction_screen(screen_indicator): for instruction_screen in (screen_indicator): @@ -158,9 +267,11 @@ drag_and_drop_ultrafilteration_slider(uf_value, max_uf) test.compare(utils.l2ml(waitForObjectExists(names.o_PreTreatmentUltrafiltration_volumeSlider_Slider).maximum), max_uf, "maximum uf value should be :" + str(max_uf)) + #FIXME: minimum value of the slider is unchanged based on simulator input test.compare(utils.l2ml(waitForObjectExists(names.o_PreTreatmentUltrafiltration_volumeSlider_Slider).minimum), min_uf, "minimum uf value should be :" + str(min_uf)) - test.verify((names.o_PreTreatmentUltrafiltration_Ultrafiltration_Volume_Text).text, config.UF_VOLUME_TEXT, "uf volume text should be " + config.UF_VOLUME_TEXT) - test.verify((names.o_PreTreatmentBase_indicator_StepIndicator).text, config.UF_TITLE_TEXT, "uf title text should be "+config.UF_TITLE_TEXT) + test.compare(waitForObjectExists(names.o_PreTreatmentUltrafiltration_Ultrafiltration_Volume_Text).text, config.UF_VOLUME_TEXT, "uf volume text should be " + config.UF_VOLUME_TEXT) + test.compare(waitForObjectExists(names.o_PreTreatmentUltrafiltration_Ultrafiltration_Setup_Text).text, config.UF_TITLE_TEXT, "uf title text should be "+config.UF_TITLE_TEXT) + test.endSection() def verify_bullet_indicators(indicator): @@ -177,6 +288,29 @@ """ mouseClick(waitForObject(names.o_PreTreatmentbase_skip_text)) +def test_vital_entries_on_patient_connection(): + """ + Method to verify BP/HR section from patient connection. + @param : N/A + @return: N/A + """ + test.startSection("verification of BP/HR section from patient connection") + test.compare(waitForObjectExists(names.o_PreTreatmentBase_BP_HR_Text).text, config.BP_HR_TEXT, "BP/HR title text should be :" + str(config.BP_HR_TEXT)) + test.compare(waitForObjectExists(names.o_PreTreatmentbase_skip_text).text, config.SKIP_TEXT, "BP/HR button text should be " + str(config.SKIP_TEXT)) + test.verify(waitForObjectExists(names.o_PreTreatmentbase_skip_text).enabled, "BP/HR button should enabled.") + test.compare(waitForObjectExists(names.o_PreTreatmentBase_Blood_Pressure_Text).text, config.BP_TEXT, "BP title text should be :" + str(config.BP_TEXT)) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_mmHg_Label).text, config.MMHG_TEXT, "BP unit should be " + str(config.MMHG_TEXT)) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_Heart_Rate_Text).text, config.HR_TEXT, "HR text should be :" + str(config.HR_TEXT)) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_BPM_Label).text, config.BPM_LABEL, "BP unit should be " + str(config.BPM_LABEL)) + + verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_120, + dia_val=DIASTOLIC_PRESSSURE_80, + heart_rate=HEART_RATE_VAL_101, + save=True) + + + test.endSection() + def main(): utils.tstStart(__file__) @@ -191,7 +325,7 @@ navigate_patient_connection(PRE_TREATMENT_PATIENT_CONNECTION_MODE) #verification of indicators from patient connection section - utility.page_step_indicator_verification(PRE_TREATMENT_STEPS, names.o_PreTreatmentUltrafiltration_Indicators) + utility.page_step_indicator_verification(UF_PRE_TREATMENT_STEPS, names.o_PreTreatmentUltrafiltration_Indicators) #verification of uf slider based on edge condition. start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_1"]) @@ -205,13 +339,18 @@ start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_9"]) start_test_treatment_ultrafilteration(TREATMENT_ULTRAFILTERATION_TESTING_OPTION["OPTION_10"]) - + #verification of rejection message test_rejection_message_patient_connection(accept_status = False) - + + #cmd to navigate to BP/HR section hd_simulator.cmd_send_uf_treatment_response(accepted = True, reason = 0, volume = config.UF_VALID_RANGE) - #test_vital_entries_on_patient_connection() + #verification of indicators from BP/HR section + utility.page_step_indicator_verification(BP_HR_PRE_TREATMENT_STEPS, names.o_PreTreatmentFlowBase_Indicators) + #verification of BP/HR entries based on edge condition + test_vital_entries_on_patient_connection() + test_patient_connection_instruction_screen(screen_indicator = 1) test_patient_connection_instruction_screen(screen_indicator = 2) test_patient_connection_instruction_screen(screen_indicator = 3)