Index: shared/scripts/configuration/config.py =================================================================== diff -u -r7fb24046293d1d1f1c4dba5f0b679e403ac096db -r1b46227816628d8648501e93e0d392489f0829c3 --- shared/scripts/configuration/config.py (.../config.py) (revision 7fb24046293d1d1f1c4dba5f0b679e403ac096db) +++ shared/scripts/configuration/config.py (.../config.py) (revision 1b46227816628d8648501e93e0d392489f0829c3) @@ -44,4 +44,8 @@ DIASTOLIC_UPPER_LIMIT = 200 HEART_RATE_LOWER_LIMIT = 40 HEART_RATE_UPPER_LIMIT = 180 +HEART_RATE_TITLE = "Heart Rate" +BLOOD_PRESSURE_TITLE = "Blood Pressure" +BLOOD_PRESSURE_UNIT = "mmHg" +HEART_RATE_UNIT = "BPM" Index: shared/scripts/names.py =================================================================== diff -u -rc7d46d8afe80cc0751794f426e1000e0be7e93a7 -r1b46227816628d8648501e93e0d392489f0829c3 --- shared/scripts/names.py (.../names.py) (revision c7d46d8afe80cc0751794f426e1000e0be7e93a7) +++ shared/scripts/names.py (.../names.py) (revision 1b46227816628d8648501e93e0d392489f0829c3) @@ -56,8 +56,8 @@ o_bp_uom = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "mmHg", "type": "Text", "unnamed": 1, "visible": True} o_vitals_reading = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "type": "Text", "unnamed": 1, "visible": True} o_hr_uom = {"container": o_treatmentStack_treatmentHome_TreatmentHome, "text": "BPM", "type": "Text", "unnamed": 1, "visible": True} -o_vitals_confrim_btn = {"container": o_treatmentStack_TreatmentStack, "gradient": 0, "id": "_confirmButton", "type": "TouchRect", "unnamed": 1, "visible": True} -o_vitals_close_btn = {"container": o_treatmentStack_TreatmentStack, "gradient": 0, "id": "_closeButton", "type": "CloseButton", "unnamed": 1, "visible": True} +o_vitals_confrim_btn = {"container": o_treatmentStack_TreatmentStack, "text": "CONFIRM", "type": "Text", "unnamed": 1, "visible": True} +o_vitals_close_btn = {"container": o_treatmentStack_TreatmentStack, "id": "_image", "source": "qrc:/images/iClose", "type": "Image", "unnamed": 1, "visible": True} o_vitals_pop_up_title = {"container": o_treatmentStack_TreatmentStack, "text": "VITALS", "type": "Text", "unnamed": 1, "visible": True} o_pop_up_bp_title = {"container": o_treatmentStack_TreatmentStack, "text": "Blood Pressure", "type": "Text", "unnamed": 1, "visible": True} o_pop_up_bp_uom = {"container": o_treatmentStack_TreatmentStack, "text": "mmHg", "type": "Label", "unnamed": 1, "visible": True} Index: tst_main_treatment_vitals/test.py =================================================================== diff -u -r7fb24046293d1d1f1c4dba5f0b679e403ac096db -r1b46227816628d8648501e93e0d392489f0829c3 --- tst_main_treatment_vitals/test.py (.../test.py) (revision 7fb24046293d1d1f1c4dba5f0b679e403ac096db) +++ tst_main_treatment_vitals/test.py (.../test.py) (revision 1b46227816628d8648501e93e0d392489f0829c3) @@ -11,35 +11,32 @@ # date 2022/feb/11 # author Papiya Mandal - +import builtins import names from configuration.config import * from configuration.utility import * from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator -from names import o_pop_up_bp_title hd = HDSimulator() SYSTOLIC_PRESSSURE_120 = "120" -SYSTOLIC_PRESSSURE_249 = "249" -SYSTOLIC_PRESSSURE_60 = "60" +SYSTOLIC_PRESSSURE_113 = "113" SYSTOLIC_PRESSSURE_200 = "200" SYSTOLIC_PRESSSURE_175 = "175" -SYSTOLIC_PRESSSURE_80 = "80" -DIASTOLIC_PRESSSURE_50 = "50" -DIASTOLIC_PRESSSURE_249 = "249" -DIASTOLIC_PRESSSURE_60 = "60" -DIASTOLIC_PRESSSURE_200 = "200" -DIASTOLIC_PRESSSURE_175 = "175" +DIASTOLIC_PRESSSURE_74 = "74" +DIASTOLIC_PRESSSURE_150 = "150" DIASTOLIC_PRESSSURE_80 = "80" +DIASTOLIC_PRESSSURE_60 = "60" +HEART_RATE_VAL_101 = "101" +HEART_RATE_VAL_60 = "60" +HEART_RATE_VAL_70 = "70" +HEART_RATE_VAL_85 = "85" DIASTOLIC_TEXT = "diastolic" SYSTOLIC_TEXT = "systolic" -HEART_RATE_TITLE = "Heart Rate" -BLOOD_PRESSURE_TITLE = "Blood Pressure" -BLOOD_PRESSURE_UNIT = "mmHg" -HEART_RATE_UNIT = "BPM" +BLOOD_PRESSURE_DEFAULT_VAL = "__ / __" +HEART_RATE_DEFAULT_VAL = "__" INVALID_VALS = {"systolic" : [260, 59, 300, 23], "diastolic": [39, 1, 210, 201], "Heart Rate": [181, 200, 39, 20]} @@ -78,10 +75,15 @@ """ Method to verify the color of entry of systolic, diastolic and heart rate + @param entry: user user entered value + @param vital_parameter - parameter name under which user + is entering value (sys/dia/heart rate) + @param input_field - object of input field """ test.startSection("Verify the color of {vital_parameter} value {entry}".format(\ vital_parameter=vital_parameter, entry=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 " + @@ -118,44 +120,54 @@ test.endSection() - - -# def verify_systolic_value_in_pop_up(value): -# """ -# method to verify the entered systolic value -# @param value: user entered systolic value -# """ -# test.startSection("Verify the user entered systolic value " + -# "{value}".format(value=value)) -# systolic = waitForObject(names.o_pop_up_systolic_input_field) -# systolic_value = systolic.text.toUtf8().constData() -# test.compare(systolic_value, value, -# "Expected systolic value: {value} ".format(value=value) + -# "should be equal to Actual systolic value: " + -# "{actual_value}".format(actual_value=systolic_value)) -# test.endSection() -# -# -# def verify_diastolic_value_in_pop_up(value): -# """ -# method to verify the entered diastolic value -# @param value: user entered diastolic value -# """ -# test.startSection("Verify the user entered diastolic value " + -# "{value}".format(value=value)) -# diastolic = waitForObject(names.o_pop_up_diastolic_input_field) -# diastolic_value = diastolic.text.toUtf8().constData() -# test.compare(diastolic_value, value, -# "Expected diastolic value: {value} ".format(value=value) + -# "should be equal to Actual diastolic value: " + -# "{actual_value}".format(actual_value=diastolic_value)) -# test.endSection() +def verify_last_read_time(saved_time): + """ + method to verify the last read of blood pressure + and heart rate + @param last_read: time of saving blood pressure and heart rate + """ + test.startSection("Verify the last read of blood pressure and heart rate") + expected_last_read = "Interval: 30min , Last Read: {saved_time}".format(saved_time=saved_time) + last_read = waitForObject(names.vitals_reading_obj(reading=expected_last_read)) + last_read = last_read.text.toUtf8().constData() + test.compare(last_read, expected_last_read, + "Last read time should be {last_read}".format(last_read=last_read)) + 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: user user entered value + @param vital - parameter name under which user + is entering value (sys/dia/heart rate) + @param input_field - object of input field + """ + test.startSection("Verify the user entered {vital} ".format(vital=vital) + + "value {value} in main-treatment screen".format(value=value)) + if save: + input_field = waitForObject(names.vitals_reading_obj(reading=value)) + entered_value = input_field.text.toUtf8().constData() + value = str(value) + test.compare(entered_value, value, + "Expected {vital} value: {value} ".format(vital=vital, value=value) + + "should be equal to Actual {vital} value: ".format(vital=vital) + + "{actual_value}".format(actual_value=entered_value)) + elif (save is False): + if object.exists(names.vitals_reading_obj(reading=value)) is False: + test.log("Entered is not saved and is not updated in main-treatment screen") + + test.endSection() def verify_entered_value_in_pop_up(value, input_field, vital): """ method to verify the user entered value @param value: user user entered value + @param value: user user entered value + @param vital - parameter name under which user + is entering value (sys/dia/heart rate) """ test.startSection("Verify the user entered {vital} ".format(vital=vital) + "value {value}".format(value=value)) @@ -173,12 +185,14 @@ Method to verify the in range value for Blood Pressure Systolic and diastolic and heart rate + @param vital_parameter - parameter name under which user + is entering value (sys/dia/heart rate) """ test.startSection("Verify the range of {vital}".format(vital=vital_parameter)) if vital_parameter is SYSTOLIC_TEXT: systolic = waitForObject(names.o_pop_up_systolic_input_field) mouseClick(systolic) - for value in range(SYSTOLIC_LOWER_LIMIT, SYSTOLIC_UPPER_LIMIT): + for value in range(SYSTOLIC_LOWER_LIMIT, SYSTOLIC_UPPER_LIMIT+1): enter_keypad_value(entry=str(value)) verify_entered_value_in_pop_up(value=str(value), input_field=systolic, vital=vital_parameter) @@ -188,7 +202,7 @@ elif vital_parameter is DIASTOLIC_TEXT: diastolic = waitForObject(names.o_pop_up_diastolic_input_field) mouseClick(diastolic) - for value in range(DIASTOLIC_LOWER_LIMIT, DIASTOLIC_UPPER_LIMIT): + for value in range(DIASTOLIC_LOWER_LIMIT, DIASTOLIC_UPPER_LIMIT+1): enter_keypad_value(entry=str(value)) verify_entered_value_in_pop_up(value=str(value), input_field=diastolic, vital=vital_parameter) @@ -198,7 +212,7 @@ elif vital_parameter is HEART_RATE_TITLE: hr = waitForObject(names.o_pop_up_heart_rate_input_field) mouseClick(hr) - for value in range(HEART_RATE_LOWER_LIMIT, HEART_RATE_UPPER_LIMIT): + for value in range(HEART_RATE_LOWER_LIMIT, HEART_RATE_UPPER_LIMIT+1): enter_keypad_value(entry=str(value)) verify_entered_value_in_pop_up(value=str(value), input_field=hr, vital=vital_parameter) @@ -248,7 +262,59 @@ erase_entered_value(input_field=hr) 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 main-treatment + screen + """ + test.startSection("Verify the entered systolic, diastolic and heart rate " + + "value updated in main-treatement screen") + systolic = waitForObject(names.o_pop_up_systolic_input_field) + mouseClick(systolic) + erase_entered_value(input_field=systolic) + enter_keypad_value(entry=str(sys_val)) + 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(input_field=diastolic) + enter_keypad_value(entry=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(input_field=hr) + enter_keypad_value(entry=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 " + + "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 main(): @@ -263,7 +329,59 @@ utils.waitForGUI(delay_s=3) open_vitals_pop_up() + 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) + utils.waitForGUI(2) + + open_vitals_pop_up() + verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_120, + input_field=names.o_pop_up_systolic_input_field, + vital=SYSTOLIC_TEXT) + verify_entered_value_in_pop_up(value=DIASTOLIC_PRESSSURE_80, + input_field=names.o_pop_up_diastolic_input_field, + vital=DIASTOLIC_TEXT) + verify_entered_value_in_pop_up(value=HEART_RATE_VAL_101, + input_field=names.o_pop_up_heart_rate_input_field, + vital=HEART_RATE_TITLE) + verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_175, + dia_val=DIASTOLIC_PRESSSURE_60, + heart_rate=HEART_RATE_VAL_85, + save=False) + utils.waitForGUI(2) + open_vitals_pop_up() + verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_175, + input_field=names.o_pop_up_systolic_input_field, + vital=SYSTOLIC_TEXT) + verify_entered_value_in_pop_up(value=DIASTOLIC_PRESSSURE_60, + input_field=names.o_pop_up_diastolic_input_field, + vital=DIASTOLIC_TEXT) + verify_entered_value_in_pop_up(value=HEART_RATE_VAL_85, + input_field=names.o_pop_up_heart_rate_input_field, + vital=HEART_RATE_TITLE) + verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_113, + dia_val=DIASTOLIC_PRESSSURE_74, + heart_rate=HEART_RATE_VAL_70, + save=True) + utils.waitForGUI(2) + open_vitals_pop_up() + verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_113, + input_field=names.o_pop_up_systolic_input_field, + vital=SYSTOLIC_TEXT) + verify_entered_value_in_pop_up(value=DIASTOLIC_PRESSSURE_74, + input_field=names.o_pop_up_diastolic_input_field, + vital=DIASTOLIC_TEXT) + verify_entered_value_in_pop_up(value=HEART_RATE_VAL_70, + input_field=names.o_pop_up_heart_rate_input_field, + vital=HEART_RATE_TITLE) + verify_entered_valid_vital_entries_in_main_treatment_screen(sys_val=SYSTOLIC_PRESSSURE_200, + dia_val=DIASTOLIC_PRESSSURE_150, + heart_rate=HEART_RATE_VAL_60, + save=False) + utils.waitForGUI(2) + open_vitals_pop_up() verify_ranges_of_vital(vital_parameter=SYSTOLIC_TEXT) verify_ranges_of_vital(vital_parameter=DIASTOLIC_TEXT) verify_ranges_of_vital(vital_parameter=HEART_RATE_TITLE) @@ -272,6 +390,4 @@ verify_the_color_of_out_of_range(vital_parameter=DIASTOLIC_TEXT) verify_the_color_of_out_of_range(vital_parameter=HEART_RATE_TITLE) - current_date_time = get_current_date_and_time() - test.log(current_date_time) - + utils.tstDone()