@nice-digital/wdio-cucumber-steps
Version:
Shared step definitions for Cucumber JS BDD tests in WebdriverIO
22 lines • 853 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.checkUrlPath = void 0;
/**
* Check if the current URL path matches the given path
* @param {String} falseCase Whether to check if the path matches the
* expected value or not
* @param {String} expectedPath The expected path to match against
*/
async function checkUrlPath(falseCase, expectedPath) {
let currentUrl = (await browser.getUrl()).replace(/http(s?):\/\//, "");
const domain = `${currentUrl.split("/")[0]}`;
currentUrl = currentUrl.replace(domain, "");
if (falseCase) {
expect(currentUrl).not.toEqual(expectedPath);
}
else {
expect(currentUrl).toEqual(expectedPath);
}
}
exports.checkUrlPath = checkUrlPath;
//# sourceMappingURL=checkURLPath.js.map