UNPKG

wdio-wait-for

Version:

a library of conditions that are useful for end-to-end tests

19 lines (18 loc) 654 B
import { getElement } from '../utils/index.js'; /** * A condition for checking an element is visible and enabled such that you can click it * * @example * browser.waitUntil(elementToBeEnabled('.btn')); * * @param {!string | ChainablePromiseElement<WebdriverIO.Element>} selectorOrElement The selector or element to check * * @returns {!function} An expected condition that returns a promise * representing whether the element is enabled. */ export function elementToBeEnabled(selectorOrElement) { return async function () { const element = await getElement(selectorOrElement); return await element.isEnabled(); }; }