|
25 | 25 | * POSSIBILITY OF SUCH DAMAGE. |
26 | 26 | */ |
27 | 27 |
|
28 | | -import { VSBrowser, WebDriver, Workbench } from 'vscode-extension-tester'; |
29 | | -import { Delays, IDEOperations, RascalREPL, TestWorkspace, ignoreFails, printRascalOutputOnFailure, sleep } from './utils'; |
| 28 | +import { By, until, VSBrowser, WebDriver, Workbench } from 'vscode-extension-tester'; |
| 29 | +import { Delays, IDEOperations, ignoreFails, printRascalOutputOnFailure, RascalREPL, sleep, TestWorkspace } from './utils'; |
30 | 30 |
|
| 31 | +import { expect } from 'chai'; |
31 | 32 | import * as fs from 'fs/promises'; |
32 | | -import * as path from 'path'; |
33 | 33 | import { Suite } from 'mocha'; |
34 | | -import { expect } from 'chai'; |
| 34 | +import * as path from 'path'; |
35 | 35 |
|
36 | 36 | function parameterizedDescribe(body: (this: Suite, errorRecovery: boolean) => void) { |
37 | 37 | describe('DSL', function() { body.apply(this, [false]); }); |
@@ -258,4 +258,25 @@ parameterizedDescribe(function (errorRecovery: boolean) { |
258 | 258 |
|
259 | 259 | await fs.rm(newDir, {recursive: true, force: true}); |
260 | 260 | }); |
| 261 | + |
| 262 | + it("call hierarchy works", async function() { |
| 263 | + const editor = await ide.openModule(TestWorkspace.picoCallsFile); |
| 264 | + await editor.selectText("multiply"); |
| 265 | + await bench.executeCommand("view.showCallHierarchy"); |
| 266 | + await driver.wait(until.elementLocated(By.xpath("//div[contains(@class, 'title-label')]/h2[contains(text(), 'References')]"))); |
| 267 | + |
| 268 | + await bench.executeCommand("view.showOutgoingCalls"); |
| 269 | + await driver.wait(until.elementLocated(By.xpath("//div[contains(@class, 'title-label')]/h2[contains(text(), 'Calls From')]"))); |
| 270 | + await driver.wait(async () => { |
| 271 | + const hieraryItems = await bench.getSideBar().findElements(By.xpath("//div[@role='treeitem']")); |
| 272 | + return hieraryItems.length === 3; |
| 273 | + }, Delays.normal, "Call hierarchy should show `multiply` and its two outgoing calls."); |
| 274 | + |
| 275 | + await bench.executeCommand("view.showIncomingCalls"); |
| 276 | + await driver.wait(until.elementLocated(By.xpath("//div[contains(@class, 'title-label')]/h2[contains(text(), 'Callers Of')]"))); |
| 277 | + await driver.wait(async () => { |
| 278 | + const hieraryItems = await bench.getSideBar().findElements(By.xpath("//div[@role='treeitem']")); |
| 279 | + return hieraryItems.length === 2; |
| 280 | + }, Delays.normal, "Call hierarchy should show `multiply` and its recursive call."); |
| 281 | + }); |
261 | 282 | }); |
0 commit comments