Index: tst_create_custom_treatment/test.py =================================================================== diff -u -r8a20c1bed0da16cd0bda8795aef323ac575288a2 -rd5d976dfec8c5324cd779fb192b1a3e36032547d --- tst_create_custom_treatment/test.py (.../test.py) (revision 8a20c1bed0da16cd0bda8795aef323ac575288a2) +++ tst_create_custom_treatment/test.py (.../test.py) (revision d5d976dfec8c5324cd779fb192b1a3e36032547d) @@ -17,117 +17,67 @@ import names - from dialin.ui import utils -from builtins import str as pyStr from configuration import utility from configuration import config from dialin.common.msg_defs import RequestRejectReasons from dialin.ui.hd_simulator import HDSimulator +hd_simulator = HDSimulator() -PATIENT_ID = "demopatientid" -HEPARIN_TYPE = "UFH 1,000 IU/mL" -ACID_CONCENTRATE = ["Fres. Naturalyte", "08-1251-1", "08-2251-0", "08-3251-9"] -BICARBONATE_CONCENTRATE = "Fres. Centrisol" -DIALYZER_TYPE = ["BB Diacap Pro 13H", "BB Diacap Pro 16H", "BB Diacap Pro 19H", "F Optiflux F160NRe", "F Optiflux F180NRe"] -CONFIRM_TREATMENT_TITLE = "Confirm Treatment" -PRESCRIPTION_TITLE = "PRESCRIPTION" -OPERATING_PARAMETERS_TITLE = "OPERATING PARAMETERS" +PRE_TREATMENT_STEP = 1 -CREATE_TREATMENT_SLIDER_VALUES = { - "Blood Flow Rate": [200, 300, 400], - "Dialysate Flow Rate": [150, 250, 300], - "Duration": [120, 150, 240], - "Heparin Dispensing Rate": [0.2, 0.3, 0.6], - "Heparin Bolus Volume": [0.2, 0.5, 0.8], - "Heparin Stop Time": [20, 60, 270], - "Saline Bolus Volume": [200], - "Dialysate Temperature": [35.5, 36.0, 36.5], - "Venous Pressure Limit High": [550, 510, 500], - "Venous Pressure Limit Low": [120, 140, 110], - "Arterial Pressure Limit High": [-30, -40, -50], - "Arterial Pressure Limit Low": [-280, -260, -290] , - "Blood Pressure Measure Interval": [5, 15, 20], - "Rinseback Rate": [75, 100, 125], - } - -PRESCRIPTION_DETAILS = {"Blood Flow Rate": "mL/min", "Dialysate Flow Rate": "mL/min", - "Duration": "min", "Heparin Dispensing Rate": "mL/hr", - "Heparin Bolus Volume": "mL", "Heparin Stop Time": "min", - "Saline Bolus Volume": "mL", - "Dialysate Temperature": "°C", "Arterial Pressure Limit Low": "mmHg", - "Arterial Pressure Limit High": "mmHg","Blood Pressure Measure Interval":"min", - "Rinseback Rate" : "min", "Venous Pressure Limit High": "mmHg", - "Venous Pressure Limit Low": "mmHg" - } - -OPERATIONAL_PARAMETERS = {"Heparin Type": "UFH 1,000 IU/mL", "Acid Concentrate": ACID_CONCENTRATE, - "Bicarbonate Concentrate": "Fres. Centrisol", "Dialyzer Type": DIALYZER_TYPE} - - def set_parameter_type(text): - if isinstance(text, pyStr): + """ + 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(f"Invalid \"text\": " +text+" for object.") + test.log("Invalid \"text\": " +text+" for object.") names.o_operating_parameters["text"] = None def prescription_measurement_title(text): - if isinstance(text, pyStr): + """ + Method to set object property based on text + @param text : (string) treatment parameter text + """ + if isinstance(text, str): names.o_prescription_mesurement["text"] = text return names.o_prescription_mesurement else: - test.log(f"Invalid \"text\": " +text+" for object.") + test.log("Invalid \"text\": " +text+" for object.") names.o_prescription_mesurement["text"] = None - + -def set_operating_parameters(heparin_type, acid_concentrate, bicarbonate_concentrate, dialyzer_type): +def verify_request_rejection_mode(): """ - Tests that all possible non-slider options are shown. - @Param : operating parameters value - @return: None + Method to verify rejection mode of create custom treatment """ - heparin_parameter_object = set_parameter_type(text = heparin_type) - utility.scroll_to_zone(heparin_parameter_object, names.o_treatment_create_flickable) - tapObject(waitForObject(heparin_parameter_object)) - - object_on_zone = set_parameter_type(text = ACID_CONCENTRATE[3]) - utility.scroll_to_zone(object_on_zone, names.o_treatment_create_flickable) - acid_concentrate_box_obj = set_parameter_type(text = acid_concentrate) - tapObject(waitForObject(acid_concentrate_box_obj)) - - bicarbonate_concentrate_box_obj = set_parameter_type(text = bicarbonate_concentrate) - utility.scroll_to_zone(bicarbonate_concentrate_box_obj, names.o_treatment_create_flickable) - tapObject(waitForObject(bicarbonate_concentrate_box_obj)) - - object_on_zone = set_parameter_type(text = DIALYZER_TYPE[3]) - utility.scroll_to_zone(object_on_zone, names.o_treatment_create_flickable) - dialyzer_type_box_obj = set_parameter_type(text = dialyzer_type) - tapObject(waitForObject(dialyzer_type_box_obj)) - - -def verify_request_rejection_mode(hd_simulator): - reject_reasons = [ RequestRejectReasons.REQUEST_REJECT_REASON_NOT_ALLOWED_IN_CURRENT_MODE ] * hd_simulator.NUM_TREATMENT_PARAMETERS treatment_status = hd_simulator.cmd_send_treatment_parameter_validation_response(reject_reasons) test.compare(treatment_status, True, "custom treatment should be rejected") -def verify_request_continue_mode(hd_simulator): - +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_custom_treatment_record_rejected(): - + """ + Method to verify custom treatment record, if confirmation rejected + """ test.startSection("Verifying custom treatment record, if confirmation rejected") for expected_treatment_title in config.CREATE_TREATMENT_PARAMETERS: @@ -137,268 +87,551 @@ utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) parameter_text = waitForObject(parameter_object) - parameter_text_color = parameter_text.color + parameter_text_color = parameter_text.color.name test.compare(expected_color, parameter_text_color, "parameter color should be "\ "red for " + expected_treatment_title +" , if the confirmation get rejected !") test.endSection() - -def set_slider_value_for_parameter(index_value = None, item_text = None, slider_value = None, - slider_obj = None, bislider = False, slider_range = None): - parameter = object.children(slider_obj)[index_value] - if bislider is True: - slider_object = object.children(parameter)[1] - else: - slider_object = object.children(parameter)[2] - slider_status = utility.set_slider_value(slider_value, slider_object, bislider, slider_range) - test.compare(slider_status, True, str(item_text) + " should set to value -> " + str(slider_value)) +def test_continue_button(): + """ + Method to verify continue button of create custom treatment page + """ + test.startSection("Verification of continue button from create custom treatment section") + test.compare(waitForObject(names.o_PreTreatmentCreate_confirmButton_TouchRect).text.text, config.CONTINUE_TEXT, "continue button should be displayed") + test.verify(waitForObject(names.o_PreTreatmentCreate_confirmButton_TouchRect).enabled, "continue button should be enabled") + test.endSection() -def create_custom_treatment_record( blood_flow_rate, dialysate_flow_rate, - Duration, heparin_dispensing_rate, - heparin_bolus_volume, heparin_stop_time, - saline_bolus, dialysate_temperature, - blood_pressure_measurement_interval, - rinseback_flowrate, venous_pressure_low_limits, - venous_pressure_high_limits, arterial_pressure_low_limit, - arterial_pressure_high_limit, index - ): +def test_back_button(): """ - Method to set custom treatment slider values for parameters. - @Param : parameters value - @return: None - """ + Method to verify back button of create custom treatment page + """ + test.startSection("Verification of back button from create custom treatment section") - slider_object = waitForObject(names.o_create_treatment_screen) - child = object.children(slider_object)[0] - parameter_child = object.children(child)[0] + test.compare(waitForObject(names.o_PreTreatmentCreate_backButton_BackButton).text.text, config.BACK_TEXT, "Back button should be displayed") + test.verify(waitForObject(names.o_PreTreatmentCreate_backButton_BackButton).enabled, "Back button should be enabled") + test.endSection() - set_slider_value_for_parameter(index_value = 1, item_text = "blood flow rate", - slider_value = blood_flow_rate, slider_obj = parameter_child) - set_slider_value_for_parameter(index_value = 2, item_text = "dialysate flow rate", - slider_value = dialysate_flow_rate, slider_obj = parameter_child) +def create_custom_treatment_record(): + """ + Method to set create custom treatment slider value based on slider buffer on negative direction + """ + test.startSection("Method to set create custom treatment slider based on negative slider buffer") - set_slider_value_for_parameter(index_value = 3, item_text = "Duration", - slider_value = Duration, slider_obj = parameter_child) + #flicker screen into blood dialysate section + parameter_object = set_parameter_type(text = config.BLOOD_FLOW_RATE) + utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable, direction="Top") + + #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)) + for blood_flow_rate in config.CREATE_TREATMENT_PARAMETER_RANGE[config.BLOOD_FLOW_RATE][::-1]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodFlowRateSlider_Slider, blood_flow_rate, config.CREATE_TREATMENT_SLIDER_VALUES["blood_flow_rate"], config.BLOOD_FLOW_RATE) + test.endSection() - parameter_object = set_parameter_type(text = "Heparin Stop Time") + 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)) + for dialysate_flow_rate in config.CREATE_TREATMENT_PARAMETER_RANGE[config.DIALYSATE_FLOW_RATE][::-1]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_dialysateFlowRateSlider_Slider, dialysate_flow_rate, 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)) + for duration in config.CREATE_TREATMENT_PARAMETER_RANGE[config.DURATION][::-1]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_durationSlider_Slider, duration, 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) - set_slider_value_for_parameter(index_value = 4, item_text = "heparin dispensing rate", - slider_value = heparin_dispensing_rate, slider_obj = parameter_child) + 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)) + for heparin_dispensing_rate in config.CREATE_TREATMENT_PARAMETER_RANGE[config.HEPARIN_DISPENSING_RATE][::-1]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinDispensingRateSlider_Slider, heparin_dispensing_rate, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_dispensing_rate"], config.HEPARIN_DISPENSING_RATE) + test.compare(config.OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_heparinDispensingRateValue_Text).text, "OFF text should display for value 0") + test.endSection() - set_slider_value_for_parameter(index_value = 5, item_text = "heparin bolus volume", - slider_value = heparin_bolus_volume, slider_obj = parameter_child) - - parameter_object = set_parameter_type(text = "Saline Bolus") + 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)) + for heparin_bolus_volume in config.CREATE_TREATMENT_PARAMETER_RANGE[config.HEPARIN_BOLUS_VOLUME][::-1]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinBolusVolumeSlider_Slider, heparin_bolus_volume, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_bolus_volume"], config.HEPARIN_BOLUS_VOLUME) + test.compare(config.OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_heparinBolusVolumeValue_Text).text, "OFF text should display for value 0") + 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)) + for heparin_stop_time in config.CREATE_TREATMENT_PARAMETER_RANGE[config.HEPARIN_STOP_TIME][::-1]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinStopTimeSlider_Slider, heparin_stop_time, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_stop_time"], config.HEPARIN_STOP_TIME) + test.compare(config.OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_heparinStopTimeValue_Text).text, "OFF text should display for value 0") + test.endSection() - set_slider_value_for_parameter(index_value = 6, item_text = "heparin stop time", - slider_value = heparin_stop_time, slider_obj = parameter_child) + 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)) + for saline_bolus in config.CREATE_TREATMENT_PARAMETER_RANGE[config.SALINE_BOLUS][::-1]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_salineBolusSlider_Slider, saline_bolus, config.CREATE_TREATMENT_SLIDER_VALUES["saline_bolus"], config.SALINE_BOLUS) + test.endSection() - set_slider_value_for_parameter(index_value = 7, item_text = "saline bolus", - slider_value = saline_bolus, slider_obj = parameter_child) - - set_operating_parameters(heparin_type = HEPARIN_TYPE, - acid_concentrate = ACID_CONCENTRATE[index], - bicarbonate_concentrate = BICARBONATE_CONCENTRATE, - dialyzer_type = DIALYZER_TYPE[index]) - - parameter_object = set_parameter_type(text = "Venous Pressure Limits (mmHg)") + #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)) + for dialysate_temperature in config.CREATE_TREATMENT_PARAMETER_RANGE[config.DIALYSATE_TEMPERATURE][::-1]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_dialysateTemperatureSlider_Slider, dialysate_temperature, config.CREATE_TREATMENT_SLIDER_VALUES["dialysate_temperature"], config.DIALYSATE_TEMPERATURE) + test.endSection() - set_slider_value_for_parameter(index_value = 13, item_text = "dialysate temperature", - slider_value = dialysate_temperature, slider_obj = parameter_child) - - parameter_object = set_parameter_type(text = "Rinseback Flow Rate") + #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_high_and_low_limits_using_slider() + set_venous_high_and_low_limits_using_slider() + + 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)) + for blood_pressure_measurement_interval in config.CREATE_TREATMENT_PARAMETER_RANGE[config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL][::-1]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodPressureMeasurementIntervalSlider_Slider, blood_pressure_measurement_interval, config.CREATE_TREATMENT_SLIDER_VALUES["blood_pressure_measurement_interval"], config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL) + test.compare(config.OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_bloodPressureMeasurementIntervalValue_Text).text, "OFF text should display for value 0") + test.endSection() - set_slider_value_for_parameter(index_value = 14, item_text = " arterial pressure low limits (mmHg)", - slider_value = arterial_pressure_low_limit, slider_obj = parameter_child, bislider = True, slider_range = "Low") - - set_slider_value_for_parameter(index_value = 14, item_text = "arterial pressure high limits (mmHg)", - slider_value = arterial_pressure_high_limit, slider_obj = parameter_child, bislider = True, slider_range = "Max") - - set_slider_value_for_parameter(index_value = 15, item_text = "venous_pressure_low_limits", - slider_value = venous_pressure_low_limits, slider_obj = parameter_child, bislider = True, slider_range = "Low") - - set_slider_value_for_parameter(index_value = 15, item_text = "venous pressure high limits (mmHg)", - slider_value = venous_pressure_high_limits, slider_obj = parameter_child, bislider = True, slider_range = "Max") + 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)) + for rinseback_flow_rate in config.CREATE_TREATMENT_PARAMETER_RANGE[config.RINSEBACK_FLOW_RATE][::-1]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_rinsebackFlowRateSlider_Slider, rinseback_flow_rate, config.CREATE_TREATMENT_SLIDER_VALUES["rinseback_flow_rate"], config.RINSEBACK_FLOW_RATE) + test.endSection() - set_slider_value_for_parameter(index_value = 16, item_text = "blood pressure measurement interval", - slider_value = blood_pressure_measurement_interval, slider_obj = parameter_child) + test_continue_button() + test_back_button() - set_slider_value_for_parameter(index_value = 17, item_text = "rinseback_flowrate", - slider_value = rinseback_flowrate, slider_obj = parameter_child) + test.endSection() def verify_the_confirm_treatment_screen_is_displayed() -> None: - + """ + Method to verify confirm treatment title + """ test.log("Verifying the 'Confirm Treatment' is displayed and its title text") confirm_treatment_title = waitForObject(names.o_confirm_title_text) - test.compare(CONFIRM_TREATMENT_TITLE, confirm_treatment_title.text.toUtf8().constData(), - CONFIRM_TREATMENT_TITLE + " screen is displayed " + - "and title should be " +CONFIRM_TREATMENT_TITLE) + test.compare(config.CONFIRM_TREATMENT_TITLE, confirm_treatment_title.text.toUtf8().constData(), + config.CONFIRM_TREATMENT_TITLE + " screen is displayed " + + "and title should be " +config.CONFIRM_TREATMENT_TITLE) -def verify_prescriptional_details_from_confirm_treatment_screen(index): - +def verify_prescriptional_details_from_confirm_treatment_screen(): + """ + Method to verify prescription details from confirm treatment section. + """ test.startSection("Verifying prescription values from confirm treatment section") verify_the_confirm_treatment_screen_is_displayed() prescription_title = waitForObject(names.o_prescription_title_text) - test.compare(PRESCRIPTION_TITLE, prescription_title.text.toUtf8().constData(), - PRESCRIPTION_TITLE + " title " + "should be " +PRESCRIPTION_TITLE) - option = index - for expected_prescription_title, measurement in PRESCRIPTION_DETAILS.items(): - if expected_prescription_title == "Saline Bolus Volume": - option = 0 + test.compare(config.PRESCRIPTION_TITLE, prescription_title.text.toUtf8().constData(), + config.PRESCRIPTION_TITLE + " title " + "should be " +config.PRESCRIPTION_TITLE) + + for expected_prescription_title, measurement in config.PRESCRIPTION_DETAILS.items(): + + #flickering into expected parameter title parameter_object = prescription_measurement_title(text = expected_prescription_title) utility.scroll_to_zone(parameter_object, names.o_treatment_confirm_flickable) - prescription_title = waitForObject(prescription_measurement_title(\ - text=expected_prescription_title)) + prescription_title = waitForObject(prescription_measurement_title(text=expected_prescription_title)) actual_measurement = object.parent(prescription_title) actual_measurement = object.children(actual_measurement)[-1] test.compare(expected_prescription_title, prescription_title.text.toUtf8().constData(), "title should be " + expected_prescription_title) - unit = CREATE_TREATMENT_SLIDER_VALUES[expected_prescription_title][option] + unit = config.CREATE_CUSTOM_TREATMENT[expected_prescription_title] test.compare(str(unit)+ " " +str(measurement), actual_measurement.text, expected_prescription_title + " corresponding "+ "measured value should be " + str(unit)+" "+str(measurement)) - option = index + test.endSection() -def verify_operational_details_from_confirm_treatment_screen(index): - +def verify_operational_details_from_confirm_treatment_screen(): + """ + Method to verify operational details from confirm treatment section. + """ test.startSection("Verifying operational values from confirm treatment screen") verify_the_confirm_treatment_screen_is_displayed() parameter_object = prescription_measurement_title(text = "Blood Flow Rate") utility.scroll_to_zone(parameter_object, names.o_treatment_confirm_flickable) - for expected_operational_title, measurement in OPERATIONAL_PARAMETERS.items(): + for expected_operational_title, measurement in config.OPERATIONAL_PARAMETERS.items(): operational_title = waitForObject(prescription_measurement_title(\ text=expected_operational_title)) actual_measurement = object.parent(operational_title) actual_measurement = object.children(actual_measurement)[-1] test.compare(expected_operational_title, operational_title.text.toUtf8().constData(), expected_operational_title + " title should be " + expected_operational_title) - if expected_operational_title == "Acid Concentrate" or expected_operational_title == "Dialyzer Type": - measurement = measurement[index] test.compare(measurement, actual_measurement.text.toUtf8().constData(), expected_operational_title +" corresponding "+ "measured value should be " + measurement) test.endSection() - -def main(): - utils.tstStart(__file__) - startApplication(config.AUT_NAME) +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.2) + mouseClick(findObject(slider_object), float(slider_width) , 3, Qt.LeftButton) - hd = HDSimulator() + test.compare(waitForObjectExists(slider_object).value, value, str(parameter)+" slider value should set to"+str(value)) - hd.cmd_send_power_on_self_test_version_request() - hd.cmd_send_hd_operation_mode(4, 0) + +def set_venous_low_and_high_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_20, config.VENOUS_VALUE_600, config.POSITIVE_BUFFER): + utility.set_venous_ranges_min_val(venous_value) + utility.set_venous_ranges_min_val(config.VENOUS_VALUE_20) + for venous_value in range(config.VENOUS_VALUE_600, config.VENOUS_VALUE_20, config.NEGATIVE_BUFFER): + utility.set_venous_ranges_max_val(venous_value) + + test.endSection() - mouseClick(waitForObject(names.o_input_patient_id)) - type(waitForObject(names.o_input_patient_id), PATIENT_ID) - mouseClick(waitForObject(names.o_confirm_button)) - #set custom values for parameters - create_custom_treatment_record( - blood_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Blood Flow Rate"][0], - dialysate_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Flow Rate"][0], - Duration = CREATE_TREATMENT_SLIDER_VALUES["Duration"][0], - heparin_dispensing_rate = CREATE_TREATMENT_SLIDER_VALUES["Heparin Dispensing Rate"][0], - heparin_bolus_volume = CREATE_TREATMENT_SLIDER_VALUES["Heparin Bolus Volume"][0], - heparin_stop_time = CREATE_TREATMENT_SLIDER_VALUES["Heparin Stop Time"][0], - saline_bolus = CREATE_TREATMENT_SLIDER_VALUES["Saline Bolus Volume"][0], - dialysate_temperature = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Temperature"][0], - venous_pressure_low_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit Low"][0], - venous_pressure_high_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit High"][0], - arterial_pressure_low_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit Low"][0], - arterial_pressure_high_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit High"][0], - blood_pressure_measurement_interval = CREATE_TREATMENT_SLIDER_VALUES["Blood Pressure Measure Interval"][0], - rinseback_flowrate = CREATE_TREATMENT_SLIDER_VALUES["Rinseback Rate"][0], - index = 0 - ) +def set_arterial_low_and_high_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) + for arterial_value in range(config.ARTERIAL_VALUE_0, config.ARTERIAL_VALUE_NEGATIVE_300, config.NEGATIVE_BUFFER): + utility.set_arterial_ranges_max_val(arterial_value) + utility.set_arterial_ranges_max_val(config.ARTERIAL_VALUE_0) + for arterial_value in range(config.ARTERIAL_VALUE_NEGATIVE_300, config.ARTERIAL_VALUE_NEGATIVE_20, config.POSITIVE_BUFFER): + utility.set_arterial_ranges_min_val(arterial_value) + + test.endSection() - verify_request_continue_mode(hd) +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() - #verification of records from confirm treatment screen - verify_operational_details_from_confirm_treatment_screen(index = 0) - verify_prescriptional_details_from_confirm_treatment_screen(index = 0) - mouseClick(waitForObject(names.o_back_button_confirm_treatment)) +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() - parameter_object = set_parameter_type(text = config.CREATE_TREATMENT_PARAMETERS[0]) - utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable, direction="Top") +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)) + #set custom values for parameters - create_custom_treatment_record( - blood_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Blood Flow Rate"][1], - dialysate_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Flow Rate"][1], - Duration = CREATE_TREATMENT_SLIDER_VALUES["Duration"][1], - heparin_dispensing_rate = CREATE_TREATMENT_SLIDER_VALUES["Heparin Dispensing Rate"][1], - heparin_bolus_volume = CREATE_TREATMENT_SLIDER_VALUES["Heparin Bolus Volume"][1], - heparin_stop_time = CREATE_TREATMENT_SLIDER_VALUES["Heparin Stop Time"][1], - saline_bolus = CREATE_TREATMENT_SLIDER_VALUES["Saline Bolus Volume"][0], - dialysate_temperature = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Temperature"][1], - venous_pressure_low_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit Low"][1], - venous_pressure_high_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit High"][1], - arterial_pressure_low_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit Low"][1], - arterial_pressure_high_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit High"][1], - blood_pressure_measurement_interval = CREATE_TREATMENT_SLIDER_VALUES["Blood Pressure Measure Interval"][1], - rinseback_flowrate = CREATE_TREATMENT_SLIDER_VALUES["Rinseback Rate"][1], - index = 1 - ) + 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)) + for blood_flow_rate in config.CREATE_TREATMENT_PARAMETER_RANGE[config.BLOOD_FLOW_RATE]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodFlowRateSlider_Slider, blood_flow_rate, 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)) + for dialysate_flow_rate in config.CREATE_TREATMENT_PARAMETER_RANGE[config.DIALYSATE_FLOW_RATE]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_dialysateFlowRateSlider_Slider, dialysate_flow_rate, 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)) + for duration in config.CREATE_TREATMENT_PARAMETER_RANGE[config.DURATION]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_durationSlider_Slider, duration, config.CREATE_TREATMENT_SLIDER_VALUES["duration"], config.DURATION) + test.endSection() - verify_request_rejection_mode(hd) + #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) - parameter_object = set_parameter_type(text = config.CREATE_TREATMENT_PARAMETERS[0]) - utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable, direction="Top") + 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)) + for heparin_dispensing_rate in config.CREATE_TREATMENT_PARAMETER_RANGE[config.HEPARIN_DISPENSING_RATE]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinDispensingRateSlider_Slider, heparin_dispensing_rate, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_dispensing_rate"], config.HEPARIN_DISPENSING_RATE) + test.compare(config.OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_heparinDispensingRateValue_Text).text, "OFF text should display for value 0") + test.endSection() - #verification of create treatment screen after request rejection - verify_custom_treatment_record_rejected() + 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)) + for heparin_bolus_volume in config.CREATE_TREATMENT_PARAMETER_RANGE[config.HEPARIN_BOLUS_VOLUME]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinBolusVolumeSlider_Slider, heparin_bolus_volume, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_bolus_volume"], config.HEPARIN_BOLUS_VOLUME) + test.compare(config.OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_heparinBolusVolumeValue_Text).text, "OFF text should display for value 0") + 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) - parameter_object = set_parameter_type(text = config.CREATE_TREATMENT_PARAMETERS[0]) + 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)) + for heparin_stop_time in config.CREATE_TREATMENT_PARAMETER_RANGE[config.HEPARIN_STOP_TIME]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinStopTimeSlider_Slider, heparin_stop_time, config.CREATE_TREATMENT_SLIDER_VALUES["heparin_stop_time"], config.HEPARIN_STOP_TIME) + test.compare(config.OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_heparinStopTimeValue_Text).text, "OFF text should display for value 0") + 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)) + for saline_bolus in config.CREATE_TREATMENT_PARAMETER_RANGE[config.SALINE_BOLUS]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_salineBolusSlider_Slider, saline_bolus, config.CREATE_TREATMENT_SLIDER_VALUES["saline_bolus"], config.SALINE_BOLUS) + 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])) + + + mouseClick(names.o_PreTreatmentCreate_acidConcentrateRect1_TouchRect) + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect1_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect1_TouchRect).text.text, config.ACID_CONCENTRATE[1], "Acid concentrate value should be :"+str(config.ACID_CONCENTRATE[1])) + + mouseClick(names.o_PreTreatmentCreate_acidConcentrateRect2_TouchRect) + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect2_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect2_TouchRect).text.text, config.ACID_CONCENTRATE[2], "Acid concentrate value should be :"+str(config.ACID_CONCENTRATE[2])) + + mouseClick(names.o_PreTreatmentCreate_acidConcentrateRect3_TouchRect) + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect3_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateRect3_TouchRect).text.text, config.ACID_CONCENTRATE[3], "Acid concentrate value should be :"+str(config.ACID_CONCENTRATE[3])) + 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])) + + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeRect1_TouchRect) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect1_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect1_TouchRect).text.text, config.DIALYZER_TYPE[1], "Dialyzer type value should be :"+str(config.DIALYZER_TYPE[1])) + + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeRect2_TouchRect) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect2_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect2_TouchRect).text.text, config.DIALYZER_TYPE[2], "Dialyzer type value should be :"+str(config.DIALYZER_TYPE[2])) + + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeRect3_TouchRect) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect3_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect3_TouchRect).text.text, config.DIALYZER_TYPE[3], "Dialyzer type value should be :"+str(config.DIALYZER_TYPE[3])) + + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeRect4_TouchRect) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect4_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect4_TouchRect).text.text, config.DIALYZER_TYPE[4], "Dialyzer type value should be :"+str(config.DIALYZER_TYPE[4])) + 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)) + for dialysate_temperature in config.CREATE_TREATMENT_PARAMETER_RANGE[config.DIALYSATE_TEMPERATURE]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_dialysateTemperatureSlider_Slider, dialysate_temperature, 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_limits_using_slider() + set_venous_low_and_high_limits_using_slider() + + 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)) + for blood_pressure_measurement_interval in config.CREATE_TREATMENT_PARAMETER_RANGE[config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodPressureMeasurementIntervalSlider_Slider, blood_pressure_measurement_interval, config.CREATE_TREATMENT_SLIDER_VALUES["blood_pressure_measurement_interval"], config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL) + test.compare(config.OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_bloodPressureMeasurementIntervalValue_Text).text, "OFF text should display for value 0") + 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)) + for rinseback_flow_rate in config.CREATE_TREATMENT_PARAMETER_RANGE[config.RINSEBACK_FLOW_RATE]: + test_custom_treatment_slider(names.o_PreTreatmentCreate_rinsebackFlowRateSlider_Slider, rinseback_flow_rate, config.CREATE_TREATMENT_SLIDER_VALUES["rinseback_flow_rate"], config.RINSEBACK_FLOW_RATE) + test.endSection() + + test.endSection() + + +def create_custom_values_for_treatment(): + """ + Method to set create custom treatment slider value based on user input + """ + test.startSection("Method to set treatment value based on user input") + + #flicker screen into blood dialysate section + parameter_object = set_parameter_type(text = config.BLOOD_FLOW_RATE) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable, direction="Top") - + #set custom values for parameters - create_custom_treatment_record( - blood_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Blood Flow Rate"][2], - dialysate_flow_rate = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Flow Rate"][2], - Duration = CREATE_TREATMENT_SLIDER_VALUES["Duration"][2], - heparin_dispensing_rate = CREATE_TREATMENT_SLIDER_VALUES["Heparin Dispensing Rate"][2], - heparin_bolus_volume = CREATE_TREATMENT_SLIDER_VALUES["Heparin Bolus Volume"][2], - heparin_stop_time = CREATE_TREATMENT_SLIDER_VALUES["Heparin Stop Time"][2], - saline_bolus = CREATE_TREATMENT_SLIDER_VALUES["Saline Bolus Volume"][0], - dialysate_temperature = CREATE_TREATMENT_SLIDER_VALUES["Dialysate Temperature"][2], - venous_pressure_low_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit Low"][2], - venous_pressure_high_limits = CREATE_TREATMENT_SLIDER_VALUES["Venous Pressure Limit High"][2], - arterial_pressure_low_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit Low"][2], - arterial_pressure_high_limit = CREATE_TREATMENT_SLIDER_VALUES["Arterial Pressure Limit High"][2], - blood_pressure_measurement_interval = CREATE_TREATMENT_SLIDER_VALUES["Blood Pressure Measure Interval"][2], - rinseback_flowrate = CREATE_TREATMENT_SLIDER_VALUES["Rinseback Rate"][2], - index = 2 - ) + test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodFlowRateSlider_Slider, config.CREATE_CUSTOM_TREATMENT[config.BLOOD_FLOW_RATE], config.CREATE_TREATMENT_SLIDER_VALUES["blood_flow_rate"], config.BLOOD_FLOW_RATE) + test_custom_treatment_slider(names.o_PreTreatmentCreate_dialysateFlowRateSlider_Slider, config.CREATE_CUSTOM_TREATMENT[config.DIALYSATE_FLOW_RATE], config.CREATE_TREATMENT_SLIDER_VALUES["dialysate_flow_rate"], config.DIALYSATE_FLOW_RATE) + test_custom_treatment_slider(names.o_PreTreatmentCreate_durationSlider_Slider, config.CREATE_CUSTOM_TREATMENT[config.DURATION], config.CREATE_TREATMENT_SLIDER_VALUES["duration"], config.DURATION) + + #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) + + #set custom values for parameters + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinDispensingRateSlider_Slider, config.CREATE_CUSTOM_TREATMENT[config.HEPARIN_DISPENSING_RATE], config.CREATE_TREATMENT_SLIDER_VALUES["heparin_dispensing_rate"], config.HEPARIN_DISPENSING_RATE) + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinBolusVolumeSlider_Slider, config.CREATE_CUSTOM_TREATMENT[config.HEPARIN_BOLUS_VOLUME], config.CREATE_TREATMENT_SLIDER_VALUES["heparin_bolus_volume"], config.HEPARIN_BOLUS_VOLUME) - verify_request_continue_mode(hd) + #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) + + #set custom values for parameters + test_custom_treatment_slider(names.o_PreTreatmentCreate_heparinStopTimeSlider_Slider, config.CREATE_CUSTOM_TREATMENT[config.HEPARIN_STOP_TIME], config.CREATE_TREATMENT_SLIDER_VALUES["heparin_stop_time"], config.HEPARIN_STOP_TIME) + test_custom_treatment_slider(names.o_PreTreatmentCreate_salineBolusSlider_Slider, config.CREATE_CUSTOM_TREATMENT[config.SALINE_BOLUS], config.CREATE_TREATMENT_SLIDER_VALUES["saline_bolus"], config.SALINE_BOLUS) - verify_operational_details_from_confirm_treatment_screen(index = 2) - verify_prescriptional_details_from_confirm_treatment_screen(index = 2) + #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) + mouseClick(waitForObject(names.o_PreTreatmentCreate_heparinTypeRect0_TouchRect)) - utils.waitForGUI(.5) + #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) + mouseClick(names.o_PreTreatmentCreate_acidConcentrateRect0_TouchRect) + + #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) + + mouseClick(names.o_PreTreatmentCreate_bicarbonateConcentrateRect0_TouchRect) + + #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) + + mouseClick(names.o_PreTreatmentCreate_dialyzerTypeRect1_TouchRect) + + #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_custom_treatment_slider(names.o_PreTreatmentCreate_dialysateTemperatureSlider_Slider, config.CREATE_CUSTOM_TREATMENT[config.DIALYSATE_TEMPERATURE], config.CREATE_TREATMENT_SLIDER_VALUES["dialysate_temperature"], config.DIALYSATE_TEMPERATURE) + + #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 custom values for parameters + test_custom_treatment_slider(names.o_PreTreatmentCreate_bloodPressureMeasurementIntervalSlider_Slider, config.CREATE_CUSTOM_TREATMENT[config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL], config.CREATE_TREATMENT_SLIDER_VALUES["blood_pressure_measurement_interval"], config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL) + test_custom_treatment_slider(names.o_PreTreatmentCreate_rinsebackFlowRateSlider_Slider, config.CREATE_CUSTOM_TREATMENT[config.RINSEBACK_FLOW_RATE], config.CREATE_TREATMENT_SLIDER_VALUES["rinseback_flow_rate"], config.RINSEBACK_FLOW_RATE) + + test.endSection() + + +def main(): + + utils.tstStart(__file__) + startApplication(config.AUT_NAME) + + hd_simulator.cmd_send_hd_operation_mode(4, 0) + + test.log("Verification of page step indicator from patient id page") + utility.page_step_indicator_verification(PRE_TREATMENT_STEP, names.o_PreTreatmentBase_nextStepsBullet_StepBullet) + + mouseClick(waitForObject(names.o_input_patient_id)) + type(waitForObject(names.o_input_patient_id), config.PATIENT_ID) + mouseClick(waitForObject(names.o_confirm_button)) + + test.log("Verification of page step indicator from create custom treatment page") + utility.page_step_indicator_verification(PRE_TREATMENT_STEP, names.o_PreTreatmentCreate_nextStepsBullet_StepBullet) + + verify_create_custom_treatment_parameter() + + verify_request_rejection_mode() + + #verification of create treatment screen after request rejection + verify_custom_treatment_record_rejected() + + create_custom_treatment_record() + + verify_request_continue_mode() + verify_the_confirm_treatment_screen_is_displayed() + mouseClick(waitForObject(names.o_back_button_confirm_treatment)) + + #set custom values for treatment parameters + create_custom_values_for_treatment() + + verify_request_continue_mode() + + #verification of records from confirm treatment screen + verify_the_confirm_treatment_screen_is_displayed() + verify_operational_details_from_confirm_treatment_screen() + verify_prescriptional_details_from_confirm_treatment_screen() + utils.tstDone()