Asserting Page/Element tree

I have used tuneup.js before and it has a very useful function that allows automation to assert an entire page or element tree with one function. I am considering writing my own parser that takes the XML from logging the element tree, parses it to JSON and then asserts that certain elements are true.

However, it would be great if Appium provided a function like this. The reason something like this is so critical is that asserting individual elements as part of verifying a page is a considerable time suck. The calls to Appium, especially if they are running in Sauce Labs or another virtualization, take serious time and the automation will sit there and wait while elements are verified.

I am wondering if anyone has done anything like this before or if anyone else would like to see a feature like this in Appium.

we did it with Java in following way:

  1. function that reliably getting pageSource (just few retries in loop. very very random it can fail to get source and this is helpful)
  2. function that gets Nodelist with xPath evaluate. Two different evaluations for Android and iOS clients due to structure difference
  3. different functions that do whatever needed with found Nodelist e.g. getting some attribute text or number of elements in nodeList

Were does it help:

  1. iOS client first.

1.1) iOS clients can have very large source tree (e.g. list of items) as far as in source also visible items outside screen. In such case each request takes time (no matter getPagerSrouce or check that element visible with driver.findElements(MobileBy…)). Thus check that e.g. 5 elements exist on screen taking large amount of time. With implemented method above we taking screenshot of Pagesource one time and do check all needed elements inside -> speedup in times such checks.
1.2) iOS clients to check if given elements 100% visible and on displaying on screen. With Appium we can’t get 100% display on screen sometimes (due to visibility attribute setting wrong in client with some elements by some reason).

  1. iOS and Android client when we need quickly to check that some elements not exists on screen. Timeout waiting and managing is boring and sometimes does not help to speedup element absence waiting.

With Android client not any benefit against Appium requests in terms of speed.