wdio-ui5-service
Version:
WebdriverIO plugin for testing UI5 browser-based apps
27 lines • 1.44 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.clientSide_getAggregation = clientSide_getAggregation;
async function clientSide_getAggregation(webElement, aggregationName, browserInstance) {
webElement = await Promise.resolve(webElement); // to plug into fluent async api
browserInstance = await Promise.resolve(browserInstance);
return await browserInstance.execute(async function wdi5_getAggregation(webElement, aggregationName) {
try {
await window.bridge.waitForUI5(window.wdi5.waitForUI5Options);
const oControl = window.wdi5.getUI5CtlForWebObj(webElement);
let cAggregation = oControl.getAggregation(aggregationName);
// if getAggregation retrieves an element only it has to be transformed to an array
if (cAggregation && !Array.isArray(cAggregation)) {
cAggregation = [cAggregation];
}
// read classname eg. sap.m.ComboBox
const controlType = oControl.getMetadata().getName();
const result = window.wdi5.createControlIdMap(cAggregation, controlType);
return { status: 0, result: result };
}
catch (error) {
// also returns an object with a "status": 1 property
return window.wdi5.errorHandling(error);
}
}, webElement, aggregationName);
}
//# sourceMappingURL=_getAggregation.js.map