import { TextField } from '@/manager/shared/components/TextField';
import { sleep } from '@/shared/utils/timeout-utils';
import { Locator } from '@playwright/test';

export class DebouncedTextField extends TextField {
  constructor(
    protected readonly host: Locator,
    private readonly debounce = 250
  ) {
    super(host);
  }

  async fill(value: string): Promise<void> {
    await super.fill(value);
    await sleep(this.debounce);
  }
}
