UNPKG

@salesforce/salesforcedx-vscode-test-tools

Version:
100 lines (99 loc) 3.86 kB
import * as DurationKit from '@salesforce/kit'; import { PredicateWithTimeout } from '../testing/predicates'; import { WebElement } from 'vscode-extension-tester'; /** * Pauses execution for a specified duration * @param duration - The amount of time to pause; defaults to 1 second */ export declare function pause(duration?: Duration): Promise<void>; /** * Logs a message to the console if the log level allows it * @param message - The message to log */ export declare function log(message: string): void; /** * Logs a debug message to the console if the log level is debug or trace * @param message - The debug message to log */ export declare function debug(message: string): void; /** * Logs an error message to the console if the log level is error * @param message - The error message to log */ export declare function error(message: string): void; /** * Gets the username of the current OS user * @returns The current OS username */ export declare function currentOsUserName(): string; /** * Returns a transformed version of the current username with periods replaced by underscores * Used to work around an issue where InputBox.setText() truncates strings with periods * @returns The transformed username */ export declare function transformedUserName(): string; /** * @param type type of html tag we want to find * @param attribute attribute that holds the given text * @param labelText text of the element we want to find * @param waitForClickable whether to wait until the element is clickable * @param waitOptions options for waiting until the element is clickable * @returns element that contains the given text */ export declare function findElementByText(type: string, attribute: string, labelText: string | undefined, waitForClickable?: boolean | undefined, waitOptions?: { timeout?: Duration; interval?: Duration; reverse?: boolean; timeoutMsg?: string; }): Promise<WebElement>; export declare function createCommand(type: string, name: string, folder: string, extension: string): Promise<string | undefined>; /** * Sets the specified org as the default org * @param targetOrg - The name of the org to set as default */ export declare function setDefaultOrg(targetOrg: string): Promise<void>; /** * Type guard function to check if the argument is a Duration * @param predicateOrWait - The value to check * @returns True if the value is a Duration, false otherwise */ export declare function isDuration(predicateOrWait: PredicateWithTimeout | Duration): predicateOrWait is Duration; export declare enum Unit { MINUTES = 0, MILLISECONDS = 1, SECONDS = 2, HOURS = 3, DAYS = 4, WEEKS = 5 } export declare class Duration extends DurationKit.Duration { private scaleFactor; constructor(quantity: number, unit: Unit, scaleFactor?: number); get minutes(): number; get hours(): number; get milliseconds(): number; get seconds(): number; get days(): number; get weeks(): number; static ONE_MINUTE: Duration; static FIVE_MINUTES: Duration; static TEN_MINUTES: Duration; static milliseconds(quantity: number): Duration; static seconds(quantity: number): Duration; static minutes(quantity: number): Duration; static hours(quantity: number): Duration; static days(quantity: number): Duration; static weeks(quantity: number): Duration; } /** * Pauses execution for a specified number of milliseconds * @param duration - The number of milliseconds to sleep * @returns A promise that resolves after the specified duration */ export declare function sleep(duration: number): Promise<void>; export declare function openFolder(path: string): Promise<void>; /** * A definite alternative of getTextEditor to open a file in text editor * @param path */ export declare function openFile(path: string): Promise<void>;