UNPKG

@sap_oss/wdio-qmate-service

Version:

[![REUSE status](https://api.reuse.software/badge/github.com/SAP/wdio-qmate-service)](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[![Node.js CI](https://github.com/SAP/wdio-qmate-service/actions/workflows/node.js.yml/badge.svg)](http

130 lines 6.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); // @ts-nocheck var qmateLocator = require("../../locators/qmateLocator"); var uiveri5Locator = require("../../locators/uiveri5Locator"); var lib = require("./lib"); const locatorCommands_1 = require("./locatorCommands"); var AddLocatorCommands = function () { this.addControlCommands = async function () { // Add Qmate locator strategy await browser.addLocatorStrategy("ui5All", qmateLocator.ui5All); await browser.addLocatorStrategy("ui5Veri5", uiveri5Locator.ui5Veri5); // Register global names //global.uiControl = ui5ControlLocator; //global.uiControls = ui5ControlsLocator; // Add command to trigger coverage collection await browser.addCommand("collectCoverage", async function () { return true; }); // Add command for control await browser.addCommand("uiControl", async function (ui5Selector, index, timeout, returnAllDomElements = false) { return (0, locatorCommands_1.ui5ControlLocator)(ui5Selector, index, timeout, this, returnAllDomElements); }, true); await browser.addCommand("uiControl", async function (ui5Selector, index, timeout, returnAllDomElements = false) { return (0, locatorCommands_1.ui5ControlLocator)(ui5Selector, index, timeout, undefined, returnAllDomElements); }); // Add command for controls await browser.addCommand("uiControls", async function (ui5Selector, timeout) { return (0, locatorCommands_1.ui5ControlsLocators)(ui5Selector, timeout, this); }, true); await browser.addCommand("uiControls", async function (ui5Selector, timeout) { return (0, locatorCommands_1.ui5ControlsLocators)(ui5Selector, timeout); }); }; this.addGetBindingInfos = async function () { // Add command for element properties await browser.addCommand("getBindingContextPath", async function () { return (0, locatorCommands_1.getBindingContextPath)(this); }, true); // Add command for browser properties await browser.addCommand("getBindingContextPath", async function (ui5SelectorOrElement) { return (0, locatorCommands_1.getBindingContextPath)(ui5SelectorOrElement); }); // Add command for element properties await browser.addCommand("getBindingProperty", async function (propName) { return (0, locatorCommands_1.getBindingProperty)(propName, this); }, true); // Add command for browser properties await browser.addCommand("getBindingProperty", async function (propName, ui5SelectorOrElement) { return (0, locatorCommands_1.getBindingProperty)(propName, ui5SelectorOrElement); }); }; this.addGetControlProperties = async function () { // Add command for element properties await browser.addCommand("getUI5Property", async function (propertyName) { return (0, locatorCommands_1.getUI5Property)(propertyName, this); }, true); // Add command for browser properties await browser.addCommand("getUI5Property", async function (propertyName, ui5SelectorOrElement) { return (0, locatorCommands_1.getUI5Property)(propertyName, ui5SelectorOrElement); }); // Add command for element properties await browser.addCommand("getUI5Aggregation", async function (propertyName) { return (0, locatorCommands_1.getUI5Aggregation)(propertyName, this); }, true); // Add command for browser properties await browser.addCommand("getUI5Aggregation", async function (propertyName, ui5SelectorOrElement) { return (0, locatorCommands_1.getUI5Aggregation)(propertyName, ui5SelectorOrElement); }); // Add command for element properties await browser.addCommand("getUI5Association", async function (propertyName) { return (0, locatorCommands_1.getUI5Association)(propertyName, this); }, true); // Add command for browser properties await browser.addCommand("getUI5Association", async function (propertyName, ui5SelectorOrElement) { return (0, locatorCommands_1.getUI5Association)(propertyName, ui5SelectorOrElement); }); await browser.addCommand("getAllUI5Properties", async function () { return (0, locatorCommands_1.getAllUI5Properties)(this); }, true); await browser.addCommand("getAllUI5Properties", async function (ui5SelectorOrElement) { return (0, locatorCommands_1.getAllUI5Properties)(ui5SelectorOrElement); }); await browser.addCommand("getAllUI5Aggregations", async function () { return (0, locatorCommands_1.getAllUI5Aggregations)(this); }, true); await browser.addCommand("getAllUI5Aggregations", async function (ui5SelectorOrElement) { return (0, locatorCommands_1.getAllUI5Aggregations)(ui5SelectorOrElement); }); await browser.addCommand("getAllUI5Associations", async function () { return (0, locatorCommands_1.getAllUI5Associations)(this); }, true); await browser.addCommand("getAllUI5Associations", async function (ui5SelectorOrElement) { return (0, locatorCommands_1.getAllUI5Associations)(ui5SelectorOrElement); }); }; this.addInBrowserHandling = async function () { await browser.addCommand("controlActionInBrowser", async function (fnBrowser) { if (arguments.length > 1) { // Inject web element in index 1 const aCustomParams = []; for (var i = 1; i < arguments.length; i++) { if (arguments[i]) { aCustomParams.push(arguments[i]); } } return lib.controlActionInBrowser(fnBrowser, this, aCustomParams.toString()); } else { return lib.controlActionInBrowser(fnBrowser, this); } }, true); await browser.addCommand("controlActionInBrowser", async function (fnBrowser, selectorOrElement) { if (arguments.length > 2) { const aCustomParams = []; for (var i = 2; i < arguments.length; i++) { if (arguments[i]) { aCustomParams.push(arguments[i]); } } return lib.controlActionInBrowser(fnBrowser, selectorOrElement, aCustomParams.join(",")); } else { return lib.controlActionInBrowser(fnBrowser, selectorOrElement); } }); }; }; exports.default = new AddLocatorCommands(); //# sourceMappingURL=addLocatorCommands.js.map