# -*- coding: utf-8 -*- ## # Copyright (c) 2019-2020 Diality Inc. - All Rights Reserved. # copyright # THIS CODE MAY NOT BE COPIED OR REPRODUCED IN ANY FORM, # IN PART OR IN WHOLE, # WITHOUT THE EXPLICIT PERMISSION OF THE COPYRIGHT OWNER. # # file tst_create_custom_treatment # date 2020/01/27 # author Joseph varghese # # NOTE: # This test is intended to be used to verify custom treatment in application . import names from dialin.ui import utils 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() PRE_TREATMENT_STEP = 1 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 prescription_measurement_title(text): """ 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("Invalid \"text\": " +text+" for object.") names.o_prescription_mesurement["text"] = None def verify_request_rejection_mode(): """ Method to verify rejection mode of create custom treatment """ 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(): """ 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: expected_color = config.COLOR_CODES.get("Red") parameter_object = set_parameter_type(text = expected_treatment_title) utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) parameter_text = waitForObject(parameter_object) 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 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 test_back_button(): """ Method to verify back button of create custom treatment page """ test.startSection("Verification of back button from create custom treatment section") 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() 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") #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() 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) 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() 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() 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() #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() #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() 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() test_continue_button() test_back_button() 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(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(): """ 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(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)) 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 = 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)) test.endSection() 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 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) test.compare(measurement, actual_measurement.text.toUtf8().constData(), expected_operational_title +" corresponding "+ "measured value should be " + measurement) test.endSection() 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) test.compare(waitForObjectExists(slider_object).value, value, str(parameter)+" slider value should set to"+str(value)) 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() 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() 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_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 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() #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)) 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() 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) 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 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) #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) #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)) #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()