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

forceSelect for Aggregations #71

Closed zimea closed 2 years ago

zimea commented 3 years ago

The parameter forceSelect: true can be used to update the internally stored references; however, if the retrieved control is used to call aggregations (e.g. ListControl.getItems(), dialogContro.getButtons()), the resulting reference is always reused. forceSelect: true could be propagated to the aggregated controls to avoid errors due to an outdated reference.

BeastiW commented 3 years ago

+1 - I am struggling with a Select Picker and getAggregation("content") which resolves in a stale element reference in the second call. I can provide an example project if you need to see this issue in real life.

Edit: @vobu @dominikfeininger Attached you can see a failing sample project (german feature file, but should not be a problem).

Edit2: of course we also got a workaround - cleanup of the internal WDI5 control cache: Object.keys(browser._controls).forEach(sKey => { if (browser._controls[sKey]._context) { delete browser._controls[sKey]; } });

Cheers, Bas sample_wdi5.zip

vobu commented 3 years ago

Edit2: of course we also got a workaround - cleanup of the internal WDI5 control cache: Object.keys(browser._controls).forEach(sKey => { if (browser._controls[sKey]._context) { delete browser._controls[sKey]; } });

thanks for digging into this! now that you (and @Lea-Zim 😄 ) have identified the issue, would you come fwd and PR this?!? now that would be rad ;)

BeastiW commented 3 years ago

@vobu I had a quick look. The solution should be quite simple, you are calling asControl twice in WDI5.js (in _retrieveElements and _retrieveElement) - there the this._forceSelect Option should be inserted as there it is lost. #96