AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(frontend): find the chat's Stop button by its exact name in the copilot tests (#15352)
Reinier van der Leer01e7e28308d8
diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-content.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-content.test.tsxindex cc951d8f22..cbbdc562e4 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-content.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-content.test.tsx@@ -263,7 +263,7 @@ describe.each(STREAM_PATHS)("on the %s path", (path) => {await waitFor(() => {- expect(screen.queryByRole("button", { name: /stop/i })).toBeNull();+ expect(screen.queryByRole("button", { name: "Stop" })).toBeNull();expect(screen.queryByRole("button", { name: /submit/i }),).not.toBeNull();diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-errors.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-errors.test.tsxindex 65523eae33..0527e9db7d 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-errors.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-errors.test.tsx@@ -342,7 +342,7 @@ describe.each(STREAM_PATHS)("on the %s path", (path) => {) as HTMLTextAreaElement;expect(input.disabled).toBe(false);});- expect(screen.queryByRole("button", { name: /stop/i })).toBeNull();+ expect(screen.queryByRole("button", { name: "Stop" })).toBeNull();});});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-lifecycle.test.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-lifecycle.test.tsxindex 2551bdf4fa..aca909c54b 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-lifecycle.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/autopilot-lifecycle.test.tsx@@ -83,15 +83,13 @@ describe.each(STREAM_PATHS)("on the %s path", (path) => {await typeAndSend("hi");- expect(- await screen.findByRole("button", { name: /stop/i }),- ).toBeDefined();+ expect(await screen.findByRole("button", { name: "Stop" })).toBeDefined();expect(await screen.findByText("Hi.", undefined, { timeout: 5000 }),).toBeDefined();await waitFor(() => {- expect(screen.queryByRole("button", { name: /stop/i })).toBeNull();+ expect(screen.queryByRole("button", { name: "Stop" })).toBeNull();});});diff --git a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/sse-helpers.tsx b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/sse-helpers.tsxindex 8b89f4f497..0340807632 100644--- a/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/sse-helpers.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/copilot/__tests__/sse-helpers.tsx@@ -222,7 +222,7 @@ export async function typeAndSend(text: string) {/** Stop ignores taps for a moment after it appears; wait until it takes one. */export async function clickStop() {const user = userEvent.setup();- const stop = await screen.findByRole("button", { name: /stop/i });+ const stop = await screen.findByRole("button", { name: "Stop" });await waitFor(() => expect(stop.hasAttribute("disabled")).toBe(false), {timeout: 3000,});