Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot use ui5 methods on ComboBox #121

Closed
astarovojtov opened this issue Jan 25, 2022 · 8 comments
Closed

Cannot use ui5 methods on ComboBox #121

astarovojtov opened this issue Jan 25, 2022 · 8 comments
Assignees
Labels
bug Something isn't working

Comments

@astarovojtov
Copy link

Hello

I cannot get ComboBox control to use UI5 methods like getItems(). Trying to call it throws getItems is not a function.
Seems like browser.asControl returns a reference to the ComboBox arrow. Tried to use id of the control but it always returns the arrow itself that simply doesn't have the method.

Somehow same I stumble upon same errors trying to access sap.m.Table.getMode() or even .getId(). At the same time sap.m.Input.setValue() or sap.m.CheckBox.setSelected() works just fine. Was following the example provided in fluent async api section.

Am I doing it wrong?

Fragment of my code

await browser.asControl({
    interaction: 'root',
    selector: {
        controlType: 'sap.m.ComboBox',
        id: /.*boardArea$/
    }
}).getItems()
@vobu
Copy link
Contributor

vobu commented Jan 25, 2022

interaction: 'root' needs to go into the selector:

await browser.asControl({
    selector: {
        interaction: 'root',
        controlType: 'sap.m.ComboBox',
        id: /.*boardArea$/
    }
}).getItems()

@astarovojtov
Copy link
Author

astarovojtov commented Jan 26, 2022

Thank you. My bad.

Though it didn't fix the issue completely.
await browser.asControl().getItems()
throws .getItems is not a function

const boardArea = await browser.asControl();
await boardArea.getItems() 

works but returns undefined though there are items for sure
tried to call getId() - also returns undefined

@vobu
Copy link
Contributor

vobu commented Jan 26, 2022

i played around a little with retrieving a sap.m.ComboBox and indeed, there's something wrong in the neighborhood™ 👻
I'll flag this issue and we'll investigate

@github-actions
Copy link

github-actions bot commented Mar 7, 2022

hey 👋 - silence for 30 days 🤐 ... anybody? 😀

@github-actions github-actions bot added the stale label Mar 7, 2022
@vobu
Copy link
Contributor

vobu commented Mar 7, 2022

on the roadmap

@ph-alsvik
Copy link
Contributor

Hi guys!

I’ve tried to get the items in the aggregation for the combobox, also. A simple test script like this:

describe("combobox test", () => {
    it("get combobox control items", async () => {
        oSelector = {
            forceSelect: true,
            selector: {
                interaction: "root",
                id: "combobox",
                viewName: "sap.m.sample.ComboBox.view.ComboBox"
            }
        }
        const combobox = await browser.asControl(oSelector);
        const items = await combobox.getItems();
    });
});

While running this sample app from the UI5 SDK.

I get the following error in the test log:

[0-0] [wdi5] call of getControl() failed because of: Error: No DOM element found using the control selector {"id":"__item2-__xmlview0--combobox-0"}
[0-0] [wdi5] error retrieving control: __item2-__xmlview0--combobox-0

So the ID assigned to the aggregated item does not match any DOM element in the document. I’ve opened an issue about this at the OpenUI5 repo SAP/openui5#3477, because it doesn’t seem to be a way to get the domRef of the aggregation by means of the UI5 API.

Hope this info is of any help!

@vobu
Copy link
Contributor

vobu commented Mar 9, 2022

thanks for digging deeper @ph-alsvik! 🙌
and extra props for the excellent bug report for our UI5 friends SAP/openui5#3477 🤙
→ let's see where that UI5 issue leads, then follow up with a fix here

@vobu
Copy link
Contributor

vobu commented Mar 18, 2022

just to update you @astarovojtov and @ph-alsvik: after reading through SAP/openui5#3477 and doing some triage, we decided to surface an additional api in wdi5 to retrieve the items aggregation of the ComboBox.
This is to mitigate the shortcoming described in SAP/openui5#3477 w/ the ComboBox holding sap.ui.core.Items but rendering sap.m.StandardListItems.
Work happens in #121 so as soon as that goes in, this wdi5 "bug" should be resolved.

vobu pushed a commit that referenced this issue Mar 18, 2022
* feat(devtools): add DEBUG flag with auto open dev tools

* feat(#129): i18n text matcher

* revert: auto-open-dev-tools

* feat(128): add test for descendant matcher

* refactor: matcher test to a separate file

* feat(matchers): add new matcher types

* feat(matcher): ancestor and labelFor

* fix(matcher): ancestor

* fix(matcher): interactable

* feat(matcher): prep for matcher with constructor

* fix(matcher): update siblings matcher and test with todo

* fix: rm double ancestor

* fix: createMatcher

* fix: matcher test

* fix: rm siblings matcher

* feat(combobox): two matcher examples for combobox #121

* docs: github issue

* feat(test): separated wdio and wdi5 test

* fix(wdio): rm test for wdio id selector

* fix: revert searchfield test

* fix(searchfield): rm searchfield

Co-authored-by: dominik.feininger <[email protected]>
Co-authored-by: Simon Coen <[email protected]>
@vobu vobu closed this as completed in c2984bd Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants