SAP/karma-ui5

Binding type incorrectly determined when running the UI5 mockserver middleware from Karma

jakubledl opened this issue · 2 comments

In our current project, we're getting a bunch of errors like

ERROR: '2022-12-02 10:55:12.454500 Failed to drill-down into = !${complete} , invalid segment: = !${complete}  - /api/v1/FooService/Bar sap.ui.model.odata.v4.lib._Cache'
ERROR: '2022-12-02 10:55:12.456399 FormatException in property 'enabled' of 'Element sap.m.Button#__component0---Bar--confirmButton': Type 'sap.ui.model.odata.type.Raw' does not support formatting
Hint: single properties referenced in composite bindings and within binding expressions are automatically converted into the type of the bound control property, unless a different 'targetType' is specified. targetType:'any' may avoid the conversion and lead to the expected behavior. -  '

i.e. it seems to be the same issue with type detection as mentioned here and here. Confusingly, this error only happens when we run OPA5 tests using karma-ui5; when the application runs locally using ui5 serve, no such errors occur and all the bindings behave as expected.

Moreover, unlike in the other cases, adding targetType: 'any' (or targetType: 'boolean', or type: 'sap.ui.model.odata.type.Boolean') doesn't do anything and the error message remains the same.

The error comes from an expression binding, but the same problem occurs when we use complex bindings with specified formatters.

If you contact me via company email, Teams etc., I can give you a demonstration of the actual project.

matz3 commented

It seems that the bindingSyntax configuration is missing. If you use script mode please make sure to configure it properly as defined here: https://github.com/SAP/karma-ui5#config

Hi @matz3,

that was it, thank you very much!