@sap_oss/wdio-qmate-service
Version:
[](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[](http
54 lines • 2.19 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Navigation = void 0;
const verboseLogger_1 = require("../../helper/verboseLogger");
const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
/**
* @class navigation
* @memberof common
*/
class Navigation {
vlf = new verboseLogger_1.VerboseLoggerFactory("common", "navigation");
ErrorHandler = new errorHandler_1.default();
/**
* @function navigateToUrl
* @memberOf common.navigation
* @description Navigates to the passed url.
* @param {String} url - The url.
* @example await common.navigation.navigateToUrl("www.sap.com");
*/
async navigateToUrl(url) {
const vl = this.vlf.initLog(this.navigateToUrl);
if (url) {
await browser.navigateTo(url);
await util.browser.logCurrentUrl();
}
else {
this.ErrorHandler.logException(new Error("Please provide an url as argument."));
}
}
/**
* @function navigateToUrlAndRetry
* @memberOf common.navigation
* @description Navigates to the passed url and retries the function in case of a failure.
* @param {String} url - The url to navigate to.
* @param {Integer} [retries=3] - The number of retries, can be set in config for all functions under params stepsRetries.
* @param {Integer} [interval=5000] - The interval of the retries (ms), can be set in config for all functions under params stepRetriesIntervals.
* @example await common.navigation.navigateToUrlAndRetry("www.sap.com");
*/
async navigateToUrlAndRetry(url, retries = 3, interval = 5000) {
try {
const vl = this.vlf.initLog(this.navigateToUrl);
await util.function.retry(this.navigateToUrl, [url], retries, interval, this);
}
catch (error) {
return this.ErrorHandler.logException(error);
}
}
}
exports.Navigation = Navigation;
exports.default = new Navigation();
//# sourceMappingURL=navigation.js.map