UNPKG

auto-heal-utility

Version:

A Playwright utility for auto-healing broken locators.

30 lines (29 loc) 1.26 kB
import { Locator, Page } from "@playwright/test"; import AutoHeal, { Metadata } from "./AutoHeal.js"; export default class WaitHelper { readonly page: Page; readonly timeout: number; readonly autoHeal: AutoHeal; constructor(page: Page, timeout?: number); /** * Normalizes input to always return an array of locators. * @param locators - A single locator or an array of locators. * @returns An array of locators. */ private normalizeLocators; /** * Waits for an element to be visible and clicks it. * @param locators - A single locator or an array of locators. * @param metadata - Metadata for logging and analysis. * @returns The best locator that was clicked. */ waitForElementAndClick(locators: Locator | Locator[], metadata: Metadata): Promise<Locator>; /** * Waits for an element to be visible and fills it with text. * @param locators - A single locator or an array of locators. * @param text - The text to fill into the element. * @param metadata - Metadata for logging and analysis. * @returns The best locator that was filled. */ waitForElementAndFill(locators: Locator | Locator[], text: string, metadata: Metadata): Promise<Locator>; }