Index: tst_main_treatment_vitals/test.py =================================================================== diff -u -ra28d0e428b2a605c271dea369fb92c98d2051cd1 -r941ef3c2c59d7977c23dd37a7af68a3aa84a60a9 --- tst_main_treatment_vitals/test.py (.../test.py) (revision a28d0e428b2a605c271dea369fb92c98d2051cd1) +++ tst_main_treatment_vitals/test.py (.../test.py) (revision 941ef3c2c59d7977c23dd37a7af68a3aa84a60a9) @@ -18,6 +18,9 @@ from configuration.utility import * from dialin.ui import utils from dialin.ui.hd_simulator import HDSimulator +from dialin.ui.utils import waitForGUI +from configuration import utility +from dialin.common.hd_defs import PreTreatmentSubModes, HDOpModes, HDOpSubModes, PreTreatmentSampleWaterStates, PreTreatmentConsumableSelfTestStates, PreTreatmentNoCartSelfTestsStates, PreTreatmentCartridgeInstallStates, PreTreatmentDrySelfTestsStates, PreTreatmentPrimeStates, PreTreatmentRecircStates, PreTreatmentPatientConnectionStates hd_simulator = HDSimulator() @@ -40,7 +43,75 @@ INVALID_VALS = {"systolic" : [260, 59, 300, 23], "diastolic": [39, 1, 210, 201], "Heart Rate": [181, 200, 39, 20]} +time_interval = "25min" +BP_HR_PRE_TREATMENT_STEPS = 6 +ven_low = 40 +ven_high = 400 +art_high = -20 +art_low = -240 +def keyboard_object_map_helper(text): + """ + Method for setting custom object property's for keyboard keys + + @return: required object property's for keys + """ + if text is not None: + names.o_keboard_input["text"] = text + return names.o_keboard_input + else: + test.log("Invalid ",text," for object.") + names.o_keyboard_input["text"] = "Q" + + +def keyboard_switching_section(text): + """ + Tests to automate keyboard based on user input + + @return: key text (text displayed on keyboard) + """ + keyboard_value = keyboard_object_map_helper(text) + object_status = object.exists(keyboard_value) + if object_status is True: + return text + else: + #Tests to get status of keys in keyboard layout + object_status = object.exists(keyboard_object_map_helper(config.KEYBOARD_SWITCH[1])) + if object_status is True: + keyboard_value = keyboard_object_map_helper(config.KEYBOARD_SWITCH[1]) + utils.waitForGUI(.3) + mouseClick(waitForObject(keyboard_value)) + keyboard_value = keyboard_object_map_helper(text) + object_status = object.exists(keyboard_value) + if object_status is True: + return text + object_status = object.exists(keyboard_object_map_helper(config.KEYBOARD_SWITCH[0])) + if object_status is True: + keyboard_value = keyboard_object_map_helper(config.KEYBOARD_SWITCH[0]) + mouseClick(waitForObject(keyboard_value)) + keyboard_value = keyboard_object_map_helper(text) + object_status = object.exists(keyboard_value) + if object_status is True: + return text + object_status = object.exists(names.o_keyboard_switch2) + if object_status is True: + keyboard_value = waitForObject(names.o_keyboard_switch2) + mouseClick(keyboard_value) + text = text.lower() + keyboard_value = keyboard_object_map_helper(text) + object_status = object.exists(keyboard_value) + if object_status is True: + return text + object_status = object.exists(names.o_keyboard_switch) + if object_status is True: + keyboard_value = waitForObject(names.o_keyboard_switch) + mouseClick(keyboard_value) + text = text.lower() + keyboard_value = keyboard_object_map_helper(text) + object_status = object.exists(keyboard_value) + if object_status is True: + return text + def open_vitals_pop_up(): """ Method to open the vitals pop up @@ -96,28 +167,368 @@ 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_request_continue_mode(): + """ + Method to accept treatment response. + """ + treatment_status = hd_simulator.cmd_send_treatment_parameter_manual_validation_response([ + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ]) + test.compare(treatment_status, True, "custom treatment should be accepted") +def verify_create_custom_treatment_parameter(): + """ + Method to set create custom treatment slider value based on slider buffer + """ + test.startSection("Method to set create custom treatment slider based on positive slider buffer") + test.compare(waitForObject(names.o_PreTreatmentCreate_Create_a_Custom_Treatment_Text).text, config.TREATMENT_TITLE, "Title text should be -> "+str(config.TREATMENT_TITLE)) + + test.compare(waitForObject(names.o_PreTreatmentCreate_PRESCRIPTION_Text).text, config.PRESCRIPTION_TITLE, "Title text should be -> "+str(config.PRESCRIPTION_TITLE)) + #set custom values for parameters + test.startSection("verification of blood flow values") + test.compare(waitForObject(names.o_PreTreatmentCreate_bloodFlowRate_SliderCreateTreatment).label, config.BLOOD_FLOW_RATE, "Parameter should be -> "+str(config.BLOOD_FLOW_RATE)) + test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodFlowRateSlider_Slider, 100, config.CREATE_TREATMENT_SLIDER_VALUES["blood_flow_rate"], config.BLOOD_FLOW_RATE) + test.endSection() + + test.startSection("verification of dialysate flow values") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialysateFlowRate_SliderCreateTreatment).label, config.DIALYSATE_FLOW_RATE, "Parameter should be -> "+str(config.DIALYSATE_FLOW_RATE)) + + test_custom_treatment_slider(names.o_PreTreatmentCreate_dialysateFlowRateSlider_Slider, 250, config.CREATE_TREATMENT_SLIDER_VALUES["dialysate_flow_rate"], config.DIALYSATE_FLOW_RATE) + test.endSection() + + test.startSection("verification of duration values") + test.compare(waitForObject(names.o_PreTreatmentCreate_duration_SliderCreateTreatment).label, config.DURATION, "Parameter should be -> "+str(config.DURATION)) + test_custom_treatment_slider(names.o_PreTreatmentCreate_durationSlider_Slider, 60, config.CREATE_TREATMENT_SLIDER_VALUES["duration"], config.DURATION) + test.endSection() + + #scroll the screen to the title heparin bolus volume + parameter_object = set_parameter_type(text = config.HEPARIN_BOLUS_VOLUME) + utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) + + test.startSection("verification of heparin dispensing rate values") + test.compare(waitForObject(names.o_PreTreatmentCreate_heparinDispensingRate_SliderCreateTreatment).label, config.HEPARIN_DISPENSING_RATE, "Parameter should be -> "+str(config.HEPARIN_DISPENSING_RATE)) + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinDispensingRateSlider_Slider, 0.0, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_dispensing_rate"], config.HEPARIN_DISPENSING_RATE) + + test.endSection() + + test.startSection("verification of heparin bolus volume values") + test.compare(waitForObject(names.o_PreTreatmentCreate_heparinBolusVolume_SliderCreateTreatment).label, config.HEPARIN_BOLUS_VOLUME, "Parameter should be -> "+str(config.HEPARIN_BOLUS_VOLUME)) + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinBolusVolumeSlider_Slider, 0.0, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_bolus_volume"], config.HEPARIN_BOLUS_VOLUME) + + test.endSection() + + #scroll the screen to the title acid concentrate type + parameter_object = set_parameter_type(text = config.HEPARIN_TYPE_TITLE) + utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) + + test.startSection("verification of heparin stop time values") + test.compare(waitForObject(names.o_PreTreatmentCreate_heparinStopTime_SliderCreateTreatment).label, config.HEPARIN_STOP_TIME, "Parameter should be -> "+str(config.HEPARIN_STOP_TIME)) + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinStopTimeSlider_Slider, 10, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_stop_time"], config.HEPARIN_STOP_TIME) + + test.endSection() + + test.startSection("verification of saline bolus values") + test.compare(waitForObject(names.o_PreTreatmentCreate_salineBolus_SliderCreateTreatment).label, config.SALINE_BOLUS_TITLE, "Parameter should be -> "+str(config.SALINE_BOLUS_TITLE)) + test_custom_treatment_slider(names.o_PreTreatmentCreate_salineBolusSlider_Slider, 100, config.CREATE_TREATMENT_SLIDER_VALUES["saline_bolus"], config.SALINE_BOLUS_TITLE) + test.endSection() + + #scroll the screen to the title acid concentrate type + parameter_object = set_parameter_type(text = config.ACID_CONCENTRATE_TITLE) + utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) + + test.startSection("verification of heparin type") + test.compare(waitForObject(names.o_PreTreatmentCreate_heparinTypeRect_GridSelection).labels, config.HEPARIN_TYPE, "Parameter should be -> "+str(config.HEPARIN_TYPE)) + mouseClick(waitForObject(names.o_PreTreatmentCreate_heparinTypeRect0_TouchRect)) + test.compare(waitForObject(names.o_PreTreatmentCreate_heparinTypeRect0_TouchRect).text.text, config.HEPARIN_TYPE, "heparin text should be :"+ str(config.HEPARIN_TYPE)) + test.compare(waitForObject(names.o_PreTreatmentCreate_heparinTypeRect0_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.endSection() + + #scroll the screen to the title dialyste rectangle + parameter_object = set_parameter_type(text = config.DIALYZER_TYPE_TITLE) + utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) + + test.startSection("verification of acid concentrate type") + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect_GridSelection).title, config.ACID_CONCENTRATE_TITLE, "Parameter should be -> "+str(config.ACID_CONCENTRATE_TITLE)) + mouseClick(names.o_PreTreatmentCreate_acidConcentrateRect0_TouchRect) + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect0_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect0_TouchRect).text.text, config.ACID_CONCENTRATE[0], "Acid concentrate value should be :"+str(config.ACID_CONCENTRATE[0])) + test.endSection() + + #scroll the screen to the title dialyste rectangle + parameter_object = set_parameter_type(text = config.DIALYZER_TYPE_TITLE) + utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) + + test.startSection("verification of bicarbonate concentrate rectangle") + test.compare(waitForObject(names.o_PreTreatmentCreate_bicarbonateConcentrateRect_GridSelection).title, config.BICARBONATE_CONCENTRATE_TITLE, "Parameter should be -> "+str(config.BICARBONATE_CONCENTRATE_TITLE)) + mouseClick(names.o_PreTreatmentCreate_bicarbonateConcentrateRect0_TouchRect) + test.compare(waitForObject(names.o_PreTreatmentCreate_bicarbonateConcentrateRect0_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_bicarbonateConcentrateRect0_TouchRect).text.text, config.BICARBONATE_CONCENTRATE, "Bicarbonate concentrate value should be :"+str(config.ACID_CONCENTRATE[0])) + test.endSection() + + #scroll the screen to the title dialyste temperature value + parameter_object = set_parameter_type(text = config.DIALYSATE_TEMPERATURE) + utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) + + test.startSection("verification of dialysate rectangle") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect_GridSelection).title, config.DIALYZER_TYPE_TITLE, "Parameter should be -> "+str(config.DIALYZER_TYPE_TITLE)) + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeRect0_TouchRect) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect0_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect0_TouchRect).text.text, config.DIALYZER_TYPE[0], "Dialyzer type value should be :"+str(config.DIALYZER_TYPE[0])) + + + test.endSection() + + #scroll the screen to the title blood pressure measurement interval + parameter_object = set_parameter_type(text = config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL) + utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) + + test.startSection("verification of dialysate temperature values") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialysateTemperature_SliderCreateTreatment).label, config.DIALYSATE_TEMPERATURE, "Parameter should be -> "+str(config.DIALYSATE_TEMPERATURE)) + test_custom_treatment_slider(names.o_PreTreatmentCreate_dialysateTemperatureSlider_Slider, 35, config.CREATE_TREATMENT_SLIDER_VALUES["dialysate_temperature"], config.DIALYSATE_TEMPERATURE) + test.endSection() + + #scroll the screen to the title rinseback flow rate + parameter_object = set_parameter_type(text = config.RINSEBACK_FLOW_RATE) + utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) + + set_arterial_low_and_high() + set_venous_low_and_high() + + test.startSection("verification of blood pressure measurement interval values") + test.compare(waitForObject(names.o_PreTreatmentCreate_bloodPressureMeasurementInterval_SliderCreateTreatment).label, config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL, "Parameter should be -> "+str(config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL)) + test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodPressureMeasurementIntervalSlider_Slider, 25, config.CREATE_TREATMENT_SLIDER_VALUES["blood_pressure_measurement_interval"], config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL) + + test.endSection() + + test.startSection("verification of rinseback flow rate values") + test.compare(waitForObject(names.o_PreTreatmentCreate_rinsebackFlowRate_SliderCreateTreatment).label, config.RINSEBACK_FLOW_RATE, "Parameter should be -> "+str(config.RINSEBACK_FLOW_RATE)) + test_custom_treatment_slider(names.o_PreTreatmentCreate_rinsebackFlowRateSlider_Slider, 50, config.CREATE_TREATMENT_SLIDER_VALUES["rinseback_flow_rate"], config.RINSEBACK_FLOW_RATE) + test.endSection() + + test.endSection() + +def set_venous_low_and_high(): + """ + Method to set the venous low and high limits using slider + """ + test.startSection("Set the venous low and high limits using slider") + utility.set_venous_ranges_min_val(ven_low) + utility.set_venous_ranges_max_val(ven_high) + + test.endSection() + +def set_arterial_low_and_high(): + """ + Method to set the arterial low and high limits using slider + """ + test.startSection("Set the arterial low and high limits using slider") + utility.set_arterial_ranges_max_val(art_high) + utility.set_arterial_ranges_min_val(art_low) + + test.endSection() + +def verify_vital_entries_in_main_treatment_screen(sys_val, dia_val, heart_rate): + """ + 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)) + utility.erase_entered_value(names.o_PreTreatmentBase_input_TextInput_2) + utility.enter_keypad_value_bphr(sys_val) + + test.verify(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry).enabled, "systolic combo box should be enabled.") + test.compare(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureSystolic_TextEntry).text, str(sys_val), "systolic value should be : "+str(sys_val)) + verify_color_of_entry(entry = sys_val, vital_parameter = config.SYSTOLIC_TEXT, input_field = waitForObject(names.o_PreTreatmentBase_input_TextInput_2)) + + + mouseClick(waitForObject(names.o_PreTreatmentBase_input_TextInput_3)) + utility.erase_entered_value(names.o_PreTreatmentBase_input_TextInput_3) + utility.enter_keypad_value_bphr(dia_val) + + test.verify(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureDiastolic_TextEntry).enabled, "diastolic value should be enabled.") + test.compare(waitForObjectExists(names.o_PreTreatmentBase_bloodPressureDiastolic_TextEntry).text, str(dia_val), "diastolic value should be : "+str(dia_val)) + verify_color_of_entry(entry = dia_val, vital_parameter = config.DIASTOLIC_TEXT, input_field = waitForObject(names.o_PreTreatmentBase_input_TextInput_3)) + + + mouseClick(waitForObject(names.o_PreTreatmentBase_input_TextInput_4)) + utility.erase_entered_value(names.o_PreTreatmentBase_input_TextInput_4) + utility.enter_keypad_value_bphr(heart_rate) + + test.verify(waitForObjectExists(names.o_PreTreatmentBase_heartRate_TextEntry).enabled, "diastolic value should be enabled.") + test.compare(waitForObjectExists(names.o_PreTreatmentBase_heartRate_TextEntry).text, str(heart_rate), "diastolic value should be : "+str(dia_val)) + verify_color_of_entry(entry = heart_rate, vital_parameter = config.HEART_RATE_TITLE, input_field = waitForObject(names.o_PreTreatmentBase_input_TextInput_4)) + + test.endSection() + +def verify_entered_vitals_in_patient_connection_screen(): + """ + 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.BLOOD_PRESSURE_TITLE, "BP title text should be :" + str(config.BLOOD_PRESSURE_TITLE)) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_mmHg_Label).text, config.BLOOD_PRESSURE_UNIT, "BP unit should be " + str(config.BLOOD_PRESSURE_UNIT)) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_Heart_Rate_Text).text, config.HEART_RATE_TITLE, "HR text should be :" + str(config.HEART_RATE_TITLE)) + test.compare(waitForObjectExists(names.o_PreTreatmentBase_BPM_Label).text, config.HEART_RATE_UNIT, "BP unit should be " + str(config.HEART_RATE_UNIT)) + + verify_vital_entries_in_main_treatment_screen(sys_val=config.SYSTOLIC_PRESSSURE_175, dia_val=config.DIASTOLIC_PRESSSURE_74, heart_rate=config.HEART_RATE_VAL_85) + test.verify(waitForObjectExists(names.o_PreTreatmentBase_CONFIRM_Text_2).enabled, "Confirm button is enabled.") + mouseClick(waitForObject(names.o_PreTreatmentBase_CONFIRM_Text_2)) + + reset_bp_hr_in_main_treatment() + test.endSection() + +def set_venous_high_and_low_limits_using_slider(): + """ + Method to set the venous low and high limits using slider + """ + test.startSection("Set the venous low and high limits using slider") + utils.waitForGUI(1) + for venous_value in range(config.VENOUS_VALUE_50, config.VENOUS_VALUE_600, config.POSITIVE_BUFFER): + utility.set_venous_ranges_max_val(venous_value) + for venous_value in range(config.VENOUS_VALUE_20, config.VENOUS_VALUE_570, config.POSITIVE_BUFFER): + utility.set_venous_ranges_min_val(venous_value) + + test.endSection() + +def set_arterial_high_and_low_limits_using_slider(): + """ + Method to set the arterial low and high limits using slider + """ + test.startSection("Set the arterial low and high limits using slider") + utils.waitForGUI(1) + utility.set_arterial_ranges_min_val(config.ARTERIAL_VALUE_NEGATIVE_300) + for arterial_value in range(config.ARTERIAL_VALUE_0, config.ARTERIAL_VALUE_NEGATIVE_270, config.NEGATIVE_BUFFER): + utility.set_arterial_ranges_max_val(arterial_value) + + test.endSection() def verify_last_read_time(saved_time): """ method to verify the last read of blood pressure and heart rate @param saved_time: (str) time of saving blood pressure and heart rate """ + test.startSection("Verify the last read of blood pressure and heart rate") expected_last_read = "Interval: off , Last Read: {}".format(saved_time) last_read = waitForObject(vitals_reading_obj(expected_last_read)) last_read = str(last_read.text) test.compare(last_read, expected_last_read, "Last read time should be {}".format(last_read)) test.endSection() - - + +def drag_and_drop_ultrafiltration_slider(slider_value = 0, maximum_ultrafiltration = 0): + """ + Tests to verify ultrafiltration slider range + @param slider_value: (int) value of the slider to set. + """ + slider_buffer = (config.UF_MAXIMUM_SLIDER_WIDTH/(maximum_ultrafiltration/100)) * slider_value + slider_width = slider_buffer + config.UF_MINIMUM_SLIDER_WIDTH + mouseClick(waitForObject(names.o_PreTreatmentUltrafiltration_volumeSlider_Slider), slider_width , 3, Qt.LeftButton) + + utils.waitForGUI(0.1) + + +def verify_interval_for_bpm(): + """ + Method to set all parameters in create custom treatment + and navigate to patient connection screen and set bp/hr + navigate to main treatment screen to reset vitals + """ + test.startSection("Setting all parameters in create custom treatment, navigating to patient connection and set bp/hr, navigate to main treatment and reset vitals") + hd_simulator.cmd_send_hd_operation_mode(op_mode = HDOpModes.MODE_TPAR.value , sub_mode = HDOpSubModes.SUBMODE_START.value) + mouseClick(waitForObject(names.o_input_patient_id)) + test.log("Entering patient_id") + type(waitForObject(names.o_input_patient_id), "Alberto") + mouseClick(waitForObject(names.o_confirm_button)) + verify_create_custom_treatment_parameter() + verify_request_continue_mode() + + utils.waitForGUI(0.5) + hd_simulator.cmd_initiate_treatment_response(response = 1, reason =0) + hd_simulator.cmd_send_hd_operation_mode(op_mode = HDOpModes.MODE_PRET.value , sub_mode = HDOpSubModes.SUBMODE_START.value) + test.log("Navigating to Patient connection screen") + hd_simulator.cmd_send_pre_treatment_state_data(sub_mode=PreTreatmentSubModes.HD_PRE_TREATMENT_PATIENT_CONNECTION_STATE.value, water_sample_state=PreTreatmentSampleWaterStates.SAMPLE_WATER_SETUP_STATE.value,consumables_self_test_state=PreTreatmentConsumableSelfTestStates.CONSUMABLE_SELF_TESTS_INSTALL_STATE.value, + no_cartridge_self_test_state=PreTreatmentNoCartSelfTestsStates.NO_CART_SELF_TESTS_START_STATE.value,installation_state=PreTreatmentCartridgeInstallStates.CARTRIDGE_INSTALL_STATE.value, dry_self_test_state=PreTreatmentDrySelfTestsStates.DRY_SELF_TESTS_START_STATE.value, + prime_state=PreTreatmentPrimeStates.HD_PRIME_START_STATE.value,recirculate_state=PreTreatmentRecircStates.PRE_TREATMENT_RECIRC_STATE.value, patient_connection_state=PreTreatmentPatientConnectionStates.PATIENT_CONNECTION_STATE.value) + hd_simulator.cmd_send_uf_treatment_response(accepted =True, reason =0, volume = 300) + verify_entered_vitals_in_patient_connection_screen() + + utils.waitForGUI(0.5) + hd_simulator.cmd_send_hd_operation_mode(op_mode = 6 , sub_mode = 2) + utils.waitForGUI(1) + test.log("Navigating to main treatment screen") + hd_simulator.cmd_set_treatment_states_data(sub_mode = 1, uf_state= 0, saline_state=0, heparin_state= 0, + rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, + treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) + hd_simulator.cmd_set_treatment_states_data(sub_mode = 2, uf_state= 0, saline_state=0, heparin_state= 0, + rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, + treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) + + test.endSection() + +def reset_bp_hr_in_main_treatment(): + """ + Method to verify the blood pressure and heart from navigating + from main treatment to patient connection verifying the same + by navigating from patient connection to main treatment to reset + """ + test.startSection("Method to reset and verify the blood pressure and heart rate") + hd_simulator.cmd_send_hd_operation_mode(op_mode = 6 , sub_mode = 2) + utils.waitForGUI(1) + hd_simulator.cmd_set_treatment_states_data(sub_mode = 1, uf_state= 0, saline_state=0, heparin_state= 0, + rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, + treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) + hd_simulator.cmd_set_treatment_states_data(sub_mode = 2, uf_state= 0, saline_state=0, heparin_state= 0, + rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, + treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) + + test.endSection() + +def set_parameter_type(text): + """ + Method to set object property based on text + @param text : (string) treatment parameter text + """ + if isinstance(text, str): + names.o_operating_parameters["text"] = text + return names.o_operating_parameters + else: + test.log("Invalid \"text\": " +text+" for object.") + names.o_operating_parameters["text"] = None + +def test_custom_treatment_slider(slider_object, value, slider_parameter, parameter): + """ + Method to set slider handle based on custom values + @param slider_object : (dictionary) object of treatment parameters + @param vale : (int)value to be set on slider + @param slider_parameter : (list) consist combination of slider minimum value, slider buffer and width buffer + @param parameter : (str) parameter name + """ + minimum_slider_value = slider_parameter[0] + slider_buffer = slider_parameter[1] + width_buffer = slider_parameter[2] + slider_width = ((value - minimum_slider_value)/slider_buffer) * width_buffer + utils.waitForGUI(0.3) + mouseClick(findObject(slider_object), float(slider_width) , 3, Qt.LeftButton) + test.compare(waitForObjectExists(slider_object).value, value, str(parameter)+" slider value should set to"+str(value)) + 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 """ + test.startSection("Verify the user entered {} value {} in main-treatment screen".format(vital, value)) if save: input_field = waitForObject(vitals_reading_obj(value)) @@ -269,49 +680,45 @@ 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() + saved_time = get_current_date_and_time(date_format='%Y/%b/%d - %H:%M') 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(): utils.tstStart(__file__) startApplication(AUT_NAME) - hd_simulator.cmd_send_power_on_self_test_version_request() + hd_simulator.cmd_set_treatment_states_data(sub_mode= 2, uf_state= 0, saline_state=0, heparin_state= 0, - rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, - treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) - - hd_simulator.cmd_set_treatment_parameter_ranges(min_treatment_duration=0, max_treatment_duration=480, - min_uf_volume=0.0, max_uf_volume=8000.0, - min_dialysate_flow_rate=100, max_dialysate_flow_rate=600) - + rinseback_state= 0, recirculate_state= 0, blood_prime_state= 0, + treatment_end_state=0, treatment_stop_state= 0, dialysis_state=0) + utils.waitForGUI(1) 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(1) - + open_vitals_pop_up() verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_120, input_field=names.o_pop_up_systolic_input_field, @@ -327,6 +734,7 @@ heart_rate=HEART_RATE_VAL_85, save=False) utils.waitForGUI(1) + open_vitals_pop_up() verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_175, input_field=names.o_pop_up_systolic_input_field, @@ -342,6 +750,7 @@ heart_rate=HEART_RATE_VAL_70, save=True) utils.waitForGUI(1) + open_vitals_pop_up() verify_entered_value_in_pop_up(value=SYSTOLIC_PRESSSURE_113, input_field=names.o_pop_up_systolic_input_field, @@ -357,13 +766,16 @@ heart_rate=HEART_RATE_VAL_60, save=False) utils.waitForGUI(1) + 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) - + 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) - utils.tstDone() + verify_interval_for_bpm() + + utils.tstDone() \ No newline at end of file