wdio-wait-for
Version:
a library of conditions that are useful for end-to-end tests
17 lines (16 loc) • 488 B
JavaScript
/**
* A condition for checking the URL of the current page to contain specific text.
*
* @example
* browser.waitUntil(urlContains('/v1'));
*
* @param {!string} expectedUrl The expected url
* @returns {!function} A condition that returns a promise
* representing whether browser's url contains.
*/
export function urlContains(expectedUrl) {
return async function () {
const actualUrl = await this.getUrl();
return actualUrl.includes(expectedUrl);
};
}