diff --git a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx index 73182fd9e8e..8e88e72bb40 100644 --- a/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx +++ b/ui/litellm-dashboard/src/app/(dashboard)/guardrails/_components/add_guardrail_form.test.tsx @@ -25,13 +25,12 @@ describe("AddGuardrailForm close behavior", () => { it("keeps the wizard bounded and scrollable on narrow viewports", () => { renderForm(); - const dialog = screen.getByText("Create guardrail").closest('[data-slot="dialog-content"]'); + const dialog = screen.getByRole("dialog"); expect(dialog).toHaveClass("max-w-[1000px]"); expect(dialog).toHaveClass("w-[calc(100vw-2rem)]"); - const scrollRegion = dialog?.querySelector(".overflow-x-auto.overflow-y-auto"); - expect(scrollRegion).not.toBeNull(); - expect(scrollRegion).toHaveClass("max-w-full"); + const scrollRegion = screen.getByTestId("guardrail-wizard-scroll-region"); + expect(scrollRegion).toHaveClass("max-w-full", "overflow-x-auto", "overflow-y-auto"); }); it("does not close when the user clicks outside the modal on the mask", () => {