Index: shared/scripts/configuration/config.py =================================================================== diff -u -r234ccf8d090d577de39369d3ff0f8455623ecfab -rc7d46d8afe80cc0751794f426e1000e0be7e93a7 --- shared/scripts/configuration/config.py (.../config.py) (revision 234ccf8d090d577de39369d3ff0f8455623ecfab) +++ shared/scripts/configuration/config.py (.../config.py) (revision c7d46d8afe80cc0751794f426e1000e0be7e93a7) @@ -36,3 +36,6 @@ #main treatment screen VITALS_TITLE = "VITALS" +OUT_OF_RANGE_COLOR = "#c53b33" +IN_RANGE_COLOR = "#fcfcfc" + Index: shared/scripts/configuration/utility.py =================================================================== diff -u -r0f8c72cdb9ebe10b644674e3d053f81911c867cb -rc7d46d8afe80cc0751794f426e1000e0be7e93a7 --- shared/scripts/configuration/utility.py (.../utility.py) (revision 0f8c72cdb9ebe10b644674e3d053f81911c867cb) +++ shared/scripts/configuration/utility.py (.../utility.py) (revision c7d46d8afe80cc0751794f426e1000e0be7e93a7) @@ -131,33 +131,35 @@ return str(date.strftime(date_format)) -def enter_keypad_value(entry, input_field): +def enter_keypad_value(entry): """ Method to enter user desired value using keypad + @param entry: User expected value """ test.startSection("Enter {entry}".format(entry=entry)) - input_field = waitForObject(input_field) for value in entry: - test.log("Entering {value}".format(value=value)) value = builtins.int(value) - squish.mouseClick(waitForObject(names.keypad_input(key_value=value))) + key_val = waitForObject(names.keypad_input(key_value=value)) + squish.mouseClick(key_val) utils.waitForGUI(1) test.endSection() def erase_entered_value(input_field): """ Method to erase the entered value + @param input_field - object of input field """ - input_field = waitForObject(input_field) + 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: - squish.mouseClick(input_field) utils.waitForGUI(1) - squish.mouseClick(waitForObject(names.o_back_space_key)) + squish.mouseClick(waitForObjectExists(names.o_back_space_key)) - test.compare(entered_value, "", "Input field should be empty") + test.compare(input_field.text.toUtf8().constData(), "", "Input field should be empty") + test.endSection() Index: shared/scripts/names.py =================================================================== diff -u -r0f8c72cdb9ebe10b644674e3d053f81911c867cb -rc7d46d8afe80cc0751794f426e1000e0be7e93a7 --- shared/scripts/names.py (.../names.py) (revision 0f8c72cdb9ebe10b644674e3d053f81911c867cb) +++ shared/scripts/names.py (.../names.py) (revision c7d46d8afe80cc0751794f426e1000e0be7e93a7) @@ -66,9 +66,10 @@ o_pop_up_heart_rate_title = {"container": o_treatmentStack_TreatmentStack, "text": "Heart Rate", "type": "Text", "unnamed": 1, "visible": True} o_pop_up_heart_rate_uom = {"container": o_treatmentStack_TreatmentStack, "text": "BPM", "type": "Label", "unnamed": 1, "visible": True} o_pop_up_heart_rate_input_field = {"backgroundcolor": "#254670", "container": o_treatmentStack_TreatmentStack, "echoMode": 0, "id": "_input", "occurrence": 3, "type": "TextInput", "unnamed": 1, "visible": True} -o_keypad_input = {"container": o_Gui_MainView, "type": "Text", "unnamed": 1, "visible": True} -o_back_space_key = {"container": o_Gui_MainView, "gradient": 0, "id": "backspaceKeyBackground", "type": "Rectangle", "unnamed": 1, "visible": True} +o_keypad_input = {"container": o_Gui_MainView, "id":"keyText", "type": "Text", "unnamed": 1, "visible": True} +o_back_space_key = {"container": o_Gui_MainView, "id": "backspaceKeyIcon", "source": "qrc:/QtQuick/VirtualKeyboard/content/styles/default/images/backspace-868482.svg", "type": "Image", "unnamed": 1, "visible": True} + def vitals_reading_obj(reading): o_vitals_reading["text"] = reading return o_vitals_reading Index: tst_main_treatment_vitals/test.py =================================================================== diff -u -r0f8c72cdb9ebe10b644674e3d053f81911c867cb -rc7d46d8afe80cc0751794f426e1000e0be7e93a7 --- tst_main_treatment_vitals/test.py (.../test.py) (revision 0f8c72cdb9ebe10b644674e3d053f81911c867cb) +++ tst_main_treatment_vitals/test.py (.../test.py) (revision c7d46d8afe80cc0751794f426e1000e0be7e93a7) @@ -35,8 +35,13 @@ DIASTOLIC_PRESSSURE_80 = "80" 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 def open_vitals_pop_up(): @@ -55,34 +60,132 @@ test.endSection() -# def verify_color_of_entry(entry, vital_parameter): -# -# if - -def verify_systolic_value_in_pop_up(value): +def verify_color_of_entry(entry, vital_parameter, input_field): """ - method to verify the entered systolic value - @param value: user entered systolic value + Method to verify the color of entry + of systolic, diastolic and heart rate """ - test.startSection("Verify the user entered systolic 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.startSection("Verify the color of {vital_parameter} value {entry}".format(\ + 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): + 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, + upper_limit=SYSTOLIC_UPPER_LIMIT)) + elif (entry >= SYSTOLIC_LOWER_LIMIT) and (entry <= SYSTOLIC_UPPER_LIMIT): + test.compare(input_field_color, IN_RANGE_COLOR, "systolic value {entry}".format(entry=entry) + + " is in range of {lower_limit} and {upper_limit}".format(\ + 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): + 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, + upper_limit=DIASTOLIC_UPPER_LIMIT)) + elif (entry >= DIASTOLIC_LOWER_LIMIT) and (entry <= DIASTOLIC_UPPER_LIMIT): + test.compare(input_field_color,IN_RANGE_COLOR, "diastolic value {entry}".format(entry=entry) + + " is in range of {lower_limit} and {upper_limit}".format(\ + 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): + 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, + upper_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 {entry}".format(entry=entry) + + " is in range of {lower_limit} and {upper_limit}".format(\ + lower_limit=HEART_RATE_LOWER_LIMIT, + upper_limit=HEART_RATE_UPPER_LIMIT)) test.endSection() + + + -def verify_blood_pressure_range(systolic=None, in_range=None): +# 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() - if in_range: - if systolic is True: - systolic = waitForObject(names.o_pop_up_systolic_input_field) - mouseClick(systolic) - for value in range(SYSTOLIC_LOWER_LIMIT, SYSTOLIC_UPPER_LIMIT): - enter_keypad_value(entry=str(value), input_field=systolic) - verify_systolic_value_in_pop_up(value=value) - erase_entered_value(input_field=systolic) + +def verify_entered_value_in_pop_up(value, input_field, vital): + """ + method to verify the user entered value + @param value: user user entered value + """ + test.startSection("Verify the user entered {vital} ".format(vital=vital) + + "value {value}".format(value=value)) + input_field = waitForObject(input_field) + entered_value = input_field.text.toUtf8().constData() + 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)) + test.endSection() + + +def verify_blood_pressure_range(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): + enter_keypad_value(entry=str(value)) + verify_entered_value_in_pop_up(value=str(value), input_field=systolic, + vital=vital_parameter) + verify_color_of_entry(entry=value, 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 value in range(DIASTOLIC_LOWER_LIMIT, DIASTOLIC_UPPER_LIMIT): + enter_keypad_value(entry=str(value)) + verify_entered_value_in_pop_up(value=str(value), input_field=diastolic, + vital=vital_parameter) + verify_color_of_entry(entry=value, 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 value in range(HEART_RATE_LOWER_LIMIT, HEART_RATE_UPPER_LIMIT): + enter_keypad_value(entry=str(value)) + verify_entered_value_in_pop_up(value=str(value), input_field=hr, + vital=vital_parameter) + verify_color_of_entry(entry=value, vital_parameter=HEART_RATE_TITLE, + input_field=hr) + erase_entered_value(input_field=hr) @@ -103,7 +206,10 @@ open_vitals_pop_up() test.log("Done") - verify_blood_pressure_range(systolic=True, in_range=True) +# 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)