| 1 | import { |
| 2 | EditorView, |
| 3 | InputBox, |
| 4 | Key, |
| 5 | TextEditor, |
| 6 | Workbench, |
| 7 | } from "vscode-extension-tester"; |
| 8 | |
| 9 | import { AutocompleteActions } from "../actions/Autocomplete.actions"; |
| 10 | import { DEFAULT_TIMEOUT } from "../constants"; |
| 11 | import { SSHSelectors } from "../selectors/SSH.selectors"; |
| 12 | import { TestUtils } from "../TestUtils"; |
| 13 | |
| 14 | describe("SSH", function () { |
| 15 | if (process.env.IGNORE_SSH_TESTS === "true") { |
| 16 | it("Skipping SSH tests", () => { |
| 17 | console.log("Skipping SSH tests due to IGNORE_SSH_TESTS being set"); |
| 18 | }); |
| 19 | return; |
| 20 | } |
| 21 | |
| 22 | it("Should display completions", async () => { |
| 23 | await TestUtils.waitForSuccess(async () => { |
| 24 | await new Workbench().executeCommand( |
| 25 | "Remote-SSH: Connect Current Window to Host...", |
| 26 | ); |
| 27 | await ( |
| 28 | await InputBox.create(DEFAULT_TIMEOUT.MD) |
| 29 | ).selectQuickPick("ssh-test-container"); |
| 30 | }); |
| 31 | |
| 32 | await TestUtils.waitForSuccess( |
| 33 | () => SSHSelectors.connectedToRemoteConfirmationMessage(), |
| 34 | DEFAULT_TIMEOUT.MD, |
| 35 | ); |
| 36 | |
| 37 | await TestUtils.waitForSuccess(async () => { |
| 38 | await new Workbench().executeCommand("File: Open File..."); |
| 39 | const inputBox = await InputBox.create(DEFAULT_TIMEOUT.MD); |
| 40 | await inputBox.setText("/home/ec2-user/test-folder/main.py"); |
| 41 | await inputBox.selectQuickPick("main.py"); |
| 42 | await inputBox.sendKeys(Key.ENTER); |
| 43 | }, DEFAULT_TIMEOUT.MD); |
| 44 | |
| 45 | const editor = await TestUtils.waitForSuccess( |
| 46 | async () => (await new EditorView().openEditor("main.py")) as TextEditor, |
| 47 | ); |
| 48 | |
| 49 | const text = await editor.getText(); |
| 50 | await editor.clearText(); |
| 51 | await AutocompleteActions.testCompletions(editor); |
| 52 | await editor.setText(text); |
| 53 | }) |
| 54 | .timeout(DEFAULT_TIMEOUT.XL) |
| 55 | .retries(4); |
| 56 | }); |