import { Suite, Test } from "mocha"; import { GlobPattern, Position, TextDocument, TextEditor, Uri, Webview } from "vscode"; import { DiagramModel } from "../../views/diagram/model"; export declare class Input { /** Returns the position of the end of the document in editor. */ static atEnd(editor: TextEditor): Position; /** Returns the definition of an app with nothing but a name. */ static emptyApp(name: string): string; /** Returns the definition of an app with just an empty endpoint. */ static appWithEmptyEndpoing(name: string): string; /** Inserts content into editor at position. Resolves to {@code true} if the edit was applied. */ static into(editor: TextEditor, content: string, position?: Position): Promise; } /** Manages the contents of test fixture files in a directory. */ export declare class Fixtures { private readonly fixturesRoot; constructor(fixturesRoot: string); /** Reads the contents of the given files, and returns a function to reset them to that state. */ prepare(relativePaths: string[]): () => Promise; /** Opens a fixture in the workspace. */ open(relativePath: string): Promise; /** Copies a file with source and destination paths relative to the fixture directory. */ cp(from: string, to: string, options?: any): Promise; /** Creates a directory (and any missing ancestors) relative to the fixtures directory. */ mkdir(dirPath: string): Promise; /** Removes a file or directory relative to the fixtures directory. */ rm(rmPath: string): Promise; /** Returns an array of files matching the search pattern(s). */ find(include: GlobPattern, exclude?: GlobPattern): Promise; } export type Comparison = { before: T; after: T; }; /** Takes screenshots of test diagrams. */ export declare class Screenshot { private readonly dir; constructor(dir: string); filenameFor(name?: string | Test | Suite, suffix?: string): Uri; /** Takes a screenshot of the current active diagram, or fails if there isn't one. */ write(name: string | Test | Suite): Promise; save(name: string | Test | Suite, content: string, suffix?: string): Promise; /** Returns a comparison of a screenshot of the current diagram with one previously taken. */ compare(name: string | Test | Suite): Promise>; /** * Compares the current diagram ("after") to the previously saved one ("before"). * *
  • If before does not exist but after does, writes the after to disk as the new "before" without assertion. *
  • Otherwise, expects both before and after exist, and expects that both are equal, failing if not. */ compareExpectAndWrite(name: string | Test | Suite): Promise; /** * Compares the current diagram ("after") to the previously saved one ("before"), and restores the * UI from fullscreen render mode. */ compareExpectWriteAndRestore(name: string | Test | Suite): Promise; } /** Exposes testing operations on diagrams. */ export declare class Diagram { /** Renders a diagram of the active document and waits to load and focus the webview. */ render(): Promise; /** * Renders a diagram of the active document, closes other tabs and panes, and waits to load and * focus the webview. */ renderFull(): Promise; /** * Closes other tabs and panes, and waits to load and focus the webview. */ maximize(): Promise; /** Closes all non-active editors. */ closeOthers(): Promise; /** Fetches the data rendered in the active GoJS diagram. */ getData(timeout?: number): Promise; /** Fetches an SVG rendering of the active GoJS diagram. */ getScreenshot(timeout?: number): Promise; /** Selects a view tab by label in the renderer. */ selectTab(label: string, timeout?: number): Promise; /** Fetches an SVG rendering of the active GoJS diagram. */ getFromWebview(eventType: string, payload?: any, timeout?: number): Promise; } /** Provides operations on extension-related tools. */ export declare class Tools { /** Ensures the Sysl binary config points to something. */ static locateSyslBinary(): Promise; } /** Interface between test framework and application code. */ export interface TestInstrumentation { isActivated: Promise; onActivated: () => void; } /** Returns a promise that resolves once the extension is activated. */ export declare function isActivated(): Promise; /** Returns the active webview, or undefined if there isn't one. */ export declare function getActiveWebview(): Webview | undefined; /** Pauses the test execution for some time while the UI processes. */ export declare function sleep(timeMs: number): Promise; /** Returns a promise that resolves once all child processes have finished. */ export declare function allSettled(): Promise;