Index: tst_create_custom_treatment/test.py =================================================================== diff -u -r3654ed3388cab430f209b0dbb120f9eabbf5f8d1 -rdaf16428627302767972a5525dd02b8303f9d39a --- tst_create_custom_treatment/test.py (.../test.py) (revision 3654ed3388cab430f209b0dbb120f9eabbf5f8d1) +++ tst_create_custom_treatment/test.py (.../test.py) (revision daf16428627302767972a5525dd02b8303f9d39a) @@ -28,7 +28,33 @@ PRE_TREATMENT_STEP = 0 +def test_sliderArrows(sliderObject = None, occurenceIndex = 0, currentValue = 0, changeAmount = 0, valuesKey = "", configStr = ""): + """ + Method to test a slider's arrows (increment and decrement) effect on the slider's actual value + @param sliderObject: The slider object + @param currentValue: The slider's current value set when calling this method + @param valuesKey : the string key of this slider's value in the CREATE_TREATMENT_SLIDER_VALUES array + @param configStr : the configuration string + """ + # set the buttons to the index expected + names.o_PreTreatmentCreate_IncrementButton["occurrence"] = occurenceIndex + names.o_PreTreatmentCreate_DecrementButton["occurrence"] = occurenceIndex + + # increment slider value + mouseClick(waitForObject(names.o_PreTreatmentCreate_IncrementButton)) + test.compare(format(waitForObjectExists(sliderObject).value, '.2f'), format(currentValue+changeAmount, '.2f'), valuesKey+" slider value should set to "+str(currentValue+changeAmount)) + + # wait for GUi to update + utils.waitForGUI(0.2) + + # decrement slider value + mouseClick(waitForObject(names.o_PreTreatmentCreate_DecrementButton)) + test.compare(format(waitForObjectExists(sliderObject).value, '.2f'), format(currentValue, '.2f'), valuesKey+" slider value should set to "+str(currentValue)) + #reset the index to 0 + names.o_PreTreatmentCreate_IncrementButton["occurrence"] = 0 + names.o_PreTreatmentCreate_DecrementButton["occurrence"] = 0 + def set_parameter_type(text): """ Method to set object property based on text @@ -89,9 +115,9 @@ treatment_status = hd_simulator.cmd_send_treatment_parameter_manual_validation_response([9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]) test.compare(treatment_status, True, "custom treatment should be rejected") - for expected_treatment_title in config.CREATE_TREATMENT_PARAMETERS: - parameter_object = set_parameter_type(text = expected_treatment_title) - utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) + # for expected_treatment_title in config.CREATE_TREATMENT_PARAMETERS: + # parameter_object = set_parameter_type(text = expected_treatment_title) + # utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) treatment_status = hd_simulator.cmd_send_treatment_parameter_manual_validation_response([10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 1, 2, 3, 4, 5, 6, 7, 8 ]) test.compare(treatment_status, True, "custom treatment should be rejected") @@ -229,11 +255,8 @@ 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() + parameter_object = names.o_PreTreatmentCreate_bloodPressureMeasurementInterval_SliderCreateTreatment#set_parameter_type(text = config.BLOOD_PRESSURE_MEASUREMENT_INTERVAL) + utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable, yDegreeScrollDisplace = 150) 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)) @@ -242,14 +265,6 @@ 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") - parameter_object = set_parameter_type(text = 150) - utility.scroll_to_zone(parameter_object, names.o_treatment_create_flickable) - 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() @@ -342,47 +357,7 @@ 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_270, 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_standby_mode_from_create_treatment(): """ Method to set slider handle based on custom values @@ -481,7 +456,7 @@ 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.compare(waitForObject(names.o_PreTreatmentCreate_heparinTypeRect0_TouchRect).color.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") test.endSection() #scroll the screen to the title dialyste rectangle @@ -491,16 +466,16 @@ 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).color.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).color.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).color.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])) test.endSection() @@ -512,7 +487,7 @@ 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).color.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() @@ -523,27 +498,27 @@ test.startSection("Verification of dialyzer type") 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).color.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).color.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).color.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).color.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).color.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])) mouseClick(names.o_PreTreatmentCreate_dialyzerTypeRect5_TouchRect) - test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect5_TouchRect).bgColor.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") + test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect5_TouchRect).color.name, config.TREATMENT_HIGHLIGHTED_COLOR, str(config.HEPARIN_TYPE)+" checkbox should be highlighted") test.compare(waitForObject(names.o_PreTreatmentCreate_dialyzerTypeRect5_TouchRect).text.text, config.DIALYZER_TYPE[5], "Dialyzer type value should be :"+str(config.DIALYZER_TYPE[5])) test.endSection() @@ -557,28 +532,18 @@ 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() - - set_arterial_low_and_high_limits_using_slider() - - #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_venous_low_and_high_limits_using_slider() - + test.startSection("Verification of blood pressure measurement interval values") + test.compare(waitForObject(names.o_PreTreatmentCreate_BPInterval_OFF_Text).text,"OFF", "Text should be -> "+"OFF") + mouseClick(waitForObject(names.o_PreTreatmentCreate_BPInterval_Switch)) + mouseClick(names.o_PreTreatmentCreate_BPInterval_Switch) + utils.waitForGUI(1) 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() @@ -643,13 +608,8 @@ 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 = 150) - 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()