Index: suite_leahi/tst_create_treatment/test.py =================================================================== diff -u -r846e5728f53a1183edfc8e506ffe2e28afea1103 -r2cb969d7088c56bf8ff6384159f08c92b535bbf6 --- suite_leahi/tst_create_treatment/test.py (.../test.py) (revision 846e5728f53a1183edfc8e506ffe2e28afea1103) +++ suite_leahi/tst_create_treatment/test.py (.../test.py) (revision 2cb969d7088c56bf8ff6384159f08c92b535bbf6) @@ -118,6 +118,8 @@ BUTTON_TYPE =["Select Rx","Edit Rx","Clear All"] +VITALS = ["OFF","5","10","15","20","30","60"] +BICARBONATE = ["Sodium Bicarbonate"] def get_bullet_object(screen_obj, num): """ @@ -223,27 +225,38 @@ 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)) - test.compare(OFF_TEXT, waitForObject(names.o_PreTreatmentCreate_heparinDispensingRateControl_OffText).text, "OFF text should be enabled") for heparin_dispensing_rate in CREATE_TREATMENT_PARAMETER_RANGE[HEPARIN_DISPENSING_RATE]: set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, heparin_dispensing_rate) test.endSection() test.startSection("Verification of heparin stop time values") #1. Change Duration -> Verify Heparin Stop Time "active" property is set to off set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, 60) - click_left_until_off(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster) - click_left_until_off(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster) - check_arrow_status(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster, 0.4) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, 0.3) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster, 60) + set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, 75) + heprain_Stop_time = waitForObject(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster) + test.compare(heprain_Stop_time.isActive,False, "Heprain stop time active property is set to False") + # 2. Change Heparin Dispensising Rate from 0.2 to OFF -> Verify Heparing Stop Time is set to OFF + set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, 60) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster, 0.4) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, 0.3) + set_value_based_on_target(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster, 60) click_left_until_off(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster) test.compare(waitForObjectExists(names.o_PreTreatmentCreate_heparinStopTime_OFF_Text).text,"OFF") - # 3. Change Heparin Dispensising Rate from OFF to 0.2 -> Verify Heparin Stop Time "active" property is set to off + + # # 3. Change Heparin Dispensising Rate from OFF to 0.2 -> Verify Heparin Stop Time "active" property is set to off set_value_based_on_target(o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, 0.2) test.compare(waitForObjectExists(names.o_PreTreatmentCreate_heparinStopTime_OFF_Text).text,"-- --") # # 4. When Duration is set to a value -> Verify the max Heparin Stop Time is the Duration value that is set set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, 90) 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 =findObjectById(obj ,"_rightArrow") + test.compare(not right_arrow.enabled, True, "Right arrow is disabled in Heparin stop time field") set_value_based_on_target(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster, "0.2") set_value_based_on_target(names.o_PreTreatmentCreate_durationControl_ValueAdjuster, "480") @@ -300,32 +313,21 @@ test.endSection() - - 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 - ) - utils.waitForGUI(3) + select_different_dropdown(names.o_PreTreatment_vitalsCombobox_BaseCombobox,VITALS,2) + select_different_dropdown(names.o_PreTreatmentCreate_bicarbonateConcentrateComboBox_BaseComboBox,BICARBONATE,0) test.verify(waitForObjectExists(names.o_PreTreatmentCreate_qrCode_Image), "QR Code is visible") - - confirmButton = waitForObject(names.o_PreTreatmentButtom) + #Verify all the parameters are populated + test.compare(waitForObject(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster).value, 500) + test.compare(waitForObject(names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster).value, 600) + test.compare(waitForObject(names.o_PreTreatmentCreate_durationControl_ValueAdjuster).value, 480) + test.compare("{:.1f}".format(waitForObject(names.o_PreTreatmentCreate_heparinBolusVolumeControl_ValueAdjuster).value), "0.4") + test.compare("{:.1f}".format(waitForObject(names.o_PreTreatmentCreate_heparinDispensingRateControl_ValueAdjuster).value), "0.2") + test.compare(waitForObject(names.o_PreTreatmentCreate_heparinStopTimeControl_ValueAdjuster).value, 480) + + 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_operation_mode(TDOpModes.MODE_PRET.value, 0) @@ -358,7 +360,7 @@ vHeparinBolusVolumeRejectReason = 0 ) utils.waitForGUI(3) - mouseClick(waitForObjectExists(names.o_PreTreatmentButtom)) + mouseClick(waitForObjectExists(names.o_PreTreatmentButton)) 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)) @@ -444,10 +446,10 @@ vHeparinDispensingRateRejectReason = 0, vHeparinBolusVolumeRejectReason = 0 ) - utils.waitForGUI(3) - mouseClick(waitForObjectExists(names.o_PreTreatmentButtom)) + utils.waitForGUI(1) + mouseClick(waitForObjectExists(names.o_PreTreatmentButton)) select_different_dropdown(names.o_prescription_menuButton,BUTTON_TYPE,2) - button = waitForObjectExists(names.o_PreTreatmentButtom) + button = waitForObjectExists(names.o_PreTreatmentButton) test.verify(not button.enabled, "Validate that the button is disabled") test.endSection() @@ -474,7 +476,7 @@ # Loop until the value becomes "off" while findObject(object_name).value != 0.0: mouseClick(waitForObject(left_arrow)) - snooze(0.2) # Small delay to allow UI to update + utils.waitForGUI(0.2) # Small delay to allow UI to update def set_value_based_on_target(obj, target_value): """ @@ -527,8 +529,6 @@ test.verify(not left_arrow.enabled, "left arrow button is disabled") test.verify(not right_arrow.enabled, "Right arrow button is disabled") - - def set_parameter_type(text,obj): """ Method to set object property based on text @@ -587,7 +587,7 @@ # Try right-click first mousePress(value_field, Qt.LeftButton) - snooze(0.7) + utils.waitForGUI(0.2) value = value_field.value # If not visible, try left long-press @@ -598,18 +598,17 @@ 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) final_value = waitForObject(value_field_obj).value test.verify(final_value!= value, f"{parameter} slider adjusted correctly to {final_value}") mouseRelease(slider, Qt.LeftButton) - snooze(0.5) + 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), 10000) - snooze(0.5) + waitFor(lambda: not object.exists(slider_obj), 1000) + utils.waitForGUI(0.2) except LookupError as e: test.fail(f"{parameter}: LookupError - {e}") @@ -618,7 +617,7 @@ 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(10) + utils.waitForGUI(5) set_value_with_slider(names.o_PreTreatmentCreate_bloodFlowRateControl_ValueAdjuster,names.o_PreTreatmentCreate_bloodFlowRate_slider_Slider,BLOOD_FLOW_RATE) set_value_with_slider(names.o_PreTreatmentCreate_dialysateFlowRateControl_ValueAdjuster,names.o_PreTreatmentCreate_dialysateFlowRate_slider_Slider,DIALYSATE_FLOW_RATE) set_value_with_slider(names.o_PreTreatmentCreate_durationControl_ValueAdjuster,names.o_PreTreatmentCreate_duration_slider_Slider,DURATION)