From 5dfd16359d46dee33a69062b21507f5fd0623ea7 Mon Sep 17 00:00:00 2001 From: canvrno <46584286+canvrno@users.noreply.github.com> Date: Thu, 4 Sep 2025 22:46:23 -0700 Subject: [PATCH] e2e tests for slash/mentions in chat text area (#6022) Co-authored-by: Kevin Bond --- src/test/e2e/chat.test.ts | 80 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) diff --git a/src/test/e2e/chat.test.ts b/src/test/e2e/chat.test.ts index 995dc749..0ad01d33 100644 --- a/src/test/e2e/chat.test.ts +++ b/src/test/e2e/chat.test.ts @@ -47,3 +47,83 @@ e2e("Chat - can send messages and switch between modes", async ({ helper, page, await expect(sidebar.getByText("API Request Failed")).toBeVisible() }) + +e2e("Chat - slash commands preserve following text", async ({ helper, page, sidebar }) => { + // Sign in + await helper.signin(sidebar) + + const inputbox = sidebar.getByTestId("chat-input") + await expect(inputbox).toBeVisible() + + // Type partial slash command to trigger menu + await inputbox.focus() + await inputbox.type("/new") + + // Wait for menu to be visible and select first option with Tab + await inputbox.press("Tab") + await expect(inputbox).toHaveValue("/newtask ") + + // Add following text to verify it works correctly + await inputbox.type("following text should be preserved") + await expect(inputbox).toHaveValue("/newtask following text should be preserved") +}) + +e2e("Chat - @ mentions preserve following text", async ({ helper, page, sidebar }) => { + // Sign in + await helper.signin(sidebar) + + const inputbox = sidebar.getByTestId("chat-input") + await expect(inputbox).toBeVisible() + + // Type partial @ mention to trigger menu + await inputbox.focus() + await inputbox.type("@prob") + + // Wait for menu to be visible and select first option with Tab + await inputbox.press("Tab") + await expect(inputbox).toHaveValue("@problems ") + + // Add following text to verify it works correctly + await inputbox.type("following text should be preserved") + await expect(inputbox).toHaveValue("@problems following text should be preserved") +}) + +e2e("Chat - partial slash command completion preserves text", async ({ helper, page, sidebar }) => { + // Sign in + await helper.signin(sidebar) + + const inputbox = sidebar.getByTestId("chat-input") + await expect(inputbox).toBeVisible() + + // Type partial slash command and complete it + await inputbox.focus() + await inputbox.type("/new") + + // Complete the command with Tab + await inputbox.press("Tab") + await expect(inputbox).toHaveValue("/newtask ") + + // Add following text after completion + await inputbox.type("some important text after") + await expect(inputbox).toHaveValue("/newtask some important text after") +}) + +e2e("Chat - partial @ mention completion preserves text", async ({ helper, page, sidebar }) => { + // Sign in + await helper.signin(sidebar) + + const inputbox = sidebar.getByTestId("chat-input") + await expect(inputbox).toBeVisible() + + // Type partial @ mention and complete it + await inputbox.focus() + await inputbox.type("@prob") + + // Complete the mention with Tab + await inputbox.press("Tab") + await expect(inputbox).toHaveValue("@problems ") + + // Add following text after completion + await inputbox.type("important content follows") + await expect(inputbox).toHaveValue("@problems important content follows") +})