Index: suite_leahi/tst_patient_vitals/test.py =================================================================== diff -u -r50d3084c54eef035058b21579538b53f503af657 -r3668d4a9747b75c20be05a1245edb041cb91cc4b --- suite_leahi/tst_patient_vitals/test.py (.../test.py) (revision 50d3084c54eef035058b21579538b53f503af657) +++ suite_leahi/tst_patient_vitals/test.py (.../test.py) (revision 3668d4a9747b75c20be05a1245edb041cb91cc4b) @@ -26,7 +26,7 @@ import builtins from leahi_dialin.ui import utils from configuration import utility -from configuration import config +from configuration import config,navigation from leahi_dialin.ui.td_messaging import TD_Messaging from leahi_dialin.common.td_defs import TDOpModes,TDTreatmentStates from datetime import datetime @@ -35,8 +35,18 @@ td =TD_Messaging() can_interface = td.can_interface -vitals = {"0":"0","1":"5","2":"10","3":"15","4":"20","5":"30","6":"60"} - +vitalsrequest =False + +def check_bp_cuff_enabled(): + integrated_bp_value = navigation.get_ini_value("/home/denali/Public/luis/config/configurations/Settings/System.conf", section ="Feature Configurations", key ="IntegratedBPCuff") + if integrated_bp_value == "0": + navigation.navigate_to_device_settings_using_service_password() + device_settings_grid = waitForObject(names.o_DeviceSettingsGrid) + mouseClick(utility.findChildByText(device_settings_grid, config.FEATURE_CONFIGURATIONS)) + integrated_bp_cuff_mode_switch = waitForObject(names.o_SettingsBase_integratedBPCuffSwitch_BaseSwitch, 3000) + mouseClick(integrated_bp_cuff_mode_switch) + + test.log(f "Initial Integrated BP Cuff switch is enabled state") def keyboard_object_map_helper(text): """ Method for setting custom object property's for keyboard keys @@ -70,29 +80,7 @@ test.compare(actual_value, (input_field.text), "Value should be -> "+ str(actual_value)) test.log("User successfully authenticated through patient id -> " + expected_value + "using keypad.") -def verify_vitals_pop_up_is_opened_automatically_after_an_interval(interval): - """ - Method to verify the vitals pop up - is opened automatically once the - BPM interval time is elapsed - @param interval - (int) interval in min - """ - test.startSection("Verify the vitals pop up opened automatically after interval time is elapsed") - sec = interval*60 - start_time = time.time() - sec_count = 0 - while not(object.exists(names.o_vitals_close_btn)): - sec_count += 1 - end_time = time.time() - if sec_count in range(295, 301): - test.log("Dialog close button be visible after {}".format(sec)) - close_btn = waitForObject(names.o_vitals_close_btn) - total_elapsed_time = end_time - start_time - test.log("Total elapsed time : {}".format(total_elapsed_time)) - test.compare(close_btn.visible, config.VISIBLE, "Popup close option is visible after the vitals pop up is opened automatically") - reason_text = waitForObjectExists(utility.setObjectText(text = "Rejected Reason: [1] Request is not allowed in the current operating mode",obj =names.o_title_Text)) - test.compare(reason_text.text, "Rejected Reason: [1] Request is not allowed in the current operating mode", "Rejection reason text should be"+str("Rejected Reason: [1] Request is not allowed in the current operating mode")) - test.endSection() + def verify_last_read_time(interval): test.startSection("Verify the last read time") @@ -143,16 +131,13 @@ """ Method to check the popup is opened automatically after time interval """ - vitalsrequest = False # mouseClick(waitForObject(names.o_treatmentHome_editButton_IconButton)) test.startSection("Verify popup is opened automatically after time interval") mouseClick(waitForObject(names.o_vitalsButton_VitalsButton)) - td.td_vitals( systolic = 70, - diastolic = 50, - heartRate = 120 ) + mouseClick(waitForObject(names.o_measureVitalsButton_TouchRect)) td.td_vitals_adjustment_response(vRejectionReason=1) - verify_vitals_pop_up_is_opened_automatically_after_an_interval(interval=5) - test.verify(waitFor("'vitalsrequest == True'", 1000), "UI Sending the request to FW") + rejectionReason = utility.get_object_from_names(names.o_notification_bar) + test.compare(rejectionReason.text, "Rejected Reason: [1] Request is not allowed in the current operating mode", "Rejection Reason text should be :" + str(rejectionReason.text)) test.endSection() def validate_time_interval(vital_interval_obj, int_min): @@ -199,52 +184,30 @@ else: test.fail(f"Remaining time incorrect. Expected {expected_str}, got {ui_str}") - - # handler for messages from UI to FW -def handle_patient_vitals_request( message): +def handle_patient_vitals_request( message, timestamp = 0.0): """ Called when the user requests to firmware from UI @return: None """ - message = message['message'] - index = MsgFieldPositions.START_POS_FIELD_1 - index = conversions.bytearray_to_integer( message, index) global vitalsrequest vitalsrequest = True def verify_automatic_vitals_noRejection_Reason(): - global vitalsrequest - vitalsrequest = False - MAX_WAIT = 5 * 60 # 5 minutes in seconds - POLL_INTERVAL = 5 # check every 5 seconds - - mouseClick(waitForObject(names.o_vitalsButton_VitalsButton)) - mouseClick(names.o_measureVitalsButton_TouchRect) - td.td_vitals( systolic = 70, - diastolic = 50, - heartRate = 120 ) + MAX_WAIT = 5 * 60 * 1000 # 5 minutes in seconds - test.verify(waitFor("'vitalsrequest == True'", 1000), "UI Sending the request to FW") - + test.verify(waitFor( lambda: vitalsrequest == True, MAX_WAIT), "UI Sending the request to FW") td.td_vitals_adjustment_response(vRejectionReason=0) - start_time = time.time() - - while time.time() - start_time < MAX_WAIT: - if vitalsrequest: - td.td_vitals(systolic = 80, - diastolic = 60, - heartRate = 140 ) - break - time.sleep(POLL_INTERVAL) - else: - test.log("Condition not satisfied within 5 minutes. Exiting loop.") + td.td_vitals(systolic = 80, + diastolic = 60, + heartRate = 140 ) + blood_pressure = waitForObjectExists(names.o_treatmentHome_bloodPressure_LabelValue).topText - test.compare("70"+"/"+"50", blood_pressure,"Blood pressure value should be ->"+str("80"+"/"+"60")) + test.compare("80"+"/"+"60", blood_pressure,"Blood pressure value should be ->"+str("80"+"/"+"60")) heart_rate = waitForObjectExists(names.o_treatmentHome_heartBeat_LabelValue).topText - test.compare("120", heart_rate,"Heart Rate value should be ->"+str(120)) + test.compare("140", heart_rate,"Heart Rate value should be ->"+str(120)) def set_value_based_on_target_patientvitals(obj, target_value): """ @@ -313,6 +276,7 @@ test.endSection() test.startSection("Verify the minimum values in the vitals popup") + check_bp_cuff_enabled() td.td_operation_mode(TDOpModes.MODE_TREA.value, 0) td.td_tx_state(TDTreatmentStates.TREATMENT_DIALYSIS_STATE.value , 0 ,