/* eslint-disable no-await-in-loop */ import { Locator } from "playwright"; import { sleep } from "../utils/sleep.js"; export async function locator_is_visible( locator: Locator, timeout = 500 ): Promise { let exists = false; while (timeout > 0 && !exists) { await sleep(50); timeout -= 50; exists = await locator.isVisible(); } return exists; }