@sap_oss/wdio-qmate-service
Version:
[](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[](http
131 lines • 4.68 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.NavigationBar = void 0;
const verboseLogger_1 = require("../../helper/verboseLogger");
const errorHandler_1 = __importDefault(require("../../helper/errorHandler"));
/**
* @class navigationBar
* @memberof ui5
*/
class NavigationBar {
constructor() {
this.vlf = new verboseLogger_1.VerboseLoggerFactory("ui5", "navigationBar");
this.ErrorHandler = new errorHandler_1.default();
}
/**
* @function clickBack
* @memberOf ui5.navigationBar
* @description Navigates one layer back.
* @param {Number} [timeout=30000] - The timeout to wait (ms).
* @example await ui5.navigationBar.clickBack();
*/
async clickBack(timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
const vl = this.vlf.initLog(this.clickBack);
const selector = {
elementProperties: {
metadata: "sap.ushell.ui.shell.ShellHeadItem",
id: "backBtn"
}
};
try {
await ui5.userInteraction.click(selector, 0, timeout);
}
catch (error) {
this.ErrorHandler.logException(error);
}
}
/**
* @function clickSapLogo
* @memberOf ui5.navigationBar
* @description Clicks at the SAP Logo.
* @param {Number} [timeout=30000] - The timeout to wait (ms).
* @example await ui5.navigationBar.clickSapLogo();
*/
async clickSapLogo(timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
const vl = this.vlf.initLog(this.clickSapLogo);
const selector = {
id: "shell-header-logo"
};
try {
await ui5.userInteraction.click(selector, 0, timeout);
}
catch (error) {
this.ErrorHandler.logException(error);
}
}
/**
* @function clickUserIcon
* @memberOf ui5.navigationBar
* @description Clicks at the Account Icon.
* @param {Number} [timeout=30000] - The timeout to wait (ms).
* @example await ui5.navigationBar.clickUserIcon();
*/
async clickUserIcon(timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000) {
const vl = this.vlf.initLog(this.clickUserIcon);
const selector = {
"elementProperties": {
"metadata": "sap.m.Avatar",
"id": "*HeaderButton"
}
};
try {
await ui5.userInteraction.click(selector, 0, timeout);
}
catch (error) {
this.ErrorHandler.logException(error);
}
}
// =================================== ASSERTION ===================================
/**
* @function expectPageTitle
* @memberOf ui5.navigationBar
* @description Expects the page title of the current page to be the compare value.
* @param {String} compareValue - The compare value.
* @example await ui5.navigationBar.expectPageTitle("Home");
*/
async expectPageTitle(compareValue) {
const vl = this.vlf.initLog(this.expectPageTitle);
const selector = {
elementProperties: {
metadata: "sap.ushell.ui.shell.ShellAppTitle",
mProperties: {
text: compareValue
}
}
};
try {
await ui5.assertion.expectToBeVisibleInViewport(selector);
}
catch (error) {
this.ErrorHandler.logException(error);
}
}
/**
* @function expectShellHeader
* @memberOf ui5.navigationBar
* @description Expects the shell header to be visible
* @param {Number} [timeout=30000] - The timeout to wait (ms).
* @example await ui5.navigationBar.expectShellHeader();
*/
async expectShellHeader(timeout = parseFloat(process.env.QMATE_CUSTOM_TIMEOUT) || 30000, loadPropertyTimeout = process.env.LOAD_PROPERTY_TIMEOUT || 10000) {
const vl = this.vlf.initLog(this.expectShellHeader);
const selector = {
elementProperties: {
metadata: "sap.ushell.ui.ShellHeader",
id: "shell-header"
}
};
try {
await ui5.assertion.expectToBeVisible(selector, 0, timeout, loadPropertyTimeout);
}
catch (error) {
this.ErrorHandler.logException(error);
}
}
}
exports.NavigationBar = NavigationBar;
exports.default = new NavigationBar();
//# sourceMappingURL=navigationBar.js.map