Skip to content

Commit

Permalink
Merge branch 'more-consistent-service-names-flaky-test' into more-con…
Browse files Browse the repository at this point in the history
…sistent-service-names-java
  • Loading branch information
sungshik committed Oct 21, 2024
2 parents 59e361e + 3aeef96 commit 89b10d6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 5 deletions.
18 changes: 15 additions & 3 deletions rascal-vscode-extension/src/test/vscode-suite/dsl.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@ describe('DSL', function () {
const repl = new RascalREPL(bench, driver);
await repl.start();
await repl.execute("import demo::lang::pico::LanguageServer;");
repl.execute("main();"); // we don't wait, be cause we might miss pico loading window
const replExecuteMain = repl.execute("main();"); // we don't wait yet, because we might miss pico loading window
const ide = new IDEOperations(browser);
const isPicoLoading = ide.statusContains("Pico");
await driver.wait(isPicoLoading, Delays.slow, "Pico DSL should start loading");
await repl.terminate();
// now wait for the Pico loader to dissapear
// now wait for the Pico loader to disappear
await driver.wait(async () => !(await isPicoLoading()), Delays.extremelySlow, "Pico DSL should be finished starting", 100);
await replExecuteMain;
await repl.terminate();
}


Expand All @@ -70,6 +71,12 @@ describe('DSL', function () {
await ide.load();
});

beforeEach(async function () {
if (this.test?.title) {
await ide.screenshot("DSL-" + this.test?.title);
}
});

afterEach(async function () {
if (this.test?.title) {
await ide.screenshot("DSL-" + this.test?.title);
Expand All @@ -87,6 +94,11 @@ describe('DSL', function () {
try {
await editor.setTextAtLine(10, "b := ;");
await ide.hasErrorSquiggly(editor, Delays.slow);
} catch (e) {
console.log(`Failed to trigger parse error: ${e}`);
if (e instanceof Error) {
console.log(e.stack);
}
} finally {
await ide.revertOpenChanges();
}
Expand Down
6 changes: 5 additions & 1 deletion rascal-vscode-extension/src/test/vscode-suite/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,12 @@ export class IDEOperations {
};
}

private screenshotSeqNumber = 0;

screenshot(name: string): Promise<void> {
return this.browser.takeScreenshot(name.replace(/[/\\?%*:|"<>]/g, '-'));
return this.browser.takeScreenshot(
`${String(this.screenshotSeqNumber++).padStart(4, '0')}-` + // Make sorting screenshots chronologically in VS Code easier
name.replace(/[/\\?%*:|"<>]/g, '-'));
}
}

Expand Down
5 changes: 4 additions & 1 deletion runUItests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ npm run compile-tests

# test what was compiled

exec npx extest setup-and-run out/test/vscode-suite/*.test.js --storage $UITESTS
exec npx extest setup-and-run out/test/vscode-suite/*.test.js \
--code_version 1.82.3 \
--storage $UITESTS \
--extensions_dir $UITESTS/extensions_dir

0 comments on commit 89b10d6

Please sign in to comment.