Closed edvardas-kireilis closed 2 years ago
thanks for bringing attention to them non-primitives return values of a $control
-API method 👍
My guess is that we could resolve this pretty quickly by serializing non-primitive values in the browser scope and passing that serialized value to the Node-scope as is - any caveats @dominikfeininger?
https://webdriver.io/docs/api/browser/executeAsync/
Arguments may be any JSON-primitive, array, or JSON object. JSON objects that define a WebElement reference will be converted to the corresponding DOM element. Likewise, any WebElements in the script result will be returned to the client as WebElement JSON objects.
Guess the also counts for the returned object. Serialization not necessary but we need to remove circular structures etc..
Test:
it.only("check binding info", async () => {
const title = await browser.asControl({ selector: { id: "container-Sample---Main--Title::NoAction.h1" } })
const bindingInfo = await title.getBinding("text")
expect(bindingInfo).not.toBeNull()
})
Result:
maybe use https://github.com/js-soft/wdi5/blob/204ce911b9ef2de295753fdc40ca5a6066add533/client-side-js/injectUI5.js#L243 to first pipe the object through before returning it?!
yep, already a todo in code ;)
Describe the bug We were calling getBinding() function of a control and results were the control itself and not the binding object which is returned as ui5 control getBinding() result. It seems that in client-side-js/executeControlMethod.js file code is checking if method result is a primitive, an array or a control and if so - the forwards the results into wdi5 test, otherwise it doesn't (line 58).
We would like to call methods which return other objects and then check the results or query those objects deeper.
To Reproduce Just get any control which has binding and try to retrieve it using getBinding('bindingName'). We used sap.ui.table.Table control and it's binding 'rows'.
Expected behavior We should the the result object which was retrieved in UI5, currently we got the control object which method we called.
Runtime Env (please complete the following information):
wdi5/wdio-ui5-service
-version: 0.9.0-rc3UI5
version: 1.98.0wdio
-version (output ofwdio --version
): 7.19.3node
-version (output ofnode --version
): v16.13.0