@salesforce/salesforcedx-vscode-test-tools
Version:
Test automation framework for Salesforce Extensions for VS Code
55 lines (54 loc) • 2.7 kB
TypeScript
import { CodeLens, TextEditor, Workbench } from 'vscode-extension-tester';
import { Duration } from '../core/miscellaneous';
/**
* Gets a text editor for a specific file
* @param workbench - The VSCode workbench instance
* @param fileName - Name of the file to open and edit
* @returns A TextEditor instance for the specified file
*/
export declare function getTextEditor(workbench: Workbench, fileName: string): Promise<TextEditor>;
/**
* Checks if a file is open in the editor
* @param workbench - The VSCode workbench instance
* @param name - The name of the file to check
* @param options - Optional configuration including timeout and error message
* @throws Timeout error if the file isn't open within the specified timeout
*/
export declare function checkFileOpen(workbench: Workbench, name: string, options?: {
msg?: string;
timeout?: Duration;
}): Promise<void>;
/**
* Waits for a file to be open in the editor with a 30-second timeout
* @param workbench - The VSCode workbench instance
* @param fileName - Name of the file to wait for
* @returns Promise that resolves when file is open or rejects on timeout
*/
export declare function waitForFileOpen(workbench: Workbench, fileName: string): Promise<void>;
/**
* Opens a file and retrieves its text content
* @param filePath - The path to the file to open
* @returns The text content of the file
*/
export declare function attemptToFindTextEditorText(filePath: string): Promise<string>;
/**
* Overwrites the entire content of a file using filesystem operations
* @param textEditor - The text editor instance containing the file to modify
* @param classText - The new content to write to the file
* @throws Error if file write operation fails or content verification fails
*/
export declare function overrideTextInFile(textEditor: TextEditor, classText: string): Promise<void>;
export declare function waitForAndGetCodeLens(textEditor: TextEditor, codeLensName: string): Promise<CodeLens>;
/**
* Wrapper function for moveCursor with fallback mechanism using inputarea monaco-mouse-cursor-text selector
* @param textEditor - The text editor instance
* @param line - The line number to move to
* @param column - The column number to move to
*/
export declare const moveCursorWithFallback: (textEditor: TextEditor, line: number, column: number) => Promise<void>;
/** Replace a specific line in a file using fs operations
* @param filePath - The path to the file to modify
* @param lineNumber - The line number to replace (1-based index)
* @param newContent - The new content to write
*/
export declare function replaceLineInFile(filePath: string, lineNumber: number, newContent: string): Promise<void>;