XCUItest - Accessing page content when using deeply nested React Navigation navigators on iOS Using

Hello!

I've been trying to automate tests using Appium/XCUITests in a React Native APP, but I'm finding many blockers. They are related to the amount of nested elements in the "DOM" in which the XCUItest can not go deeper to get all the elements we need.

  • snapshotMaxDepth -> The XCUITest does not support more than 60 value, otherwise it returns the following error:

Got response with status 404: {"value":{"error":"stale element reference","message":"The previously found element "Application 'xyz.***.***'" is not present in the current view anymore. Make sure the application UI has the expected state. Original error: Error kAXErrorIllegalArgument getting snapshot for element <AXUIElementRef 0x600003aaf750> {pid=95967} {uid=[ID:1 hash:0x0]}","traceback":"(\n\t0 CoreFoundation 0x00007fff20405604 __exceptionPreprocess + 242\n\t1 libobjc.A.dylib 0x00007fff201a4a45 objc_exception_throw + 48\n\t2 WebDriverAgentLib 0x000000010a3caa53 -[XCUIElement(FBUtilities) fb_takeSnapshot] + 723\n\t3 WebDriverAgentLib 0x000000010a3cad07 -[XCUIElement(FBUtilities) fb_snapshotWithAttributes:maxDepth:] + 183\n\t4 WebDriverAgentLib 0x000000010a37baea +[FBXPath writeXmlWithRootElement:indexPath:elementStore:includedAttributes:writer:] + 778\n\t5 WebDriverAgentLib 0x000000010a37b12c +[FBXPath xmlRep...

  • But if I inform less than 60, the XCUITest is not able to get all the elements we need to automate:

There are many threads about this, all of them the issue is in the XCUITest:

Post not yet marked as solved Up vote post of Atamanini Down vote post of Atamanini
360 views

Replies

Another thread related to the same issue: https://github.com/facebook/react-native/issues/30575

Absolutely the same result! Tried to play with snapshotMaxDepth and customSnapshotTimeout but nothing works, I just can't click on any element on ios. On android everything works fine, it is like a mockery of my nerve cells!

This issue has also been blocking us from testing our react native app on iOS. Our same suite that passed on Android fails against iOS, because any elements deeper in the tree are not returned with with the max 60 depth.

Any solution??