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`
This commit is contained in:
parent
cc507687eb
commit
dcffd3529f
2 changed files with 19 additions and 1 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from "chai";
|
||||
import { TextEditor } from "vscode-extension-tester";
|
||||
import { TextEditor, VSBrowser, Workbench } from "vscode-extension-tester";
|
||||
|
||||
import { DEFAULT_TIMEOUT } from "../constants";
|
||||
import { AutocompleteSelectors } from "../selectors/Autocomplete.selectors";
|
||||
|
|
@ -29,4 +29,17 @@ export class AutocompleteActions {
|
|||
);
|
||||
expect(ghostText1).to.equal(messagePair1.llmResponse);
|
||||
}
|
||||
|
||||
public static async forceCompletion(editor: TextEditor): Promise<string> {
|
||||
await editor.setText("def main():\n ");
|
||||
await editor.moveCursor(2, 5);
|
||||
|
||||
await new Workbench().executeCommand("Continue: Force Autocomplete");
|
||||
|
||||
const ghostText = await TestUtils.waitForSuccess(() =>
|
||||
AutocompleteSelectors.getGhostTextContent(VSBrowser.instance.driver)
|
||||
);
|
||||
|
||||
return ghostText;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { expect } from "chai";
|
||||
import { EditorView, TextEditor } from "vscode-extension-tester";
|
||||
|
||||
import { AutocompleteActions } from "../actions/Autocomplete.actions";
|
||||
|
|
@ -23,4 +24,8 @@ describe("Autocomplete", () => {
|
|||
it("Should display completions", async () => {
|
||||
await AutocompleteActions.testCompletions(editor);
|
||||
}).timeout(DEFAULT_TIMEOUT.XL);
|
||||
it("Should force a completion using the command", async () => {
|
||||
const ghostText = await AutocompleteActions.forceCompletion(editor);
|
||||
expect(ghostText).to.not.be.empty;
|
||||
}).timeout(DEFAULT_TIMEOUT.XL);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue