wdio-wait-for
Version:
a library of conditions that are useful for end-to-end tests
17 lines (16 loc) • 506 B
JavaScript
/**
* A condition for checking the number of opened windows.
*
* @example
* browser.waitUntil(numberOfWindowsToBe(2));
*
* @param {!number} expectedNumber The expected url
* @returns {!function} A condition that returns a promise
* representing whether browser's windows length.
*/
export function numberOfWindowsToBe(expectedNumber) {
return async function () {
const actualWindows = await this.getWindowHandles();
return actualWindows.length === expectedNumber;
};
}