| 1 | import { expect } from "chai"; |
| 2 | import { EditorView, TextEditor } from "vscode-extension-tester"; |
| 3 | |
| 4 | import { AutocompleteActions } from "../actions/Autocomplete.actions"; |
| 5 | import { GlobalActions } from "../actions/Global.actions"; |
| 6 | import { DEFAULT_TIMEOUT } from "../constants"; |
| 7 | |
| 8 | describe("Autocomplete", () => { |
| 9 | let editor: TextEditor; |
| 10 | |
| 11 | before(async function () { |
| 12 | this.timeout(DEFAULT_TIMEOUT.MD); |
| 13 | process.env.NEXT_EDIT_TEST_ENABLED = "false"; |
| 14 | await GlobalActions.disableNextEdit(); |
| 15 | }); |
| 16 | |
| 17 | beforeEach(async function () { |
| 18 | this.timeout(DEFAULT_TIMEOUT.XL); |
| 19 | |
| 20 | await GlobalActions.openTestWorkspace(); |
| 21 | ({ editor } = await GlobalActions.createAndOpenNewTextFile()); |
| 22 | }); |
| 23 | |
| 24 | afterEach(async function () { |
| 25 | this.timeout(DEFAULT_TIMEOUT.XL); |
| 26 | await editor.clearText(); |
| 27 | await new EditorView().closeAllEditors(); |
| 28 | }); |
| 29 | |
| 30 | it("Should display completions", async () => { |
| 31 | await AutocompleteActions.testCompletions(editor); |
| 32 | }).timeout(DEFAULT_TIMEOUT.XL); |
| 33 | it("Should force a completion using the command", async () => { |
| 34 | const ghostText = await AutocompleteActions.forceCompletion(editor); |
| 35 | expect(ghostText).to.not.be.empty; |
| 36 | }).timeout(DEFAULT_TIMEOUT.XL); |
| 37 | }); |