Index: suite_leahi/shared/scripts/configuration/utility.py =================================================================== diff -u -r885d84508080eb00e01a756e33c5109c9da761fe -r31ee85c3b363ea427b129b8f8f640242f0ae6a03 --- suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 885d84508080eb00e01a756e33c5109c9da761fe) +++ suite_leahi/shared/scripts/configuration/utility.py (.../utility.py) (revision 31ee85c3b363ea427b129b8f8f640242f0ae6a03) @@ -4,8 +4,6 @@ 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): """ @@ -76,28 +74,22 @@ target_value: integer or string number, e.g. 220 """ target_value = target_value - - # Wait for all objects parent_obj = squish.waitForObjectExists(obj) - # change range as per your screen count - left_arrow = findObjectById(parent_obj, "_leftArrow") right_arrow =findObjectById(parent_obj, "_rightArrow") - # Read current value (supports invisible text too) try: current_value = round(float(findObject(obj).value),1) except LookupError: current_value = float(findObject(obj).property("value")) - # Determine direction while current_value != float(target_value): if current_value < float(target_value): squish.mouseClick(squish.waitForObject(right_arrow)) elif current_value > float(target_value): squish.mouseClick(squish.waitForObject(left_arrow)) - # Update current value after click + try: current_value = round(float(findObject(obj).value),1) except Exception: @@ -128,19 +120,17 @@ """ try: + value_field = waitForObject(value_field_obj) value_field = waitForObject(value_field_obj,1000) test.log(f"Opening slider for {parameter}...") - - # Try right-click first 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...") squish.mousePress(value_field, squish.Qt.LeftButton) - # utils.waitForGUI(1) + if not object.exists(slider_obj): test.fail(f"{parameter}: Slider did not appear.") @@ -150,11 +140,11 @@ final_value = waitForObject(value_field_obj).value test.verify(final_value!= value, f"{parameter} slider adjusted correctly to {final_value}") 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) + except LookupError as e: test.fail(f"{parameter}: LookupError - {e}") @@ -170,10 +160,4 @@ while findObject(object_name).value != 0.0: squish.mouseClick(waitForObject(left_arrow)) utils.waitForGUI(0.2) # Small delay to allow UI to update - -def button_text_obj(text): - """ - To get the text from Validate and confirm button - """ - names.o_PreTreatmentCreate_Text["text"] = text - return names.o_PreTreatmentCreate_Text + \ No newline at end of file Index: suite_leahi/tst_create_treatment/test.py =================================================================== diff -u -r885d84508080eb00e01a756e33c5109c9da761fe -r31ee85c3b363ea427b129b8f8f640242f0ae6a03 --- suite_leahi/tst_create_treatment/test.py (.../test.py) (revision 885d84508080eb00e01a756e33c5109c9da761fe) +++ suite_leahi/tst_create_treatment/test.py (.../test.py) (revision 31ee85c3b363ea427b129b8f8f640242f0ae6a03) @@ -23,12 +23,11 @@ from builtins import int as pyInt from squish import * -td =TD_Messaging() +td = TD_Messaging() PRE_TREATMENT_STEP = 0 PRE_TREATMENT_SCREENS = ["Create" , "Sample" , "Consumables" , "Disposables" , "Prime" , "BP/HR" , "Ultrafiltration" , "Connection" , "Start"] COMPLETE_COLOR = '#4696f7' CURRENT_COLOR = '#000000' -PRESCRIPTION_TITLE = "Prescription" BLOOD_FLOW_RATE = "Blood Flow Rate" DIALYSATE_FLOW_RATE = "Dialysate Flow Rate" DURATION = "Duration" @@ -85,21 +84,21 @@ } CREATE_TREATMENT_SLIDER_VALUES = { - "Blood Flow Rate" : [60, 10, 500], - "Dialysate Flow Rate" : [50, 10, 600], - "duration" : [60, 15, 28], - "heparin_dispensing_rate" : [0.2, 0.1, 93], - "heparin_bolus_volume" : [0.2, 0.1, 41], - "heparin_stop_time" : [0, 10, 15.75], - "saline_bolus" : [100, 100, 425], - "dialysate_temperature" : [35, 0.5, 187.5], - "arterial_pressure_limit_high" : [20, 10, 11.931], - "blood_pressure_measurement_interval" : [5, 5, 60], + "Blood Flow Rate" : [60, 10, 500], + "Dialysate Flow Rate" : [50, 10, 600], + "duration" : [60, 15, 28], + "heparin_dispensing_rate" : [0.2, 0.1, 93], + "heparin_bolus_volume" : [0.2, 0.1, 41], + "heparin_stop_time" : [0, 10, 15.75], + "saline_bolus" : [100, 100, 425], + "dialysate_temperature" : [35, 0.5, 187.5], + "arterial_pressure_limit_high" : [20, 10, 11.931], + "blood_pressure_measurement_interval" : [5, 5, 60], } -COLOR_CODES = "#ffa500" -VALIDATE = "VALIDATE" -CONFIRM = "CONFIRM" +COLOR_CODES = "#ffa500" +VALIDATE = "VALIDATE" +CONFIRM = "CONFIRM" DIALYZER_TYPE = ["Diacap Pro 13H","Diacap Pro 16H", "Diacap Pro 19H", "Optiflux F160NRe", "Optiflux F180NRe", "Optiflux F200NRe","Optiflux F250NRe"] ACID_CONCENTRATE = ["2.0 K, 2.00 Ca, 1 Mg", "1.0 K, 2.50 Ca, 1 Mg","2.0 K, 2.50 Ca, 1 Mg","3.0 K, 2.50 Ca, 1 Mg"] @@ -110,15 +109,15 @@ "Dialyzer Type", "Dialysate Temperature"] -CREATE_TREATEMENT_OBJ =[names.o_PreTreatmentCreate_bloodFlowRate_LabelUnitContainer ,names.o_PreTreatmentCreate_dialysateFlowRate_LabelUnitContainer, +CREATE_TREATEMENT_OBJ = [names.o_PreTreatmentCreate_bloodFlowRate_LabelUnitContainer ,names.o_PreTreatmentCreate_dialysateFlowRate_LabelUnitContainer, names.o_PreTreatmentCreate_duration_LabelUnitContainer ,names.o_PreTreatmentCreate_heparinBolusVolume_LabelUnitContainer, names.o_PreTreatmentCreate_heparinDispensingRate_LabelUnitContainer ,names.o_PreTreatmentCreate_heparinStopTime_LabelUnitContainer, names.o_PreTreatmentCreate_acidConcentrate_LabelUnitContainer ,names.o_PreTreatmentCreate_bicarbonateConcentrate_LabelUnitContainer, names.o_PreTreatmentCreate_dialyzerType_LabelUnitContainer ,names.o_PreTreatmentCreate_dialysateTemperature_LabelUnitContainer, names.o_PreTreatmentCreate_salineBolusVolume_LabelUnitContainer ] -BUTTON_TYPE =["Select Rx","Edit Rx","Clear All"] +BUTTON_TYPE = ["Select Rx","Edit Rx","Clear All"] VITALS = ["OFF","5","10","15","20","30","60"] BICARBONATE = ["Sodium Bicarbonate"] @@ -182,7 +181,6 @@ utility.set_value_based_on_target(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster, heparin_bolus_volume) test.endSection() - test.startSection("Verification of heparin dispensing rate values") test.compare(waitForObject(names.o_PreTreatmentCreate_heparinDispensingRate_LabelUnitContainer).text, HEPARIN_DISPENSING_RATE, "Parameter should be -> "+str(HEPARIN_DISPENSING_RATE)) mouseClick(waitForObject(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster)) @@ -292,7 +290,7 @@ validateButton = waitForObject(names.o_PreTreatmentButton) #Check the button text - validateText = waitForObject(utility.button_text_obj(VALIDATE)) + validateText = waitForObject(utility.setObjectText(text=VALIDATE,obj =names.o_PreTreatmentCreate_Text)) test.compare(validateText.text, VALIDATE, "Button text should be"+str(VALIDATE)) test.compare(validateButton.enabled, True, "Validate button is enabled") mouseClick(waitForObject(validateButton)) @@ -320,7 +318,7 @@ test.compare(waitForObjectExists(names.o_PreTreatmentCreate_qrCode_Image).visible, True,"QR Code is visible") #Check the confirm button text and perform the mouse click confirmButton = waitForObject(names.o_PreTreatmentButton) - confirmText = waitForObject(utility.button_text_obj(CONFIRM)) + confirmText = waitForObject(utility.setObjectText(text=CONFIRM,obj =names.o_PreTreatmentCreate_Text)) test.compare(confirmText.text, CONFIRM, "Button text should be"+str(CONFIRM)) test.compare(confirmButton.enabled, True, "Confirm button is enabled") mouseClick(waitForObject(confirmButton)) @@ -353,9 +351,8 @@ vHeparinDispensingRateRejectReason = 0, vHeparinBolusVolumeRejectReason = 0 ) - utils.waitForGUI(3) - mouseClick(waitForObjectExists(names.o_PreTreatmentButton)) - utility.select_different_dropdown(names.o_prescription_menuButton,BUTTON_TYPE,0) + mouseClick(waitForObject(names.o_PreTreatmentButton,1000)) + utility.select_different_dropdown(names.o_prescription_menuButton,BUTTON_TYPE,1) 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]: @@ -439,8 +436,7 @@ vHeparinDispensingRateRejectReason = 0, vHeparinBolusVolumeRejectReason = 0 ) - utils.waitForGUI(1) - mouseClick(waitForObjectExists(names.o_PreTreatmentButton)) + mouseClick(waitForObject(names.o_PreTreatmentButton,1000)) 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") @@ -507,7 +503,6 @@ # verify Standby screen test.verify(waitForObjectExists(names.o_standByScreen_MainHome), "In Standby") - td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0) test.startSection("Verfiy the treatement parameter validation") @@ -518,21 +513,12 @@ verify_create_custom_treatment_parameter() test.endSection() - # test.startSection("Verify the validate function with out entering Patient ID") - # td.td_operation_mode(TDOpModes.MODE_STAN.value) - # # verify Standby screen - # test.verify(waitForObjectExists(names.o_standByScreen_MainHome), "In Standby") - # td.td_operation_mode(TDOpModes.MODE_TPAR.value, 0) - # verify_create_custom_treatment_parameter() - # test.endSection() - test.startSection("Verify the slider function without Patient ID") verify_custom_treatment_slider() test.endSection() verify_editRx_Button() verfiy_clearall_Button() - verify_custom_treatment_record_rejected() utils.tstDone()