diff --git a/chainforge/react-server/src/backend/__test__/promptNodeBehavior.test.tsx b/chainforge/react-server/src/backend/__test__/promptNodeBehavior.test.tsx index 0a406c3c1..27bbcb8b2 100644 --- a/chainforge/react-server/src/backend/__test__/promptNodeBehavior.test.tsx +++ b/chainforge/react-server/src/backend/__test__/promptNodeBehavior.test.tsx @@ -174,7 +174,9 @@ const type = (container: HTMLElement, value: string) => }); const clickRun = () => - fireEvent.click(screen.getByRole("button", { name: "▶" })); + // By its text, not getByRole: in jsdom, a role query works out every + // element's accessible role and name, which here takes about a second + fireEvent.click(screen.getByText("▶").closest("button") as HTMLElement); /** What was saved to the flow, by property. */ const saved = (prop: string) => @@ -303,7 +305,9 @@ describe("a Prompt Node, as it always has", () => { // The variant controls' trash icon comes before the models' const trash = container.querySelector(".tabler-icon-trash") as SVGElement; fireEvent.click(trash.closest("button") as HTMLButtonElement); - fireEvent.click(await screen.findByRole("button", { name: "Confirm" })); + fireEvent.click( + (await screen.findByText("Confirm")).closest("button") as HTMLElement, + ); await wait(0); expect(saved("prompt")).toEqual([["A", "C"]]); expect(saved("promptVariantLabel")).toEqual([]); diff --git a/chainforge/react-server/src/backend/__test__/promptNodeRunEdits.test.tsx b/chainforge/react-server/src/backend/__test__/promptNodeRunEdits.test.tsx index bbc335690..3d3b21752 100644 --- a/chainforge/react-server/src/backend/__test__/promptNodeRunEdits.test.tsx +++ b/chainforge/react-server/src/backend/__test__/promptNodeRunEdits.test.tsx @@ -165,7 +165,9 @@ const type = (container: HTMLElement, value: string) => }); const clickRun = () => - fireEvent.click(screen.getByRole("button", { name: "▶" })); + // By its text, not getByRole: in jsdom, a role query works out every + // element's accessible role and name, which here takes about a second + fireEvent.click(screen.getByText("▶").closest("button") as HTMLElement); /** What each query was sent: its prompt, its models and its inputs. */ const promptsSent = () => mockQueryLLM.mock.calls.map((call) => call[3]);