import { RetryOptions } from "./RetryStrategy"; export interface WatchOptions { timeout: number; retryOptions?: RetryOptions; signal?: AbortSignal; description?: string; } export interface ConditionResult { value: T; timestamp: number; attempts: number; } export declare class WatchTimeoutError extends Error { constructor(description: string, timeout: number, attempts: number); } export declare class WatchAbortedError extends Error { constructor(description: string); } /** * Observable-like condition watcher for replacing simple polling patterns */ export declare class ConditionWatcher { private condition; private options; private startTime; private attempts; private constructor(); /** * Create a new condition watcher */ static watch(condition: () => Promise, options: WatchOptions): ConditionWatcher; /** * Wait until the condition returns a non-null value */ waitUntil(): Promise>; /** * Wait until the condition returns a value that matches the predicate */ waitUntilMatches(predicate: (value: T) => boolean): Promise>; /** * Transform the watched value before returning */ map(transform: (value: T) => U): ConditionWatcher; /** * Add a filter to the condition */ filter(predicate: (value: T) => boolean): ConditionWatcher; /** * Add a timeout to the watcher */ timeout(ms: number): ConditionWatcher; /** * Add retry configuration */ withRetryOptions(retryOptions: RetryOptions): ConditionWatcher; /** * Add a description for better error messages */ describe(description: string): ConditionWatcher; private shouldContinue; private sleep; /** * Static helper methods for common patterns */ static waitForCondition(condition: () => Promise, timeout: number, description?: string): Promise; static waitForElement(locator: () => Promise, timeout?: number): Promise; static waitForValue(getter: () => Promise, timeout?: number, description?: string): Promise; }