ui5-community / wdi5

official UI5 end-to-end test framework for UI5 web-apps. wdi5 = Webdriver.IO + UI5 Test API
https://ui5-community.github.io/wdi5/
Apache License 2.0
102 stars 43 forks source link

Native methods of UI5 aggregation items cannot be invoked for sap.m.MultiComboBox #354

Closed borceacristiann closed 1 year ago

borceacristiann commented 2 years ago

Describe the bug Similar to something what is described in this issue, none of the items methods can be used.

MultiComboBox has an aggregation called items of type sap.ui.core.Item. Each Items has a property called text.

The below is my code. I'm just invoking the getText method

const multicomboBox =  await browser.asControl({
            selector: {
                id: /.*id$/,
                controlType: "sap.m.MultiComboBox",
                interaction: "root"
            },
            forceSelect: true
        })
await multiComboBox.open();

const items = await multiComboBox.getItems();

const firstItemText = await items[0].getText()

expect(firstItemText).toBeTruthy()

This doesn't work, because the native UI5 methods of sap.ui.core.Item don't seem to be available on each of the items in aggregation. This leads to a type error about missing function

To Reproduce Invoke getText on items of items aggregation of multiComboBox

Expected behavior The text of the item

Logs/Console Output getText is not a function

Screenshots

Runtime Env (please complete the following information):

dominikfeininger commented 2 years ago

Added a test in PR.

Also note the rendered Item is type sap.m.StandardListItem -> getText() needs to be getTitle(). This is a UI5 flaw and will be documented in the wdi5 documentation. Same applies for sap.m.Combobox recipes

borceacristiann commented 1 year ago

Hi @dominikfeininger, thanks for pointing me to the correct method. (getTitle)

However, the problem persists because no UI5 method is generated for the combobox items. I have attached some screenshots that I took while debugging, please take a look.

image

Screenshot 2022-10-27 at 15 35 54

image

borceacristiann commented 1 year ago

Hello colleagues, please reopen this issue because as I mentioned in the previous message the problem still persists.

vobu commented 1 year ago

happy to reopen this, but FTR: we included a test just for this bug and its fix: https://github.com/ui5-community/wdi5/blob/c3293971d2deff46ef36103e0c72b975dfa1d217/examples/ui5-js-app/webapp/test/e2e/prop-array.test.js#L30 ...where we're doing essentially the same thing as you: open a multi combo box and operate on an aggregation item. maybe the referenced test can help you as a blueprint, specifically the interaction: "root" as part of the combox box selector?

borceacristiann commented 1 year ago

Hello, I tested once more and everything seems to work fine. Thanks