Index: shared/scripts/configuration/config.py =================================================================== diff -u -rc7d46d8afe80cc0751794f426e1000e0be7e93a7 -r7fb24046293d1d1f1c4dba5f0b679e403ac096db --- shared/scripts/configuration/config.py (.../config.py) (revision c7d46d8afe80cc0751794f426e1000e0be7e93a7) +++ shared/scripts/configuration/config.py (.../config.py) (revision 7fb24046293d1d1f1c4dba5f0b679e403ac096db) @@ -38,4 +38,10 @@ VITALS_TITLE = "VITALS" OUT_OF_RANGE_COLOR = "#c53b33" IN_RANGE_COLOR = "#fcfcfc" +SYSTOLIC_LOWER_LIMIT = 60 +SYSTOLIC_UPPER_LIMIT = 250 +DIASTOLIC_LOWER_LIMIT = 40 +DIASTOLIC_UPPER_LIMIT = 200 +HEART_RATE_LOWER_LIMIT = 40 +HEART_RATE_UPPER_LIMIT = 180 Index: shared/scripts/configuration/utility.py =================================================================== diff -u -rc7d46d8afe80cc0751794f426e1000e0be7e93a7 -r7fb24046293d1d1f1c4dba5f0b679e403ac096db --- shared/scripts/configuration/utility.py (.../utility.py) (revision c7d46d8afe80cc0751794f426e1000e0be7e93a7) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision 7fb24046293d1d1f1c4dba5f0b679e403ac096db) @@ -151,9 +151,9 @@ Method to erase the entered value @param input_field - object of input field """ + test.startSection("Erasing value") input_field= waitForObject(input_field) entered_value = input_field.text.toUtf8().constData() - test.startSection("Erasing {entered_value}".format(entered_value)) for value in entered_value: utils.waitForGUI(1) squish.mouseClick(waitForObjectExists(names.o_back_space_key)) Index: tst_main_treatment_vitals/test.py =================================================================== diff -u -rc7d46d8afe80cc0751794f426e1000e0be7e93a7 -r7fb24046293d1d1f1c4dba5f0b679e403ac096db --- tst_main_treatment_vitals/test.py (.../test.py) (revision c7d46d8afe80cc0751794f426e1000e0be7e93a7) +++ tst_main_treatment_vitals/test.py (.../test.py) (revision 7fb24046293d1d1f1c4dba5f0b679e403ac096db) @@ -18,6 +18,7 @@ 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() @@ -36,12 +37,11 @@ DIASTOLIC_TEXT = "diastolic" SYSTOLIC_TEXT = "systolic" HEART_RATE_TITLE = "Heart Rate" -SYSTOLIC_LOWER_LIMIT = 60 -SYSTOLIC_UPPER_LIMIT = 250 -DIASTOLIC_LOWER_LIMIT = 40 -DIASTOLIC_UPPER_LIMIT = 250 -HEART_RATE_LOWER_LIMIT = 40 -HEART_RATE_UPPER_LIMIT = 180 +BLOOD_PRESSURE_TITLE = "Blood Pressure" +BLOOD_PRESSURE_UNIT = "mmHg" +HEART_RATE_UNIT = "BPM" +INVALID_VALS = {"systolic" : [260, 59, 300, 23], "diastolic": [39, 1, 210, 201], + "Heart Rate": [181, 200, 39, 20]} def open_vitals_pop_up(): @@ -53,10 +53,24 @@ vitals_touch_area = object.parent(waitForObject(names.o_vitals_title)) mouseClick(vitals_touch_area) test.log("Verifying the 'Vitals' pop up is displayed") - if object.exists(names.o_vitals_confrim_btn): + if object.exists(names.o_vitals_pop_up_title): vitals_pop_up_title = waitForObject(names.o_vitals_pop_up_title) vitals_pop_up_title = vitals_pop_up_title.text.toUtf8().constData() - test.compare(vitals_pop_up_title, VITALS_TITLE,"Vitals pop screen is displayed") + test.compare(vitals_pop_up_title, VITALS_TITLE,"Vitals title text is displayed") + bp_title = waitForObject(names.o_pop_up_bp_title) + bp_title = bp_title.text.toUtf8().constData() + test.compare(bp_title, BLOOD_PRESSURE_TITLE,"Blood pressure title text is displayed") + bp_uom = waitForObject(names.o_bp_uom) + bp_uom = bp_uom.text.toUtf8().constData() + test.compare(bp_uom, BLOOD_PRESSURE_UNIT,"Blood pressure unit " + + "should be {unit}".format(unit=BLOOD_PRESSURE_UNIT)) + heart_rate_title = waitForObject(names.o_pop_up_heart_rate_title) + heart_rate_title = heart_rate_title.text.toUtf8().constData() + test.compare(heart_rate_title, HEART_RATE_TITLE,"Heart rate title text is displayed") + hr_uom = waitForObject(names.o_hr_uom) + hr_uom = hr_uom.text.toUtf8().constData() + test.compare(hr_uom, HEART_RATE_UNIT,"Heart Rate unit " + + "should be {unit}".format(unit=HEART_RATE_UNIT)) test.endSection() @@ -69,7 +83,7 @@ vital_parameter=vital_parameter, entry=entry)) input_field_color = input_field.color.name if vital_parameter is SYSTOLIC_TEXT: - if (entry < SYSTOLIC_LOWER_LIMIT) and (entry > SYSTOLIC_UPPER_LIMIT): + if (entry < SYSTOLIC_LOWER_LIMIT) or (entry > SYSTOLIC_UPPER_LIMIT): test.compare(input_field_color, OUT_OF_RANGE_COLOR, "systolic value " + "{entry} is out of range, systolic value should be in range of ".format(entry=entry) + "{lower_limit} and {upper_limit}".format(lower_limit=SYSTOLIC_LOWER_LIMIT, @@ -80,7 +94,7 @@ lower_limit=SYSTOLIC_LOWER_LIMIT, upper_limit=SYSTOLIC_UPPER_LIMIT)) elif vital_parameter is DIASTOLIC_TEXT: - if (entry < DIASTOLIC_LOWER_LIMIT) and (entry > DIASTOLIC_UPPER_LIMIT): + if (entry < DIASTOLIC_LOWER_LIMIT) or (entry > DIASTOLIC_UPPER_LIMIT): test.compare(input_field_color, OUT_OF_RANGE_COLOR, "diastolic value " + "{entry} is out of range, diastolic value should be in range of ".format(entry=entry) + "{lower_limit} and {upper_limit}".format(lower_limit=DIASTOLIC_LOWER_LIMIT, @@ -91,7 +105,7 @@ lower_limit=DIASTOLIC_LOWER_LIMIT, upper_limit=DIASTOLIC_UPPER_LIMIT)) elif vital_parameter is HEART_RATE_TITLE: - if (entry < HEART_RATE_LOWER_LIMIT) and (entry > HEART_RATE_UPPER_LIMIT): + if (entry < HEART_RATE_LOWER_LIMIT) or (entry > HEART_RATE_UPPER_LIMIT): test.compare(input_field_color, OUT_OF_RANGE_COLOR, "Heart Rate value " + "{entry} is out of range, Heart Rate value should be in range of ".format(entry=entry) + "{lower_limit} and {upper_limit}".format(lower_limit=HEART_RATE_LOWER_LIMIT, @@ -154,8 +168,13 @@ test.endSection() -def verify_blood_pressure_range(vital_parameter): -# """ +def verify_ranges_of_vital(vital_parameter): + """ + Method to verify the in range value + for Blood Pressure Systolic and diastolic + and 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) @@ -186,12 +205,51 @@ verify_color_of_entry(entry=value, vital_parameter=HEART_RATE_TITLE, input_field=hr) erase_entered_value(input_field=hr) - + test.endSection() +def verify_the_color_of_out_of_range(vital_parameter): + """ + Method to verify the color of out of range values + @param vital_parameter : parameter name (systolic, diastolic, heart rate) + """ + test.startSection("Verify the color out of range values of " + + "{vital}".format(vital=vital_parameter)) + out_range_val_list = INVALID_VALS[vital_parameter] + if vital_parameter is SYSTOLIC_TEXT: + systolic = waitForObject(names.o_pop_up_systolic_input_field) + mouseClick(systolic) + for entry in out_range_val_list: + enter_keypad_value(entry=str(entry)) + verify_entered_value_in_pop_up(value=str(entry), input_field=systolic, + vital=vital_parameter) + verify_color_of_entry(entry=entry, vital_parameter=SYSTOLIC_TEXT, + input_field=systolic) + erase_entered_value(input_field=systolic) + elif vital_parameter is DIASTOLIC_TEXT: + diastolic = waitForObject(names.o_pop_up_diastolic_input_field) + mouseClick(diastolic) + for entry in out_range_val_list: + enter_keypad_value(entry=str(entry)) + verify_entered_value_in_pop_up(value=str(entry), input_field=diastolic, + vital=vital_parameter) + verify_color_of_entry(entry=entry, vital_parameter=DIASTOLIC_TEXT, + input_field=diastolic) + erase_entered_value(input_field=diastolic) + elif vital_parameter is HEART_RATE_TITLE: + hr = waitForObject(names.o_pop_up_heart_rate_input_field) + mouseClick(hr) + for entry in out_range_val_list: + enter_keypad_value(entry=str(entry)) + verify_entered_value_in_pop_up(value=str(entry), input_field=hr, + vital=vital_parameter) + verify_color_of_entry(entry=entry, vital_parameter=HEART_RATE_TITLE, + input_field=hr) + erase_entered_value(input_field=hr) + test.endSection() - + def main(): utils.tstStart(__file__) @@ -205,17 +263,15 @@ utils.waitForGUI(delay_s=3) open_vitals_pop_up() - test.log("Done") -# verify_blood_pressure_range(systolic=True, in_range=True) - verify_blood_pressure_range(vital_parameter=SYSTOLIC_TEXT) - verify_blood_pressure_range(vital_parameter=DIASTOLIC_TEXT) - verify_blood_pressure_range(vital_parameter=HEART_RATE_TITLE) - + 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) + + verify_the_color_of_out_of_range(vital_parameter=SYSTOLIC_TEXT) + 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)