Elffuss BraidHub

kikocis/continue public

9a76840d7230 · 2.3 KiBRawPermalink
1import { expect } from "chai";
2import {
3 EditorView,
4 InputBox,
5 Key,
6 TextEditor,
7 Workbench,
8} from "vscode-extension-tester";
9
10import { GlobalActions } from "../actions/Global.actions";
11import { DEFAULT_TIMEOUT } from "../constants";
12
13describe("Prompt file", () => {
14 let editor: TextEditor;
15
16 beforeEach(async function () {
17 this.timeout(DEFAULT_TIMEOUT.XL);
18
19 await GlobalActions.openTestWorkspace();
20 await new Workbench().executeCommand("File: New Untitled Text File");
21 await new Workbench().executeCommand("Change Language Mode");
22 const inputBox = await new InputBox();
23 await inputBox.setText("Prompt Language");
24 await inputBox.confirm();
25 editor = (await new EditorView().openEditor("Untitled-1")) as TextEditor;
26 });
27
28 afterEach(async function () {
29 this.timeout(DEFAULT_TIMEOUT.XL);
30 await editor.clearText();
31 await new EditorView().closeAllEditors();
32 });
33
34 it("Should display intellisense for default context providers and preamble", async () => {
35 // Check that "@" dropdown in body works
36 const providers = [
37 "currentFile",
38 "open",
39 "os",
40 "problems",
41 "repo-map",
42 "terminal",
43 "tree",
44 ];
45
46 for (const provider of providers) {
47 // Type the @ symbol to trigger completion
48 await editor.typeText("@");
49
50 // Wait a moment for the completion to appear
51 await new Promise((resolve) => setTimeout(resolve, 500));
52
53 // Type the first few characters
54 await editor.typeText(provider.slice(0, 2));
55
56 // Wait for completion popup to update
57 await new Promise((resolve) => setTimeout(resolve, 300));
58
59 // Use Tab to accept completion instead of Enter
60 await editor.typeText(Key.TAB);
61
62 const text = await editor.getText();
63 expect(text).to.include("@" + provider);
64 await editor.clearText();
65 }
66
67 // Check that dropdown for properties in preamble works
68 // await editor.typeText(Key.ENTER);
69 // await editor.typeText(Key.ENTER);
70 // await editor.typeText("---");
71 // await editor.typeText(Key.UP);
72 // await editor.typeText(Key.UP);
73 // await editor.typeText(Key.SPACE);
74 // await editor.typeText(Key.BACK_SPACE);
75 // await editor.typeText(Key.ENTER);
76 // const text = await editor.getText();
77 // expect(text).equals("description: \n\n---");
78 }).timeout(DEFAULT_TIMEOUT.XL);
79});