Index: suite_leahi/tst_Headerbar_Prescription/test.py =================================================================== diff -u -r5262e5d8ab63730fc628ebb6a9059bcdccfe2e09 -ra9f09c063531da4405d18dbb5b25023e39ba7497 --- suite_leahi/tst_Headerbar_Prescription/test.py (.../test.py) (revision 5262e5d8ab63730fc628ebb6a9059bcdccfe2e09) +++ suite_leahi/tst_Headerbar_Prescription/test.py (.../test.py) (revision a9f09c063531da4405d18dbb5b25023e39ba7497) @@ -56,23 +56,23 @@ BICARBONATE_CONCENTRATE_TITLE = "Bicarbonate Concentrate" DIALYZER_TYPE_TITLE = "Dialyzer Type" -ACID_CONCENTRATE = ["0.0 K, 0.00 Ca, 1 Mg", "3.0 K, 2.5 Ca, 1 Mg","2.0 K, 2.5 Ca, 1 Mg","1.0 K, 2.5 Ca, 1 Mg"] +ACID_CONCENTRATE = ["2.0 K, 2.00 Ca, 1 Mg", "1.0 K, 2.50 Ca, 1 Mg","2.0 K, 2.50 Ca, 1 Mg","3.0 K, 2.50 Ca, 1 Mg"] DIALYZER_TYPE = ["Diacap Pro 13H", "Diacap Pro 16H", "Diacap Pro 19H", "Optiflux F160NRe", "Optiflux F180NRe", "Optiflux F200NRe","Optiflux F250NRe"] CREATE_TREATMENT_PARAMETERS = ["Blood Flow Rate", "Dialysate Flow Rate", "Duration", "Heparin Bolus Volume", "Heparin Dispensing Rate", "Heparin Stop Time", "Acid Concentrate", "Bicarbonate Concentrate", - "Dialyzer Type", "Dialysate Temperature", - "Saline Bolus Volume", "BP Measurement Interval"] + "Dialyzer Type", "Dialysate Temperature" + ] CREATE_TREATEMENT_OBJ =[names.o_bloodFlowRate_LabelUnitContainer ,names.o_dialysateFlowRate_LabelUnitContainer, names.o_duration_LabelUnitContainer ,names.o_heparinBolusVolume_LabelUnitContainer, names.o_heparinDispensingRate_LabelUnitContainer ,names.o_heparinStopTime_LabelUnitContainer, names.o_acidConcentrate_LabelUnitContainer ,names.o_bicarbonateConcentrate_LabelUnitContainer, names.o_dialyzerType_LabelUnitContainer ,names.o_dialysateTemperature_LabelUnitContainer, - names.o_salineBolusVolume_LabelUnitContainer ,names.o_bpMeasurementInterval_LabelUnitContainer ] + names.o_salineBolusVolume_LabelUnitContainer ] CREATE_TREATMENT_PARAMETER = { "Blood Flow Rate" : [60.0], @@ -87,109 +87,96 @@ "Rinseback Flow Rate" : [75], } COLOR_CODES = "#ffa500" -BUTTON_TYPE =["Select Rx","Edit Rx","Clear All"] +BUTTON_TYPE = ["Edit Rx","Select Rx","Clear All"] +VITALS = ["OFF","5","10","15","20","30","60"] +BICARBONATE = ["Sodium Bicarbonate"] +VALIDATE = "VALIDATE" +CONFIRM = "CONFIRM" td =TD_Messaging() -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.keyboard_input["text"] = text - return names.keyboard_input - else: - test.log("Invalid ",text," for object.") - names.o_keyboard_input["text"] = "Q" +# 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.keyboard_input["text"] = text +# return names.keyboard_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(KEYBOARD_SWITCH[1])) +# if object_status is True: +# keyboard_value = keyboard_object_map_helper(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(KEYBOARD_SWITCH[0])) +# if object_status is True: +# keyboard_value = keyboard_object_map_helper(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.keyboard_switch2) +# if object_status is True: +# keyboard_value = waitForObject(names.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.keyboard_switch) +# if object_status is True: +# keyboard_value = waitForObject(names.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 verify_valid_patient_id_through_keypad(expected_value, actual_value): +# """ +# Tests verifies valid patient id set through application keyboard setup . +# @return: N/A +# """ +# patient_id_input = waitForObject(names.o_PatientIDEntry_TextEntry) +# mouseClick(names.o_PatientIDEntry_TextEntry) +# for text in expected_value: +# keyword_state = keyboard_switching_section(text) +# if keyword_state is not None: +# keyboard_value = keyboard_object_map_helper(keyword_state) +# mouseClick(waitForObject(keyboard_value)) +# utils.waitForGUI(.2) +# +# test.compare(actual_value, (patient_id_input.text), "Patient id should be -> "+ str(actual_value)) +# test.log("User successfully authenticated through patient id -> " + expected_value + "using keypad.") -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(KEYBOARD_SWITCH[1])) - if object_status is True: - keyboard_value = keyboard_object_map_helper(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(KEYBOARD_SWITCH[0])) - if object_status is True: - keyboard_value = keyboard_object_map_helper(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.keyboard_switch2) - if object_status is True: - keyboard_value = waitForObject(names.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.keyboard_switch) - if object_status is True: - keyboard_value = waitForObject(names.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 verify_valid_patient_id_through_keypad(expected_value, actual_value): - """ - Tests verifies valid patient id set through application keyboard setup . - @return: N/A - """ - patient_id_input = waitForObject(names.o_PatientIDEntry_TextEntry) - mouseClick(names.o_PatientIDEntry_TextEntry) - for text in expected_value: - keyword_state = keyboard_switching_section(text) - if keyword_state is not None: - keyboard_value = keyboard_object_map_helper(keyword_state) - mouseClick(waitForObject(keyboard_value)) - utils.waitForGUI(.2) - - test.compare(actual_value, (patient_id_input.text), "Patient id should be -> "+ str(actual_value)) - test.log("User successfully authenticated through patient id -> " + expected_value + "using keypad.") - -def custom_object_for_combo_box(text): - """ - Method to set custom object property for export option - @param text : (string) parameter text - """ - names.o_option_combo_box["text"] = text - return names.o_option_combo_box - -def select_different_dropdown(object,type,whichTypeIndex): - type_combo_box = utility.get_object_from_names(object, error_message="Combo box object is missing") - if type_combo_box is not None: - mouseClick(waitForObjectExists(object)) - - type_option = utility.get_object_from_names(custom_object_for_combo_box(type[whichTypeIndex]),error_message=f"Option {DIALYZER_TYPE[whichTypeIndex]} object is missing",timeout_ms=5000) - if type_option is not None: - mouseClick(type_option) - return True - return False # default return if not successful - def verify_create_custom_treatment_parameter(): """ Method to set create custom treatment value @@ -200,102 +187,169 @@ test.startSection("Verification of blood flow values") test.compare(waitForObject(names.o_bloodFlowRate_LabelUnitContainer).text, BLOOD_FLOW_RATE, "Parameter should be -> "+str(BLOOD_FLOW_RATE)) for blood_flow_rate in CREATE_TREATMENT_PARAMETER_RANGE[BLOOD_FLOW_RATE]: - set_value_based_on_target(names.o_bloodFlowRateControl_ValueAdjuster, blood_flow_rate) + utility.set_value_based_on_target(names.o_bloodFlowRateControl_ValueAdjuster, blood_flow_rate) test.endSection() test.startSection("Verification of dialysate flow values") test.compare(waitForObject(names.o_dialysateFlowRate_LabelUnitContainer).text, DIALYSATE_FLOW_RATE, "Parameter should be -> "+str(DIALYSATE_FLOW_RATE)) for dialysate_flow_rate in CREATE_TREATMENT_PARAMETER_RANGE[DIALYSATE_FLOW_RATE]: - set_value_based_on_target(names.o_dialysateFlowRateControl_ValueAdjuster, dialysate_flow_rate) + utility.set_value_based_on_target(names.o_dialysateFlowRateControl_ValueAdjuster, dialysate_flow_rate) test.endSection() test.startSection("Verification of duration values") test.compare(waitForObject(names.o_duration_LabelUnitContainer).text, DURATION, "Parameter should be -> "+str(DURATION)) for duration in CREATE_TREATMENT_PARAMETER_RANGE[DURATION]: - set_value_based_on_target(names.o_durationControl_ValueAdjuster, duration) + utility.set_value_based_on_target(names.o_durationControl_ValueAdjuster, duration) test.endSection() test.startSection("Verification of heparin bolus volume values") test.compare(waitForObject(names.o_heparinBolusVolume_LabelUnitContainer).text, HEPARIN_BOLUS_VOLUME, "Parameter should be -> "+str(HEPARIN_BOLUS_VOLUME)) mouseClick(waitForObject(names.o_heparinBolusVolumeControl_ValueAdjuster)) test.compare(OFF_TEXT, waitForObject(names.o_heparinBolusVolume_oFF_Text).text, "OFF text should be enabled") for heparin_bolus_volume in CREATE_TREATMENT_PARAMETER_RANGE[HEPARIN_BOLUS_VOLUME]: - set_value_based_on_target(names.o_heparinBolusVolumeControl_ValueAdjuster, heparin_bolus_volume) + utility.set_value_based_on_target(names.o_heparinBolusVolumeControl_ValueAdjuster, heparin_bolus_volume) test.endSection() test.startSection("Verification of heparin dispensing rate values") test.compare(waitForObject(names.o_heparinDispensingRate_LabelUnitContainer).text, HEPARIN_DISPENSING_RATE, "Parameter should be -> "+str(HEPARIN_DISPENSING_RATE)) mouseClick(waitForObject(names.o_heparinDispensingRateControl_ValueAdjuster)) test.compare(OFF_TEXT, waitForObject(names.o_heparinDispensingRateControl_OffText).text, "OFF text should be enabled") for heparin_dispensing_rate in CREATE_TREATMENT_PARAMETER_RANGE[HEPARIN_DISPENSING_RATE]: - set_value_based_on_target(names.o_heparinDispensingRateControl_ValueAdjuster, heparin_dispensing_rate) + utility.set_value_based_on_target(names.o_heparinDispensingRateControl_ValueAdjuster, heparin_dispensing_rate) test.endSection() test.startSection("Verification of heparin stop time values") - set_value_based_on_target(names.o_heparinDispensingRateControl_ValueAdjuster, "0.2") - set_value_based_on_target(names.o_durationControl_ValueAdjuster, "480") + #1. Change Duration -> Verify Heparin Stop Time "active" property is set to off + utility.set_value_based_on_target(names.o_durationControl_ValueAdjuster, 60) + utility.set_value_based_on_target(names.o_heparinBolusVolumeControl_ValueAdjuster, 0.4) + utility.set_value_based_on_target(names.o_heparinDispensingRateControl_ValueAdjuster, 0.3) + utility.set_value_based_on_target(names.o_heparinStopTimeControl_ValueAdjuster, 60) + utility.set_value_based_on_target(names.o_durationControl_ValueAdjuster, 75) + heprain_Stop_time = waitForObject(names.o_heparinStopTimeControl_ValueAdjuster) + test.compare(heprain_Stop_time.isActive,False, "Heprain stop time active property is set to False") + + # 2. Change Heparin Dispensising Rate from 0.2 to OFF -> Verify Heparing Stop Time is set to OFF + utility.set_value_based_on_target(names.o_durationControl_ValueAdjuster, 60) + utility.set_value_based_on_target(names.o_heparinBolusVolumeControl_ValueAdjuster, 0.4) + utility.set_value_based_on_target(names.o_heparinDispensingRateControl_ValueAdjuster, 0.3) + utility.set_value_based_on_target(names.o_heparinStopTimeControl_ValueAdjuster, 60) + utility.click_left_until_off(names.o_heparinDispensingRateControl_ValueAdjuster) + test.compare(waitForObjectExists(names.o_heparinStopTime_OFF_Text).text,"OFF") + + # 3. Change Heparin Dispensising Rate from OFF to 0.2 -> Verify Heparin Stop Time "active" property is set to off + utility.set_value_based_on_target(o_heparinDispensingRateControl_ValueAdjuster, 0.2) + test.compare(waitForObjectExists(names.o_heparinStopTime_OFF_Text).text,"-- --") + heprain_Stop_time = waitForObject(names.o_heparinStopTimeControl_ValueAdjuster) + test.compare(heprain_Stop_time.isActive,False, "Heprain stop time active property is set to False") + + # 4. When Duration is set to a value -> Verify the max Heparin Stop Time is the Duration value that is set + utility.set_value_based_on_target(names.o_durationControl_ValueAdjuster, 90) + utility.set_value_based_on_target(names.o_heparinStopTimeControl_ValueAdjuster, 90) + test.compare(waitForObjectExists(names.o_heparinStopTimeControl_ValueAdjuster).value,90.0) + obj = waitForObject(names.o_heparinStopTimeControl_ValueAdjuster) + right_arrow =utility.findObjectById(obj ,"_rightArrow") + test.compare(not right_arrow.enabled, True, "Right arrow is disabled in Heparin stop time field") + + utility.set_value_based_on_target(names.o_heparinDispensingRateControl_ValueAdjuster, "0.2") + utility.set_value_based_on_target(names.o_durationControl_ValueAdjuster, "480") test.compare(waitForObject(names.o_heparinStopTime_LabelUnitContainer).text, HEPARIN_STOP_TIME, "Parameter should be -> "+str(HEPARIN_STOP_TIME)) for heparin_stop_time in CREATE_TREATMENT_PARAMETER_RANGE[HEPARIN_STOP_TIME]: - set_value_based_on_target(names.o_heparinStopTimeControl_ValueAdjuster, heparin_stop_time) + utility.set_value_based_on_target(names.o_heparinStopTimeControl_ValueAdjuster, heparin_stop_time) test.endSection() test.startSection("Verification of Dialysate Temperature") test.compare(waitForObject(names.o_dialysateTemperature_LabelUnitContainer).text,DIALYSATE_TEMPERATURE , "Parameter should be -> "+str(DIALYSATE_TEMPERATURE)) for dialysate_temperature in CREATE_TREATMENT_PARAMETER_RANGE[DIALYSATE_TEMPERATURE]: - set_value_based_on_target(names.o_dialysateTemperatureControl_ValueAdjuster,dialysate_temperature) + utility.set_value_based_on_target(names.o_dialysateTemperatureControl_ValueAdjuster,dialysate_temperature) test.endSection() test.startSection("Verification of saline bolus values") test.compare(waitForObject(names.o_salineBolusVolume_LabelUnitContainer).text, SALINE_BOLUS_VOLUME, "Parameter should be -> "+str(SALINE_BOLUS_VOLUME)) for saline_bolus in CREATE_TREATMENT_PARAMETER_RANGE[SALINE_BOLUS_VOLUME]: - set_value_based_on_target(names.o_salineBolusVolumeControl_ValueAdjuster, saline_bolus) + utility.set_value_based_on_target(names.o_salineBolusVolumeControl_ValueAdjuster, saline_bolus) test.endSection() - test.startSection("Verification of BP Measurement Interval") - test.compare(waitForObject(names.o_bpMeasurementInterval_LabelUnitContainer).text, BLOOD_PRESSURE_MEASUREMENT_INTERVAL, "Parameter should be -> "+str(BLOOD_PRESSURE_MEASUREMENT_INTERVAL)) - for bp_measurement_interval in CREATE_TREATMENT_PARAMETER_RANGE[BLOOD_PRESSURE_MEASUREMENT_INTERVAL]: - set_value_based_on_target(names.o_bpMeasurementIntervalControl_ValueAdjuster,bp_measurement_interval) - test.endSection() + # test.startSection("Verification of BP Measurement Interval") + # test.compare(waitForObject(names.o_bpMeasurementInterval_LabelUnitContainer).text, BLOOD_PRESSURE_MEASUREMENT_INTERVAL, "Parameter should be -> "+str(BLOOD_PRESSURE_MEASUREMENT_INTERVAL)) + # for bp_measurement_interval in CREATE_TREATMENT_PARAMETER_RANGE[BLOOD_PRESSURE_MEASUREMENT_INTERVAL]: + # utility.set_value_based_on_target(names.o_bpMeasurementIntervalControl_ValueAdjuster,bp_measurement_interval) + # test.endSection() test.startSection("Verification of Bicarbonate Value") test.compare(waitForObject(names.o_bicarbonateConcentrate_LabelUnitContainer).text, BICARBONATE_CONCENTRATE_TITLE, "Parameter should be -> "+str(BICARBONATE_CONCENTRATE_TITLE)) - select_different_dropdown(names.o_bicarbonateConcentrateComboBox_BaseComboBox,BICARBONATE_CONCENTRATE_TITLE,0) - test.compare(waitForObject(names.o_bicarbonateConcentrateComboBox_BaseComboBox).currentText, "Sodium Bicarbonate", " Biconcentrate value should be :"+str("Sodium Bicarbonate")) + utility.select_different_dropdown(names.o_bicarbonateConcentrateComboBox_BaseComboBox,BICARBONATE,0) + test.compare(waitForObject(names.o_bicarbonateConcentrateComboBox_BaseComboBox).currentText, BICARBONATE[0], " Bicarbonate value should be :"+str(BICARBONATE[0])) test.startSection("Verification of acid concentrate type") test.compare(waitForObject(names.o_acidConcentrate_LabelUnitContainer).text, ACID_CONCENTRATE_TITLE, "Parameter should be -> "+str(ACID_CONCENTRATE_TITLE)) mouseClick(waitForObject(names.o_editImage)) mouseClick(waitForObject(names.o_potassium_leftIconButton)) mouseClick(waitForObject(names.o_calcium_leftIconButton)) mouseClick(waitForObject(names.o_save_button)) - select_different_dropdown(names.o_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,0) + utility.select_different_dropdown(names.o_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,0) test.compare(waitForObject(names.o_acidConcentrateComboBox_BaseComboBox).currentText, ACID_CONCENTRATE[0], "Acid concentrate value should be :"+str(ACID_CONCENTRATE[0])) - select_different_dropdown(names.o_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,1) + utility.select_different_dropdown(names.o_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,1) test.compare(waitForObject(names.o_acidConcentrateComboBox_BaseComboBox).currentText, ACID_CONCENTRATE[1], "Acid concentrate value should be :"+str(ACID_CONCENTRATE[1])) - select_different_dropdown(names.o_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,2) + utility.select_different_dropdown(names.o_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,2) test.compare(waitForObject(names.o_acidConcentrateComboBox_BaseComboBox).currentText, ACID_CONCENTRATE[2], "Acid concentrate value should be :"+str(ACID_CONCENTRATE[2])) - select_different_dropdown(names.o_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,3) + utility.select_different_dropdown(names.o_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,3) test.compare(waitForObject(names.o_acidConcentrateComboBox_BaseComboBox).currentText, ACID_CONCENTRATE[3], "Acid concentrate value should be :"+str(ACID_CONCENTRATE[3])) test.endSection() test.startSection("Verification of dialyzer type") test.compare(waitForObject(names.o_dialyzerType_LabelUnitContainer).text, DIALYZER_TYPE_TITLE, "Parameter should be -> "+str(DIALYZER_TYPE_TITLE)) - select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,0) + utility.select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,0) test.compare(waitForObject(names.o_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[0], "Dialyzer type value should be :"+str(DIALYZER_TYPE[0])) - select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,1) + utility.select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,1) test.compare(waitForObject(names.o_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[1], "Dialyzer type value should be :"+str(DIALYZER_TYPE[1])) - select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,2) + utility.select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,2) test.compare(waitForObject(names.o_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[2], "Dialyzer type value should be :"+str(DIALYZER_TYPE[2])) - select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,3) + utility.select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,3) test.compare(waitForObject(names.o_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[3], "Dialyzer type value should be :"+str(DIALYZER_TYPE[3])) - select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,4) + utility.select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,4) test.compare(waitForObject(names.o_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[4], "Dialyzer type value should be :"+str(DIALYZER_TYPE[4])) - select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,5) + utility.select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,5) test.compare(waitForObject(names.o_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[5], "Dialyzer type value should be :"+str(DIALYZER_TYPE[5])) - select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,6) + utility.select_different_dropdown(names.o_dialyzerTypeComboBox_BaseComboBox,DIALYZER_TYPE,6) test.compare(waitForObject(names.o_dialyzerTypeComboBox_BaseComboBox).currentText, DIALYZER_TYPE[6], "Dialyzer type value should be :"+str(DIALYZER_TYPE[6])) test.endSection() + utility.select_different_dropdown(names.o_vitalsCombobox_BaseCombobox,VITALS,2) + + # td.td_Treatment_Parameters_Validation( vAccepted = 1, + # vBloodFlowRateRejectReason = 0, + # vDialysateFlowRateRejectReason = 0, + # vTreatmentDurationRejectReason = 0, + # vSalineBolusVolumeRejectReason = 0, + # vHeparinStopTimeRejectReason = 0, + # vHeparinTypeRejectReason = 0, + # vAcidConcentrateRejectReason = 0, + # vBicarbonateConcentrateRejectReason = 0, + # vDialyzerTypeRejectReason = 0, + # vBloodPressureMeasureIntervalRejectReason = 0, + # vRinsebackFlowRateRejectReason = 0, + # vRinsebackVolumeRejectReason = 0, + # vArterialPressureLimitWindowRejectReason = 0, + # vVenousPressureLimitWindowRejectReason = 0, + # vVenousPressureLimitAsymtrcRejectReason = 0, + # vTrancembrncPressureLimitWindowRejectReason = 0, + # vDialysateTempRejectReason = 0, + # vHeparinDispensingRateRejectReason = 0, + # vHeparinBolusVolumeRejectReason = 0 + # ) + # + # test.verify(waitForObjectExists(names.o_qrCode_Image), "QR Code is visible") + # confirmButton = waitForObject(names.o_confirmButton_ConfirmButton) + # test.compare(confirmButton.enabled, True, "Confirm button is enabled") + # mouseClick(waitForObjectExists(names.o_confirmButton_ConfirmButton)) + # test.log("Confirm button is Enabled") + + validateButton = waitForObject(names.o_PreTreatmentButton) + #Check the button text + validateText = waitForObject(utility.button_text_obj(VALIDATE)) + test.compare(validateText.text, VALIDATE, "Button text should be"+str(VALIDATE)) + test.compare(validateButton.enabled, True, "Validate button is enabled") + mouseClick(waitForObject(validateButton)) td.td_Treatment_Parameters_Validation( vAccepted = 1, vBloodFlowRateRejectReason = 0, vDialysateFlowRateRejectReason = 0, @@ -317,76 +371,16 @@ vHeparinDispensingRateRejectReason = 0, vHeparinBolusVolumeRejectReason = 0 ) - utils.waitForGUI(3) - test.verify(waitForObjectExists(names.o_qrCode_Image), "QR Code is visible") - confirmButton = waitForObject(names.o_confirmButton_ConfirmButton) + test.compare(waitForObjectExists(names.o_qrCode_Image).visible, True,"QR Code is visible") + #Check the confirm button text and perform the mouse click + confirmButton = waitForObject(names.o_PreTreatmentButton) + confirmText = waitForObject(utility.button_text_obj(CONFIRM)) + test.compare(confirmText.text, CONFIRM, "Button text should be"+str(CONFIRM)) test.compare(confirmButton.enabled, True, "Confirm button is enabled") - mouseClick(waitForObjectExists(names.o_confirmButton_ConfirmButton)) - test.log("Confirm button is Enabled") - + mouseClick(waitForObject(confirmButton)) test.endSection() -def findObjectById(parent, id): - """ - Recursively searches for a child object by its id. - Returns the found object or None if not found. - """ - if str(parent.id) == id: - return parent - - for child in object.children(parent): - found = findObjectById(child, id) - if found: - return found - - return None - -def set_value_based_on_target(obj, target_value): - """ - obj: dictionary containing object paths - Example: - { - "value_obj": ":mainTreatmentScreen.PressureText", - "left_arrow": ":mainTreatmentScreen.LeftArrow", - "right_arrow": ":mainTreatmentScreen.RightArrow" - } - - target_value: integer or string number, e.g. 220 - """ - target_value = target_value - - # Wait for all objects - parent_obj = waitForObjectExists(obj) - # change range as per your screen count - - left_arrow = findObjectById(parent_obj, "_leftArrow") - right_arrow =findObjectById(parent_obj, "_rightArrow") - - # Read current value (supports invisible text too) - try: - current_value = round(float(findObject(obj).value),1) - except LookupError: - current_value = float(findObject(obj).property("value")) - - # Determine direction - while current_value != float(target_value): - if current_value < float(target_value): - mouseClick(waitForObject(right_arrow)) - - elif current_value > float(target_value): - mouseClick(waitForObject(left_arrow)) - # Update current value after click - try: - current_value = round(float(findObject(obj).value),1) - except Exception: - current_value = float(findObject(obj).property("value")) - - test.log(f"Updated value: {current_value}") - - test.log(f"Target value reached: {current_value}") - - def verify_editRx_Button(): test.startSection("Verify the edit button functionality") td.td_operation_mode(TDOpModes.MODE_STAN.value) @@ -414,62 +408,62 @@ vHeparinBolusVolumeRejectReason = 0 ) - utils.waitForGUI(3) - mouseClick(waitForObjectExists(names.o_prescriptionMenu_BaseComboBox)) - utils.waitForGUI(10) - select_different_dropdown(names.o_prescriptionMenu_BaseComboBox,BUTTON_TYPE,1) + + # mouseClick(waitForObjectExists(names.o_prescriptionMenu_BaseComboBox)) + utils.waitForGUI(0.5) + utility.select_different_dropdown(names.o_prescriptionMenu_BaseComboBox,BUTTON_TYPE,0) test.startSection("Verification of blood flow values") test.compare(waitForObject(names.o_bloodFlowRate_LabelUnitContainer).text, BLOOD_FLOW_RATE, "Parameter should be -> "+str(BLOOD_FLOW_RATE)) for blood_flow_rate in CREATE_TREATMENT_PARAMETER[BLOOD_FLOW_RATE]: - set_value_based_on_target(names.o_bloodFlowRateControl_ValueAdjuster, blood_flow_rate) + utility.set_value_based_on_target(names.o_bloodFlowRateControl_ValueAdjuster, blood_flow_rate) test.endSection() test.startSection("Verification of dialysate flow values") test.compare(waitForObject(names.o_dialysateFlowRate_LabelUnitContainer).text, DIALYSATE_FLOW_RATE, "Parameter should be -> "+str(DIALYSATE_FLOW_RATE)) for dialysate_flow_rate in CREATE_TREATMENT_PARAMETER[DIALYSATE_FLOW_RATE]: - set_value_based_on_target(names.o_dialysateFlowRateControl_ValueAdjuster, dialysate_flow_rate) + utility.set_value_based_on_target(names.o_dialysateFlowRateControl_ValueAdjuster, dialysate_flow_rate) test.endSection() test.startSection("Verification of duration values") test.compare(waitForObject(names.o_duration_LabelUnitContainer).text, DURATION, "Parameter should be -> "+str(DURATION)) for duration in CREATE_TREATMENT_PARAMETER[DURATION]: - set_value_based_on_target(names.o_durationControl_ValueAdjuster, duration) + utility.set_value_based_on_target(names.o_durationControl_ValueAdjuster, duration) test.endSection() test.startSection("Verification of heparin bolus volume values") test.compare(waitForObject(names.o_heparinBolusVolume_LabelUnitContainer).text, HEPARIN_BOLUS_VOLUME, "Parameter should be -> "+str(HEPARIN_BOLUS_VOLUME)) mouseClick(waitForObject(names.o_heparinBolusVolumeControl_ValueAdjuster)) test.compare(OFF_TEXT, waitForObject(names.o_heparinBolusVolume_oFF_Text).text, "OFF text should be enabled") for heparin_bolus_volume in CREATE_TREATMENT_PARAMETER[HEPARIN_BOLUS_VOLUME]: - set_value_based_on_target(names.o_heparinBolusVolumeControl_ValueAdjuster, heparin_bolus_volume) + utility.set_value_based_on_target(names.o_heparinBolusVolumeControl_ValueAdjuster, heparin_bolus_volume) test.endSection() test.startSection("Verification of heparin dispensing rate values") test.compare(waitForObject(names.o_heparinDispensingRate_LabelUnitContainer).text, HEPARIN_DISPENSING_RATE, "Parameter should be -> "+str(HEPARIN_DISPENSING_RATE)) mouseClick(waitForObject(names.o_heparinDispensingRateControl_ValueAdjuster)) test.compare(OFF_TEXT, waitForObject(names.o_heparinDispensingRateControl_OffText).text, "OFF text should be enabled") for heparin_dispensing_rate in CREATE_TREATMENT_PARAMETER[HEPARIN_DISPENSING_RATE]: - set_value_based_on_target(names.o_heparinDispensingRateControl_ValueAdjuster, heparin_dispensing_rate) + utility.set_value_based_on_target(names.o_heparinDispensingRateControl_ValueAdjuster, heparin_dispensing_rate) test.endSection() test.startSection("Verification of Dialysate Temperature") test.compare(waitForObject(names.o_dialysateTemperature_LabelUnitContainer).text,DIALYSATE_TEMPERATURE , "Parameter should be -> "+str(DIALYSATE_TEMPERATURE)) for dialysate_temperature in CREATE_TREATMENT_PARAMETER[DIALYSATE_TEMPERATURE]: - set_value_based_on_target(names.o_dialysateTemperatureControl_ValueAdjuster,dialysate_temperature) + utility.set_value_based_on_target(names.o_dialysateTemperatureControl_ValueAdjuster,dialysate_temperature) test.endSection() test.startSection("Verification of saline bolus values") test.compare(waitForObject(names.o_salineBolusVolume_LabelUnitContainer).text, SALINE_BOLUS_VOLUME, "Parameter should be -> "+str(SALINE_BOLUS_VOLUME)) for saline_bolus in CREATE_TREATMENT_PARAMETER[SALINE_BOLUS_VOLUME]: - set_value_based_on_target(names.o_salineBolusVolumeControl_ValueAdjuster, saline_bolus) + utility.set_value_based_on_target(names.o_salineBolusVolumeControl_ValueAdjuster, saline_bolus) test.endSection() - test.startSection("Verification of BP Measurement Interval") - test.compare(waitForObject(names.o_bpMeasurementInterval_LabelUnitContainer).text, BLOOD_PRESSURE_MEASUREMENT_INTERVAL, "Parameter should be -> "+str(BLOOD_PRESSURE_MEASUREMENT_INTERVAL)) - for bp_measurement_interval in CREATE_TREATMENT_PARAMETER[BLOOD_PRESSURE_MEASUREMENT_INTERVAL]: - set_value_based_on_target(names.o_bpMeasurementIntervalControl_ValueAdjuster,bp_measurement_interval) - test.endSection() + # test.startSection("Verification of BP Measurement Interval") + # test.compare(waitForObject(names.o_bpMeasurementInterval_LabelUnitContainer).text, BLOOD_PRESSURE_MEASUREMENT_INTERVAL, "Parameter should be -> "+str(BLOOD_PRESSURE_MEASUREMENT_INTERVAL)) + # for bp_measurement_interval in CREATE_TREATMENT_PARAMETER[BLOOD_PRESSURE_MEASUREMENT_INTERVAL]: + # utility.set_value_based_on_target(names.o_bpMeasurementIntervalControl_ValueAdjuster,bp_measurement_interval) + # test.endSection() test.endSection() @@ -503,19 +497,11 @@ utils.waitForGUI(3) mouseClick(waitForObjectExists(names.o_prescriptionButton_IconButton)) utils.waitForGUI(2) - select_different_dropdown(names.o_prescriptionMenu_BaseComboBox,BUTTON_TYPE,2) + utility.select_different_dropdown(names.o_prescriptionMenu_BaseComboBox,BUTTON_TYPE,2) button = waitForObjectExists(names.o_confirmButton_ConfirmButton) test.verify(not button.enabled, "Validate that the button is disabled") test.endSection() - -def set_parameter_type(text,obj): - """ - Method to set object property based on text - @param text : (string) treatment parameter text - """ - obj["text"] = text - return obj - + def verify_custom_treatment_record_rejected(): """ Method to verify custom treatment record, if confirmation rejected @@ -547,12 +533,27 @@ for expected_treatment_title,object in zip(CREATE_TREATMENT_PARAMETERS,CREATE_TREATEMENT_OBJ): - parameter_object = set_parameter_type(text = expected_treatment_title,obj =object) + parameter_object = utility.set_Object_Text(text = expected_treatment_title,obj =object) parameter_text = waitForObject(parameter_object) parameter_text_color = parameter_text.border.color.name test.compare(COLOR_CODES, parameter_text_color, "parameter color should be ' \red for' " + expected_treatment_title +" , if the confirmation get rejected !") test.endSection() + +def verify_custom_treatment_slider(): + test.startSection("Verifying slider functionality of custom treatment") + td.td_operation_mode(TDOpModes.MODE_STAN.value) + td.td_operation_mode(TDOpModes.MODE_PRET.value, 0 ) + mouseClick(waitForObjectExists(names.o_prescriptionButton_IconButton)) + utility.set_value_with_slider(names.o_bloodFlowRateControl_ValueAdjuster,names.o_bloodFlowRate_slider_Slider,BLOOD_FLOW_RATE) + utility.set_value_with_slider(names.o_dialysateFlowRateControl_ValueAdjuster,names.o_dialysateFlowRate_slider_Slider,DIALYSATE_FLOW_RATE) + utility.set_value_with_slider(names.o_durationControl_ValueAdjuster,names.o_duration_slider_Slider,DURATION) + utility.set_value_with_slider(names.o_heparinBolusVolumeControl_ValueAdjuster,names.o_heprainBolusVolume_slider_Slider,HEPARIN_BOLUS_VOLUME) + utility.set_value_with_slider(names.o_heparinDispensingRateControl_ValueAdjuster,names.o_heprainDispensingRate_slider_Slider,HEPARIN_DISPENSING_RATE) + utility.set_value_with_slider(names.o_heparinStopTimeControl_ValueAdjuster,names.o_heprainStopTime_slider_Slider,HEPARIN_STOP_TIME) + utility.set_value_with_slider(names.o_dialysateTemperatureControl_ValueAdjuster,names.o_dialysateTemperature_slider_Slider,DIALYSATE_TEMPERATURE) + utility.set_value_with_slider(names.o_salineBolusVolumeControl_ValueAdjuster,names.o_salineBolusVolume_slider_Slider,SALINE_BOLUS_VOLUME) + test.endSection() def main(): @@ -569,13 +570,12 @@ test.startSection("Verify the patient id fields") mouseClick(waitForObject(names.o_PatientIDEntry_TextEntry)) - for expected_patient_id, actual_patient_id in PATIENT_ID_COMBINATION.items(): - verify_valid_patient_id_through_keypad(expected_patient_id, actual_patient_id) + waitForObject(names.o_PatientIDEntry_TextEntry).text ="3456" verify_create_custom_treatment_parameter() test.endSection() test.startSection("Verify the parameters in Create Rx Popup ") - verify_create_custom_treatment_parameter() + verify_custom_treatment_slider() test.endSection() test.startSection("Verify the edit functionality in Create Rx Popup")