UNPKG

@luminati-io/webdriverio8

Version:

Next-gen browser and mobile automation test framework for Node.js

63 lines (59 loc) 2.52 kB
import { ELEMENT_KEY } from '../../constants.js'; import { getBrowserObject } from '../../utils/index.js'; import isElementStable from '../../scripts/isElementStable.js'; /** * * Will return true when stable (in animation) or when unstable (not in animation). * * __Note:__ it's best to disable animations instead of using this command. * * <example> :index.html <head> <style> div { width: 200px; height: 200px; background-color: red; } #has-animation { animation: 3s 0s alternate slidein; } \@keyframes slidein { from { margin-left: 100%; width: 300%; } to { margin-left: 0%; width: 100%; } } </style> </head> <body> <div #has-animation></div> <div #has-no-animation></div> </body> :isStable.js it('should detect if an element is stable', async () => { let element = await $('#has-animation'); console.log(await element.isStable()); // outputs: false element = await $('#has-no-animation') console.log(await element.isStable()); // outputs: true }); * </example> * * @alias element.isStable * @return {Boolean} true if element is stable, false if unstable * @type state * */ export async function isStable() { const browser = getBrowserObject(this); return await browser.executeAsync(isElementStable, { [ELEMENT_KEY]: this.elementId, // w3c compatible ELEMENT: this.elementId // jsonwp compatible }); } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaXNTdGFibGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvY29tbWFuZHMvZWxlbWVudC9pc1N0YWJsZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSxPQUFPLEVBQUUsV0FBVyxFQUFFLE1BQU0sb0JBQW9CLENBQUE7QUFDaEQsT0FBTyxFQUFFLGdCQUFnQixFQUFFLE1BQU0sc0JBQXNCLENBQUE7QUFDdkQsT0FBTyxlQUFlLE1BQU0sa0NBQWtDLENBQUE7QUFFOUQ7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztHQW1ERztBQUNILE1BQU0sQ0FBQyxLQUFLLFVBQVUsUUFBUTtJQUMxQixNQUFNLE9BQU8sR0FBRyxnQkFBZ0IsQ0FBQyxJQUFJLENBQUMsQ0FBQTtJQUN0QyxPQUFPLE1BQU0sT0FBTyxDQUFDLFlBQVksQ0FBQyxlQUFlLEVBQUU7UUFDL0MsQ0FBQyxXQUFXLENBQUMsRUFBRSxJQUFJLENBQUMsU0FBUyxFQUFFLGlCQUFpQjtRQUNoRCxPQUFPLEVBQUUsSUFBSSxDQUFDLFNBQVMsQ0FBQyxvQkFBb0I7S0FDekIsQ0FBQyxDQUFBO0FBQzVCLENBQUMifQ==