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:

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??

Because of this issue, we cannot automate our react-native app for IOS. In IOS we see that the data test selectors are combined everywhere. This has become a blocker to us as we cannot traverse more than the specified depth of 60 as mentioned above.

Some iOS developer to help us, please? According to the interaction on this post, this issue deserves some attention, please please!

I am experiencing the same issue, which is preventing me from testing my React Native app on iOS. Could anyone please assist?

Hello, I'm facing same issue. Can't run tests on ios. Kindly help.

I have the same issue. Looks like a common problem.

The 60 depth maximum was added to prevent apps from slowing down system performance when UI queries occur during an XCTest UI test. Unfortunately React Native often creates nested hierarchies that are larger than 60 levels of depth on iOS. That said, you should be able to use webdriverIO for testing, which would not face this 60 depth maximum limit.

Any updates on resolving this issue?

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