import type { ElementResult, Rect, ElementType } from './types.js'; import type { Page } from '@playwright/test'; import { type Charset, type FieldRead, type OcrOverflow, type OcrSwaps } from './utils/ocr.js'; export declare const VISIBLE_CONFIDENCE = 0.7; export type MatchOptions = { swaps?: OcrSwaps; overflow?: OcrOverflow; read?: FieldRead; }; export type HaveTextOptions = { timeout?: number; /** Expected glyph → OCR glyphs allowed in its place, e.g. `{ '@': ['Q', 'C'], '5': 'S' }`. */ swaps?: OcrSwaps; /** * Charset to use for this assertion — name registered in `init()` or an inline `Charset` object. * Only the bundled `swaps` are applied at assertion time; `chars` has no effect here because * OCR extraction already ran. For `chars` to take effect, set `charset` on the element config. * Explicit `swaps` always win over `charset.swaps`. */ charset?: string | Charset; /** Clip handling. Prefer setting this on the screen config. */ overflow?: OcrOverflow; overflowSlop?: number; /** Override config `read`. `clipboard` is click / select-all / copy. */ read?: FieldRead; }; export type WaitForOptions = { visible?: boolean; timeout?: number; }; export type LiveScreen = { waitForElement(name: string, options?: WaitForOptions): Promise; elementResult(name: string, partName?: string): ElementResult | undefined; matchOptions(name: string, partName?: string): MatchOptions; markDirty(): void; ensureFresh(): Promise; paintOverlay(result: ElementResult, label?: string): Promise; hideOverlay(): Promise; }; /** * Playwright-style element wrapper with chainable assertions * Includes built-in retry logic similar to Playwright's auto-waiting */ export declare class ScreenElement { private result; private page?; private live?; private readonly parentName?; constructor(result: ElementResult, page?: Page | undefined, live?: LiveScreen | undefined, parentName?: string | undefined); private get label(); private get rootName(); private get partName(); /** * Get the element's current value */ value(): string; /** * OCR for one inner box on a shared-label row. */ part(name: string): ScreenElement; /** * Get the element's location on screen */ location(): Rect; /** * Get the element's match confidence */ confidence(): number | undefined; /** * Get the element's type */ type(): ElementType | undefined; /** * Get the active variant (if element has variants) */ variant(): string | undefined; /** * Wait until this element's template matches the live screenshot. */ waitFor(options?: WaitForOptions): Promise; /** * Assert element is filled/has content * @throws if element is empty after timeout */ toBeFilled(options?: { timeout?: number; }): Promise; /** * Assert element is empty/has no content * @throws if element is filled after timeout */ toBeEmpty(options?: { timeout?: number; }): Promise; /** @internal — used by NegatedScreenElement in this module only */ _internals(): { live: LiveScreen | undefined; readonly result: ElementResult; sync: () => void; overlay: (body?: () => Promise) => Promise; label: string; resolvedMatch: (options?: HaveTextOptions) => MatchOptions; }; get not(): NegatedScreenElement; /** * Assert element is visible (found with confidence > threshold). * When bound to a live page, waits until the template matches. */ toBeVisible(options?: { timeout?: number; }): Promise; /** * Assert element is hidden (confidence below visible threshold). * When bound to a live page, waits until the template is no longer visible. */ toBeHidden(options?: { timeout?: number; }): Promise; /** * Assert element has the "enabled" variant. */ toBeEnabled(options?: { timeout?: number; }): Promise; /** * Assert element has the "disabled" variant. */ toBeDisabled(options?: { timeout?: number; }): Promise; /** * Assert element value contains the given text as a substring. * Supports OCR swap substitutions via options or configured Strategies.Ocr. * @throws if actual value does not contain expected after timeout */ toContainText(expected: string, options?: HaveTextOptions): Promise; /** * Assert element has specific text/value * @throws if text doesn't match after timeout */ toHaveText(expected: string | RegExp, options?: HaveTextOptions): Promise; /** * Assert element has exact text/value * @throws if text doesn't match exactly after timeout */ toHaveValue(expected: string, options?: HaveTextOptions): Promise; /** * Assert checkbox/toggle is checked * @throws if not checked after timeout */ toBeChecked(options?: { timeout?: number; }): Promise; /** * Assert checkbox/toggle is unchecked * @throws if checked after timeout */ toBeUnchecked(options?: { timeout?: number; }): Promise; /** * Assert element is in specific variant state * @throws if variant doesn't match after timeout */ toHaveVariant(expected: string, options?: { timeout?: number; }): Promise; /** * Assert element matches with high confidence * @throws if confidence below threshold after timeout */ toHaveConfidence(threshold: number, options?: { timeout?: number; }): Promise; /** * Click the element at its center * Requires page to be provided */ click(options?: { timeout?: number; }): Promise; /** * Type text into the element. * Clicks the value box (ocrRect), not the label crop, then types. * Requires page to be provided */ fill(text: string, options?: { timeout?: number; }): Promise; check(options?: { timeout?: number; }): Promise; uncheck(options?: { timeout?: number; }): Promise; selectOption(value: string, options?: { timeout?: number; }): Promise; dblclick(options?: { timeout?: number; }): Promise; hover(options?: { timeout?: number; }): Promise; private clickRect; /** * Get custom metadata from custom matcher * Returns undefined if no metadata available */ metadata(): Record | undefined; /** * Get a specific metadata value */ getMetadata(key: string): T | undefined; /** * Get element info for debugging */ info(): ElementResult; private syncResult; private highlight; private withOverlay; private isLocated; private ensureLocated; private waitUntil; private resolvedMatch; private retryAssertion; private copyFromField; } /** * Negated assertion façade returned by `ScreenElement.not`. * Each method is the logical inverse of the corresponding `ScreenElement` method. */ export declare class NegatedScreenElement { private readonly el; constructor(el: ScreenElement); toBeFilled(options?: { timeout?: number; }): Promise; toBeEmpty(options?: { timeout?: number; }): Promise; toBeVisible(options?: { timeout?: number; }): Promise; toBeHidden(options?: { timeout?: number; }): Promise; toBeChecked(options?: { timeout?: number; }): Promise; toBeUnchecked(options?: { timeout?: number; }): Promise; toBeEnabled(options?: { timeout?: number; }): Promise; toBeDisabled(options?: { timeout?: number; }): Promise; toHaveVariant(expected: string, options?: { timeout?: number; }): Promise; toContainText(expected: string, options?: HaveTextOptions): Promise; } //# sourceMappingURL=element.d.ts.map