wdio-wait-for
Version:
a library of conditions that are useful for end-to-end tests
19 lines (18 loc) • 632 B
JavaScript
import { getElement } from '../utils/index.js';
/**
* A condition for checking an element is visible and selected
*
* @example
* browser.waitUntil(elementToBeSelected('.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 selected.
*/
export function elementToBeSelected(selectorOrElement) {
return async function () {
const element = await getElement(selectorOrElement);
return await element.isSelected();
};
}