Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions rascal-vscode-extension/src/test/vscode-suite/dsl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ end
it("code lens works", async function() {
if (errorRecovery) { this.skip(); }
const editor = await ide.openModule(TestWorkspace.picoFile);
const lens = await driver.wait(() => editor.getCodeLens("Rename variables a to b."), Delays.verySlow, "Rename lens should be available");
await lens!.click();
await ide.clickCodeLens(editor, "Rename variables a to b.", Delays.verySlow, "Rename lens should be available");
await ide.assertLineBecomes(editor, 9, "b := 2;", "a variable should be changed to b");
});

Expand Down
11 changes: 1 addition & 10 deletions rascal-vscode-extension/src/test/vscode-suite/repl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,7 @@ describe('REPL', function () {
it("import module and run in terminal", async () => {
const editor = await ide.openModule(TestWorkspace.libCallFile);

driver.wait(async () => {
try {
const lens = await ide.findCodeLens(editor, "Run in new Rascal terminal");
await lens!.click();
return true;
} catch (e) {
console.log("codelens clicking failed");
return false;
}
}, Delays.slow, "Codelens for 'Run in new Rascal terminal'");
await ide.clickCodeLens(editor, "Run in new Rascal terminal");
const repl = new RascalREPL(bench, driver);
await repl.connect();
expect(repl.lastOutput).is.equal("5\nint: 0");
Expand Down
16 changes: 11 additions & 5 deletions rascal-vscode-extension/src/test/vscode-suite/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { assert, expect } from "chai";
import { stat, unlink } from "fs/promises";
import * as os from 'os';
import { env } from "process";
import { BottomBarPanel, By, CodeLens, ContentAssist, EditorView, Key, Locator, TerminalView, TextEditor, VSBrowser, WebDriver, WebElement, WebElementCondition, Workbench, until } from "vscode-extension-tester";
import { BottomBarPanel, By, ContentAssist, EditorView, Key, Locator, TerminalView, TextEditor, VSBrowser, WebDriver, WebElement, WebElementCondition, Workbench, until } from "vscode-extension-tester";
import path = require("path");

export async function sleep(ms: number) {
Expand Down Expand Up @@ -428,10 +428,16 @@ export class IDEOperations {
}
}


findCodeLens(editor: TextEditor, name: string, timeout = Delays.slow, message = `Cannot find code lens: ${name}`): Promise<CodeLens | undefined> {
return this.driver.wait(() => ignoreFails(editor.getCodeLens(name)), timeout, message);

async clickCodeLens(editor: TextEditor, name: string, timeout = Delays.slow, message = `Cannot click code lens: ${name}`): Promise<void> {
await this.driver.wait(async () => {
try {
const lens = await editor.getCodeLens(name);
await lens!.click();
return true;
} catch (_e) {
return false;
}
}, timeout, message);
}

statusContains(needle: string): () => Promise<boolean> {
Expand Down
Loading