Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r7d316b6ea5f8bfeeea912930b6ab587ec8ad5868 -r0917bcb39a7346b452e56e961d19c928a71ef608 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 7d316b6ea5f8bfeeea912930b6ab587ec8ad5868) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 0917bcb39a7346b452e56e961d19c928a71ef608) @@ -1,7 +1,10 @@ import squish import test import object +import names from squish import * +from leahi_dialin.ui import utils +from builtins import int as pyInt def get_object_from_names(names_dict, error_message = "Missing object", timeout_ms = 200): @@ -37,7 +40,7 @@ names.o_text_object["text"] = txt return names.o_text_object -def set_parameter_type(text,obj): +def set_property_text(text,obj): """ Method to set object property based on text @param text : (string) treatment parameter text @@ -104,26 +107,18 @@ test.log(f"✅ Target value reached: {current_value}") -def custom_object_for_combo_box(text): - """ - Method to set custom object property for export option - @param text : (string) parameter text - """ - names.o_option_combo_box["text"] = text - return names.o_option_combo_box - def select_different_dropdown(object,type,whichTypeIndex): - type_combo_box = utility.get_object_from_names(object, error_message="Combo box object is missing") + type_combo_box = get_object_from_names(object, error_message="Combo box object is missing") if type_combo_box is not None: squish.mouseClick(squish.waitForObjectExists(object)) - type_option = utility.get_object_from_names(custom_object_for_combo_box(type[whichTypeIndex]),error_message=f"Option {DIALYZER_TYPE[whichTypeIndex]} object is missing",timeout_ms=5000) + type_option = get_object_from_names(set_property_text(obj = names.o_option_combo_box,text = type[whichTypeIndex]),error_message=f"Option {type[whichTypeIndex]} object is missing",timeout_ms=5000) if type_option is not None: squish.mouseClick(type_option) return True return False # default return if not successful -def set_value_with_slider(value_field_obj, slider_obj): +def set_value_with_slider(value_field_obj, slider_obj,parameter): """ Opens the slider and moves it gradually to the target value (step of 10). Uses controlled arrow key input for fine adjustment. @@ -134,37 +129,37 @@ test.log(f"Opening slider for {parameter}...") # Try right-click first - mousePress(value_field, Qt.LeftButton) - utils.waitForGUI(0.2) + squish.mousePress(value_field, squish.Qt.LeftButton) + # utils.waitForGUI(0.2) value = value_field.value # If not visible, try left long-press if not object.exists(slider_obj): test.log(f"{parameter}: Slider not opened by left-click, trying long left-press...") - mousePress(value_field, Qt.LeftButton) - snooze(1) + squish.mousePress(value_field, squish.Qt.LeftButton) + # utils.waitForGUI(1) if not object.exists(slider_obj): test.fail(f"{parameter}: Slider did not appear.") slider = waitForObject(slider_obj) test.log(f"{parameter}: Slider appeared successfully.") - mousePress(slider,Qt.LeftButton) + squish.mousePress(slider,squish.Qt.LeftButton) final_value = waitForObject(value_field_obj).value test.verify(final_value!= value, f"{parameter} slider adjusted correctly to {final_value}") - mouseRelease(slider, Qt.LeftButton) - utils.waitForGUI(0.2) + squish.mouseRelease(slider, squish.Qt.LeftButton) + # utils.waitForGUI(0.2) if object.exists(slider_obj): test.log(f"Waiting for {parameter} slider to close...") waitFor(lambda: not object.exists(slider_obj), 1000) - utils.waitForGUI(0.2) + # utils.waitForGUI(0.2) except LookupError as e: test.fail(f"{parameter}: LookupError - {e}") def click_left_until_off(object_name): parent_obj = waitForObject(object_name) - left_arrow = utility.findObjectById(object,parent_obj, "_leftArrow") + left_arrow = findObjectById(parent_obj, "_leftArrow") # Loop until the value becomes "off" while findObject(object_name).value != 0.0: - mouseClick(waitForObject(left_arrow)) + squish.mouseClick(waitForObject(left_arrow)) utils.waitForGUI(0.2) # Small delay to allow UI to update \ No newline at end of file Index: suite_leahi/tst_create_treatment/test.py =================================================================== diff -u -r7d316b6ea5f8bfeeea912930b6ab587ec8ad5868 -r0917bcb39a7346b452e56e961d19c928a71ef608 --- suite_leahi/tst_create_treatment/test.py (.../test.py) (revision 7d316b6ea5f8bfeeea912930b6ab587ec8ad5868) +++ suite_leahi/tst_create_treatment/test.py (.../test.py) (revision 0917bcb39a7346b452e56e961d19c928a71ef608) @@ -216,7 +216,7 @@ utility.set_value_based_on_target(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster, 90) test.compare(waitForObjectExists(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster).value,90.0) obj = waitForObject(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster) - right_arrow =utility.findObjectById(object,obj ,"_rightArrow") + right_arrow =utility.findObjectById(obj ,"_rightArrow") test.compare(not right_arrow.enabled, True, "Right arrow is disabled in Heparin stop time field") utility.set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, "0.2") @@ -245,7 +245,7 @@ mouseClick(waitForObject(names.o_potassium_leftArrow_IconButton)) mouseClick(waitForObject(names.o_calcium_leftArrow_IconButton)) mouseClick(waitForObject(names.o_saveButton_TouchRect)) - utility.select_different_dropdowndropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,0) + utility.select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,0) test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox).currentText, ACID_CONCENTRATE[0], "Acid concentrate value should be :"+str(ACID_CONCENTRATE[0])) utility.select_different_dropdown(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox,ACID_CONCENTRATE,1) test.compare(waitForObject(names.o_PreTreatmentCreate_acidConcentrateComboBox_BaseComboBox).currentText, ACID_CONCENTRATE[1], "Acid concentrate value should be :"+str(ACID_CONCENTRATE[1])) @@ -275,7 +275,7 @@ test.endSection() utility.select_different_dropdown(names.o_PreTreatment_vitalsCombobox_BaseCombobox,VITALS,2) - select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,BICARBONATE,0) + utility.select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,BICARBONATE,0) test.verify(waitForObjectExists(names.o_PreTreatmentCreate_qrCode_Image), "QR Code is visible") #Verify all the parameters are populated test.compare(waitForObject(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster).value, 500) @@ -287,10 +287,32 @@ test.compare(waitForObject(names.o_PreTreatmentCreate_dialysateTemperatureControl_ValueAdjuster).value, 38.0) test.compare(waitForObject(names.o_PreTreatmentCreate_salineBolusVolumeControl_ValueAdjuster).value, 300) - + + confirmButton = waitForObject(names.o_PreTreatmentButton) test.compare(confirmButton.enabled, True, "Confirm button is enabled") mouseClick(waitForObject(confirmButton)) + td.td_Treatment_Parameters_Validation( vAccepted = 1, + vBloodFlowRateRejectReason = 0, + vDialysateFlowRateRejectReason = 0, + vTreatmentDurationRejectReason = 0, + vSalineBolusVolumeRejectReason = 0, + vHeparinStopTimeRejectReason = 0, + vHeparinTypeRejectReason = 0, + vAcidConcentrateRejectReason = 0, + vBicarbonateConcentrateRejectReason = 0, + vDialyzerTypeRejectReason = 0, + vBloodPressureMeasureIntervalRejectReason = 0, + vRinsebackFlowRateRejectReason = 0, + vRinsebackVolumeRejectReason = 0, + vArterialPressureLimitWindowRejectReason = 0, + vVenousPressureLimitWindowRejectReason = 0, + vVenousPressureLimitAsymtrcRejectReason = 0, + vTrancembrncPressureLimitWindowRejectReason = 0, + vDialysateTempRejectReason = 0, + vHeparinDispensingRateRejectReason = 0, + vHeparinBolusVolumeRejectReason = 0 + ) td.td_operation_mode(TDOpModes.MODE_PRET.value, 0) test.endSection() @@ -322,7 +344,7 @@ ) utils.waitForGUI(3) mouseClick(waitForObjectExists(names.o_PreTreatmentButton)) - select_different_dropdown(names.o_prescription_menuButton,BUTTON_TYPE,0) + utility.select_different_dropdown(names.o_prescription_menuButton,BUTTON_TYPE,0) test.startSection("Verification of blood flow values") test.compare(waitForObject(names.o_PreTreatmentCreate_bloodFlowRate_LabelUnitContainer).text, BLOOD_FLOW_RATE, "Parameter should be -> "+str(BLOOD_FLOW_RATE)) for blood_flow_rate in CREATE_TREATMENT_PARAMETER[BLOOD_FLOW_RATE]: @@ -409,7 +431,7 @@ ) utils.waitForGUI(1) mouseClick(waitForObjectExists(names.o_PreTreatmentButton)) - select_different_dropdown(names.o_prescription_menuButton,BUTTON_TYPE,2) + utility.select_different_dropdown(names.o_prescription_menuButton,BUTTON_TYPE,2) button = waitForObjectExists(names.o_PreTreatmentButton) test.verify(not button.enabled, "Validate that the button is disabled") test.endSection() @@ -446,7 +468,7 @@ for expected_treatment_title,object in zip(CREATE_TREATMENT_PARAMETERS,CREATE_TREATEMENT_OBJ): - parameter_object = utility.set_parameter_type(text = expected_treatment_title,obj =object) + parameter_object = utility.set_property_text(text = expected_treatment_title,obj =object) parameter_text = waitForObject(parameter_object) parameter_text_color = parameter_text.border.color.name test.compare(COLOR_CODES, parameter_text_color, "parameter color should be ' \red for' " + expected_treatment_title +" , if the confirmation get rejected !") @@ -457,7 +479,6 @@ test.startSection("Verifying slider functionality of custom treatment") td.td_operation_mode(TDOpModes.MODE_STAN.value) td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0 ) - utils.waitForGUI(5) utility.set_value_with_slider(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster,names.o_PreTreatmentCreate_bloodFlowRate_slider_Slider,BLOOD_FLOW_RATE) utility.set_value_with_slider(names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster,names.o_PreTreatmentCreate_dialysateFlowRate_slider_Slider,DIALYSATE_FLOW_RATE) utility.set_value_with_slider(names.o_PreTreatmentCreate_durationControl_ValueAdjuster,names.o_PreTreatmentCreate_duration_slider_Slider,DURATION)