UNPKG

@salesforce/salesforcedx-vscode-test-tools

Version:
39 lines (38 loc) 1.41 kB
import { Locator } from 'vscode-extension-tester'; import { Duration } from '../core/miscellaneous'; /** * Interface for combining a predicate function with a maximum wait time */ export interface PredicateWithTimeout { predicate: () => Promise<boolean>; maxWaitTime: Duration; } /** * Standard predicate functions for common scenarios */ export declare const standardPredicates: { /** * A predicate that always returns true * Useful for testing or as a default value */ alwaysTrue: () => Promise<boolean>; /** * Waits for an element to be displayed * @param selector - The locator for the element to wait for * @returns true when the element is displayed */ waitForElement: (selector: Locator) => Promise<boolean>; /** * Polls until a condition is true * @param condition - A function that returns true when the desired condition is met * @returns true when the condition is satisfied */ waitForCondition: (condition: () => boolean) => Promise<boolean>; }; /** * Creates a predicate with an associated timeout * @param predicate - The function to evaluate * @param maxWaitTime - Maximum time to wait for the predicate to return true * @returns A PredicateWithTimeout object */ export declare function createPredicateWithTimeout(predicate: () => Promise<boolean>, maxWaitTime: Duration): PredicateWithTimeout;