import {userEvent} from '@testing-library/user-event'; import {type EnterTextOptions} from '@wix/unidriver-core'; export const enterText = async (base: HTMLElement, value: string, options: Required) => { const {disabled, readOnly} = base as HTMLInputElement; if (disabled || readOnly) { return; } const {clear, delay} = options; const isEmptyValue = value === ''; await userEvent.click(base); if (clear || isEmptyValue) { await userEvent.clear(base); } if (!isEmptyValue) { await userEvent.keyboard(value, { delay, }); } };