Changesets · Branches · Tags · Compare
| Changeset | facdfa77975838b3382163ff66bc3392c17fde1721d270a112c772e4ac4962fe |
|---|---|
| Author | Dallin Romney <dallinromney@gmail.com> · 2025-06-26 13:59 -07:00 |
| Committer | Dallin Romney <dallinromney@gmail.com> · 2025-06-26 13:59 -07:00 |
| Parents | 9bd927d445bd |
8 files changed
modified core/config/sharedConfig.ts +1 −1
| @@ -167,10 +167,10 @@ | ||
| 167 | 167 | if (sharedConfig.readResponseTTS !== undefined) { |
| 168 | 168 | configCopy.experimental.readResponseTTS = sharedConfig.readResponseTTS; |
| 169 | 169 | } |
| 170 | - | |
| 171 | 170 | if (sharedConfig.useCurrentFileAsContext !== undefined) { |
| 172 | 171 | configCopy.experimental.useCurrentFileAsContext = |
| 173 | 172 | sharedConfig.useCurrentFileAsContext; |
| 174 | 173 | } |
| 174 | + | |
| 175 | 175 | return configCopy; |
| 176 | 176 | } |
modified extensions/intellij/rules.md +0 −4
| @@ -1,7 +1,3 @@ | ||
| 1 | ---- | |
| 2 | -globs: "**/intellij**" | |
| 3 | ---- | |
| 4 | - | |
| 5 | 1 | # Continue JetBrains Extension |
| 6 | 2 | |
| 7 | 3 | ## Project Purpose |
modified gui/src/pages/gui/chat-tests/ApplyScenarios.test.tsx +2 −2
| @@ -1,11 +1,11 @@ | ||
| 1 | 1 | import { act } from "@testing-library/react"; |
| 2 | 2 | import { renderWithProviders } from "../../../util/test/render"; |
| 3 | -import { Chat } from "../Chat"; | |
| 4 | 3 | import { |
| 5 | 4 | getElementByTestId, |
| 6 | 5 | verifyNotPresentByTestId, |
| 7 | 6 | verifyNotPresentByText, |
| 8 | -} from "./utils"; | |
| 7 | +} from "../../../util/test/utils"; | |
| 8 | +import { Chat } from "../Chat"; | |
| 9 | 9 | |
| 10 | 10 | test("Chat apply scenarios: handle apply updates and display the accept / reject all buttons", async () => { |
| 11 | 11 | const { ideMessenger } = await renderWithProviders(<Chat />); |
modified gui/src/pages/gui/chat-tests/Chat.test.tsx +2 −2
| @@ -1,12 +1,12 @@ | ||
| 1 | 1 | import { act } from "@testing-library/react"; |
| 2 | 2 | import { addAndSelectMockLlm } from "../../../util/test/config"; |
| 3 | 3 | import { renderWithProviders } from "../../../util/test/render"; |
| 4 | -import { Chat } from "../Chat"; | |
| 5 | 4 | import { |
| 6 | 5 | getElementByTestId, |
| 7 | 6 | getElementByText, |
| 8 | 7 | sendInputWithMockedResponse, |
| 9 | -} from "./utils"; | |
| 8 | +} from "../../../util/test/utils"; | |
| 9 | +import { Chat } from "../Chat"; | |
| 10 | 10 | |
| 11 | 11 | test("should render input box", async () => { |
| 12 | 12 | await renderWithProviders(<Chat />); |
modified gui/src/pages/gui/chat-tests/EditToolScenarios.test.tsx +1 −1
| @@ -14,7 +14,7 @@ | ||
| 14 | 14 | getElementByText, |
| 15 | 15 | sendInputWithMockedResponse, |
| 16 | 16 | verifyNotPresentByTestId, |
| 17 | -} from "./utils"; | |
| 17 | +} from "../../../util/test/utils"; | |
| 18 | 18 | |
| 19 | 19 | const EDIT_WORKSPACE_DIR = "file:///workspace"; |
| 20 | 20 | const EDIT_FILEPATH = "test.txt"; |
deleted gui/src/pages/gui/chat-tests/utils.ts +0 −102
| @@ -1,102 +0,0 @@ | ||
| 1 | -import { screen, waitFor } from "@testing-library/dom"; | |
| 2 | -import { act } from "@testing-library/react"; | |
| 3 | -import { Editor } from "@tiptap/core"; | |
| 4 | -import { ChatMessage } from "core"; | |
| 5 | -import { MockIdeMessenger } from "../../../context/MockIdeMessenger"; | |
| 6 | - | |
| 7 | -function logDomText() { | |
| 8 | - const bodyText = document.body.innerHTML; | |
| 9 | - const parser = new DOMParser(); | |
| 10 | - const doc = parser.parseFromString(bodyText, "text/html"); | |
| 11 | - let cleaned = doc.body.textContent ?? ""; | |
| 12 | - cleaned = cleaned?.replace( | |
| 13 | - "No resultsAaModelsRulesDocsPromptsToolsMCPCreate your first assistant", | |
| 14 | - "", | |
| 15 | - ); | |
| 16 | - cleaned = cleaned?.replace( | |
| 17 | - "Alt⏎ Active file⏎ Enter⏎Log in to access a free trial of theModels Add-OnLog in to Continue HubOr, configure your own models", | |
| 18 | - "", | |
| 19 | - ); | |
| 20 | - cleaned = cleaned.replaceAll("Select model", ""); | |
| 21 | - cleaned = cleaned.replaceAll("Mock LLM", ""); | |
| 22 | - cleaned = cleaned.replaceAll(/^Chat|Chat$/g, ""); | |
| 23 | - console.log(cleaned || "No body content"); | |
| 24 | -} | |
| 25 | - | |
| 26 | -export function logAllTestIds() { | |
| 27 | - const elements = document.querySelectorAll("*"); | |
| 28 | - | |
| 29 | - const testIds = Array.from(elements) | |
| 30 | - .map((el) => Array.from(el.attributes)) | |
| 31 | - .flat() | |
| 32 | - .filter((a) => a.name === "data-testid") | |
| 33 | - .map((a) => a.value); | |
| 34 | - console.log("Available test ids", testIds); | |
| 35 | -} | |
| 36 | -export async function getElementByTestId(testId: string): Promise<HTMLElement> { | |
| 37 | - try { | |
| 38 | - const testIdElement = await waitFor(() => screen.findByTestId(testId)); | |
| 39 | - expect(testIdElement).toBeInTheDocument(); | |
| 40 | - return testIdElement; | |
| 41 | - } catch (e) { | |
| 42 | - logAllTestIds(); | |
| 43 | - throw new Error(`Element with testId "${testId}" not found`); | |
| 44 | - } | |
| 45 | -} | |
| 46 | - | |
| 47 | -export async function verifyNotPresentByTestId(testId: string): Promise<void> { | |
| 48 | - const element = await waitFor(() => screen.queryByTestId(testId)); | |
| 49 | - expect(element).not.toBeInTheDocument(); | |
| 50 | -} | |
| 51 | - | |
| 52 | -export async function verifyNotPresentByText(text: string): Promise<void> { | |
| 53 | - const element = screen.queryByText(text); | |
| 54 | - expect(element).not.toBeInTheDocument(); | |
| 55 | -} | |
| 56 | - | |
| 57 | -export async function getElementByText(text: string): Promise<HTMLElement> { | |
| 58 | - try { | |
| 59 | - const textElement = await waitFor(() => screen.findByText(text)); | |
| 60 | - expect(textElement).toBeInTheDocument(); | |
| 61 | - return textElement; | |
| 62 | - } catch (e) { | |
| 63 | - logDomText(); | |
| 64 | - throw new Error(`Element with text "${text}" not found.`); | |
| 65 | - } | |
| 66 | -} | |
| 67 | - | |
| 68 | -export async function getMainEditor(): Promise<Editor> { | |
| 69 | - const editorElement = await getElementByTestId("editor-input-main"); | |
| 70 | - if ("editor" in editorElement) { | |
| 71 | - return editorElement.editor as Editor; | |
| 72 | - } else { | |
| 73 | - throw new Error("Main editor not found within editor container"); | |
| 74 | - } | |
| 75 | -} | |
| 76 | - | |
| 77 | -export async function sendInputWithMockedResponse( | |
| 78 | - ideMessenger: MockIdeMessenger, | |
| 79 | - input: string, | |
| 80 | - response: ChatMessage[], | |
| 81 | -): Promise<void> { | |
| 82 | - // Setup the mock response before any actions | |
| 83 | - ideMessenger.chatResponse = response; | |
| 84 | - | |
| 85 | - // Wait for the editor to be in the document | |
| 86 | - const editor = await getMainEditor(); | |
| 87 | - | |
| 88 | - // Find the submit button | |
| 89 | - const sendButton = await getElementByTestId("submit-input-button"); | |
| 90 | - | |
| 91 | - // Insert content into the editor | |
| 92 | - await act(async () => { | |
| 93 | - editor.commands.insertContent(input); | |
| 94 | - }); | |
| 95 | - | |
| 96 | - await getElementByText(input); | |
| 97 | - | |
| 98 | - // Click the send button | |
| 99 | - await act(async () => { | |
| 100 | - sendButton.click(); | |
| 101 | - }); | |
| 102 | -} |
modified gui/src/redux/slices/profilesSlice.ts +2 −2
| @@ -19,7 +19,7 @@ | ||
| 19 | 19 | preferencesByProfileId: Record<string, PreferencesState>; |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -export const defaultProfilesState: ProfilesState = { | |
| 22 | +const initialState: ProfilesState = { | |
| 23 | 23 | preferencesByProfileId: {}, |
| 24 | 24 | selectedProfileId: null, |
| 25 | 25 | selectedOrganizationId: null, |
| @@ -51,7 +51,7 @@ | ||
| 51 | 51 | |
| 52 | 52 | export const profilesSlice = createSlice({ |
| 53 | 53 | name: "profiles", |
| 54 | - initialState: defaultProfilesState, | |
| 54 | + initialState, | |
| 55 | 55 | reducers: { |
| 56 | 56 | setSelectedProfile: (state, { payload }: PayloadAction<string | null>) => { |
| 57 | 57 | state.selectedProfileId = payload; |
added gui/src/util/test/utils.ts +102 −0
| @@ -0,0 +1,102 @@ | ||
| 1 | +import { screen, waitFor } from "@testing-library/dom"; | |
| 2 | +import { act } from "@testing-library/react"; | |
| 3 | +import { Editor } from "@tiptap/core"; | |
| 4 | +import { ChatMessage } from "core"; | |
| 5 | +import { MockIdeMessenger } from "../../context/MockIdeMessenger"; | |
| 6 | + | |
| 7 | +function logDomText() { | |
| 8 | + const bodyText = document.body.innerHTML; | |
| 9 | + const parser = new DOMParser(); | |
| 10 | + const doc = parser.parseFromString(bodyText, "text/html"); | |
| 11 | + let cleaned = doc.body.textContent ?? ""; | |
| 12 | + cleaned = cleaned?.replace( | |
| 13 | + "No resultsAaModelsRulesDocsPromptsToolsMCPCreate your first assistant", | |
| 14 | + "", | |
| 15 | + ); | |
| 16 | + cleaned = cleaned?.replace( | |
| 17 | + "Alt⏎ Active file⏎ Enter⏎Log in to access a free trial of theModels Add-OnLog in to Continue HubOr, configure your own models", | |
| 18 | + "", | |
| 19 | + ); | |
| 20 | + cleaned = cleaned.replaceAll("Select model", ""); | |
| 21 | + cleaned = cleaned.replaceAll("Mock LLM", ""); | |
| 22 | + cleaned = cleaned.replaceAll(/^Chat|Chat$/g, ""); | |
| 23 | + console.log(cleaned || "No body content"); | |
| 24 | +} | |
| 25 | + | |
| 26 | +export function logAllTestIds() { | |
| 27 | + const elements = document.querySelectorAll("*"); | |
| 28 | + | |
| 29 | + const testIds = Array.from(elements) | |
| 30 | + .map((el) => Array.from(el.attributes)) | |
| 31 | + .flat() | |
| 32 | + .filter((a) => a.name === "data-testid") | |
| 33 | + .map((a) => a.value); | |
| 34 | + console.log("Available test ids", testIds); | |
| 35 | +} | |
| 36 | +export async function getElementByTestId(testId: string): Promise<HTMLElement> { | |
| 37 | + try { | |
| 38 | + const testIdElement = await waitFor(() => screen.findByTestId(testId)); | |
| 39 | + expect(testIdElement).toBeInTheDocument(); | |
| 40 | + return testIdElement; | |
| 41 | + } catch (e) { | |
| 42 | + logAllTestIds(); | |
| 43 | + throw new Error(`Element with testId "${testId}" not found`); | |
| 44 | + } | |
| 45 | +} | |
| 46 | + | |
| 47 | +export async function verifyNotPresentByTestId(testId: string): Promise<void> { | |
| 48 | + const element = await waitFor(() => screen.queryByTestId(testId)); | |
| 49 | + expect(element).not.toBeInTheDocument(); | |
| 50 | +} | |
| 51 | + | |
| 52 | +export async function verifyNotPresentByText(text: string): Promise<void> { | |
| 53 | + const element = screen.queryByText(text); | |
| 54 | + expect(element).not.toBeInTheDocument(); | |
| 55 | +} | |
| 56 | + | |
| 57 | +export async function getElementByText(text: string): Promise<HTMLElement> { | |
| 58 | + try { | |
| 59 | + const textElement = await waitFor(() => screen.findByText(text)); | |
| 60 | + expect(textElement).toBeInTheDocument(); | |
| 61 | + return textElement; | |
| 62 | + } catch (e) { | |
| 63 | + logDomText(); | |
| 64 | + throw new Error(`Element with text "${text}" not found.`); | |
| 65 | + } | |
| 66 | +} | |
| 67 | + | |
| 68 | +export async function getMainEditor(): Promise<Editor> { | |
| 69 | + const editorElement = await getElementByTestId("editor-input-main"); | |
| 70 | + if ("editor" in editorElement) { | |
| 71 | + return editorElement.editor as Editor; | |
| 72 | + } else { | |
| 73 | + throw new Error("Main editor not found within editor container"); | |
| 74 | + } | |
| 75 | +} | |
| 76 | + | |
| 77 | +export async function sendInputWithMockedResponse( | |
| 78 | + ideMessenger: MockIdeMessenger, | |
| 79 | + input: string, | |
| 80 | + response: ChatMessage[], | |
| 81 | +): Promise<void> { | |
| 82 | + // Setup the mock response before any actions | |
| 83 | + ideMessenger.chatResponse = response; | |
| 84 | + | |
| 85 | + // Wait for the editor to be in the document | |
| 86 | + const editor = await getMainEditor(); | |
| 87 | + | |
| 88 | + // Find the submit button | |
| 89 | + const sendButton = await getElementByTestId("submit-input-button"); | |
| 90 | + | |
| 91 | + // Insert content into the editor | |
| 92 | + await act(async () => { | |
| 93 | + editor.commands.insertContent(input); | |
| 94 | + }); | |
| 95 | + | |
| 96 | + await getElementByText(input); | |
| 97 | + | |
| 98 | + // Click the send button | |
| 99 | + await act(async () => { | |
| 100 | + sendButton.click(); | |
| 101 | + }); | |
| 102 | +} |