import { Locator } from "@playwright/test";

export async function getInputValueWithRetry(locator: Locator, timeout: number = 3000): Promise<string> {
    const startTime = Date.now();
    let value = '';

    while (Date.now() - startTime < timeout) {
        try {
            value = await locator.inputValue();
            if (value) {
                return value;
            }
        } catch (error) { }
        await new Promise(resolve => setTimeout(resolve, 100));
    }
    return '';
}
