We recently have been expanding our test coverage to cover both android and iOS with the intention that the tests with little intervention should be able to run on both. Unfortunately, when using a list of items and retrieving values off that list with await driver.waitForElementsByAccessibilityId(elName);
I’m finding that the iOS returns are very different than those on Android. Generally, Android returns indexes correctly- from top to bottom. I’ve found that in lists with two iOS is reversing them and on lists of three or more it’s disorganized altogether.
For instance, if I had a list of fruits:
accessibilityId={fruits}
And on my list I have three:
fruits=[apples, oranges, cherries]
And I do const fruitOrder = await driver.waitForElementsByAccessibilityId(fruits);
And then verify the order of the elements I would expect:
expect(await fruits[0].text()).to.be("apples");
expect(await fruits[1].text()).to.be("oranges");
expect(await fruits[2].text()).to.be("cherries");
This IS CORRECT on Android but instead returns this way for iOS:
expect(await amounts[0].text()).to.be("oranges");
expect(await amounts[1].text()).to.be("apples");
expect(await amounts[2].text()).to.be("cherries");
Is this a known issue/difference with iOS? Aside from applying an index directly to the accessibility label and accessing the element that way is there another way to address this? I’ve not seen a report directly of this and would be interested to know if anyone has experienced this/something similar.