Elffuss BraidHub

kikocis/continue public

test: add force autocomplete test case

- Adds `forceCompletion` method to `AutocompleteActions` to trigger autocomplete via command.
- Includes new test case to verify forced autocomplete functionality.
- Attempted to test these tests to the best of my ability`
Changeset3efa2290798ded6ceee4b0393d48576fc6b6b441574a477822c1efa608d962f2
Authorshamanic <shamanicbeatbox@gmail.com> · 2025-06-07 05:03 +01:00
Committershamanic <shamanicbeatbox@gmail.com> · 2025-06-07 05:03 +01:00
Parents951aa1c26a3e

Browse the files at this changeset

2 files changed

modified extensions/vscode/e2e/actions/Autocomplete.actions.ts +14 −1
@@ -1,5 +1,5 @@
11 import { expect } from "chai";
2-import { TextEditor } from "vscode-extension-tester";
2+import { TextEditor, VSBrowser, Workbench } from "vscode-extension-tester";
33
44 import { DEFAULT_TIMEOUT } from "../constants";
55 import { AutocompleteSelectors } from "../selectors/Autocomplete.selectors";
@@ -29,4 +29,17 @@
2929 );
3030 expect(ghostText1).to.equal(messagePair1.llmResponse);
3131 }
32+
33+ public static async forceCompletion(editor: TextEditor): Promise<string> {
34+ await editor.setText("def main():\n ");
35+ await editor.moveCursor(2, 5);
36+
37+ await new Workbench().executeCommand("Continue: Force Autocomplete");
38+
39+ const ghostText = await TestUtils.waitForSuccess(() =>
40+ AutocompleteSelectors.getGhostTextContent(VSBrowser.instance.driver)
41+ );
42+
43+ return ghostText;
44+ }
3245 }
modified extensions/vscode/e2e/tests/Autocomplete.test.ts +5 −0
@@ -1,3 +1,4 @@
1+import { expect } from "chai";
12 import { EditorView, TextEditor } from "vscode-extension-tester";
23
34 import { AutocompleteActions } from "../actions/Autocomplete.actions";
@@ -23,4 +24,8 @@
2324 it("Should display completions", async () => {
2425 await AutocompleteActions.testCompletions(editor);
2526 }).timeout(DEFAULT_TIMEOUT.XL);
27+ it("Should force a completion using the command", async () => {
28+ const ghostText = await AutocompleteActions.forceCompletion(editor);
29+ expect(ghostText).to.not.be.empty;
30+ }).timeout(DEFAULT_TIMEOUT.XL);
2631 });