Closed GijsPruijmboom closed 4 years ago
Hi Gijs, this is not an issue but a fact of life - by.control() returns a set , not a list. Respectively, the element.all() returns this set and so .first() is not guaranteed to return an ordered collection. Additional issue with very generic selectors like controlType and lists is that now all rows are "real rows", in some lists there are footers that are also "rows". So the advice is to use element.all() for validation only the count and for every other validation to use a specific locator, for example using bindingPath/ancestor/descendent.
Hi Maxim, thanx for your fast reply. Can you advise me on how the approach should be to test the sorting order. If i use a more specific locator and UIveri5 finds the control i still don't have a clue of the position of this control within the list
you could write a script to get the item aggregation of the list, and get its first item. it would look something like: $(listRootElement).control()[0].getItems()[0].getDomRef(), where listRootElement is the result of the element finder for the list
or you could switch to wdi5
https://github.com/js-soft/wdi5 (attention though, beta) and use getAggregation()
https://github.com/js-soft/wdi5#getaggregation - sorry, I'll see myself out... 🙈😂
(ps: spoiler: more on wdi5
at UI5con ON AIR https://openui5.org/ui5con/onair2020/)
Another option is to use DOM-level selectors (by.css() ) because the lack of ordering comes from by.control().
Thanks Maxim for the option of DOM level selectors, this solved my problem. I've rewritten my selector using by.css()
this.firstRowCaseId = () => {
return element.all(by.css(
"tr[id*=casesTableListItem]"
)).first().element(by.control( {
viewName: pageMyCasesViewName,
controlType : "sap.m.Link",
properties: { id: /caseId/ }
}));
}
I am facing an issue retreiving information out of a sorted list. To be able to test if my sorting functionality is working correctly i am writing a uiveri5 test. This test should pick the first row(ColumnListItem) out of a list. However the first item i receive in UIveri5 is not the same as the one on the screen. this is the selecter i am using
I have also tried retreiving all rows of the list and iterating through them. A console.log of the item and the corresponding index shows a mismatching sorting order compared to the screen. Is this a known issue?