Search code examples
objective-cxcodeautomated-testsxcode-ui-testing

XCUI Test: app.debugDescription shows info of the last screen


When I execute the command

(lldb) po app.debugDescription

it displays the details from the last view. How do I refresh it to show the new element tree??


Solution

  • The view hierarchy will refresh when you interact with the app (since it's reasonable to expect that the app's state doesn't change unless the user interacts with it).

    To get a fresh view hierarchy, you can either tap on the app: app.tap() and then print the debug description, or you could create a new instance of XCUIApplication and use that instead of the existing app property which has the cached view hierarchy. The new instance should show a fresh view hierarchy.