When you write a test that can't find an element in a UI hierarchy, detox will output the following message mentioning that:
...Check if the element exists in the UI hierarchy printed below...
Error: Cannot find UI Element.
Exception with Assertion: {
"Assertion Criteria" : "assertWithMatcher:isNotNil",
"Element Matcher" : "(((respondsToSelector(accessibilityIdentifier) && accessibilityID('testId')) && !(kindOfClass('RCTScrollView'))) || (kindOfClass('UIScrollView') && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && ancestorThatMatches(((respondsToSelector(accessibilityIdentifier) && accessibilityID('testId')) && kindOfClass('RCTScrollView'))))))",
"Recovery Suggestion" : "Check if the element exists in the UI hierarchy printed below. If it exists, adjust the matcher so that it accurately matches element."
}
Error Trace: [
{
"Description" : "Interaction cannot continue because the desired element was not found.",
"Error Domain" : "com.google.earlgrey.ElementInteractionErrorDomain",
"Error Code" : "0",
"File Name" : "GREYElementInteraction.m",
"Function Name" : "-[GREYElementInteraction matchedElementsWithTimeout:error:]",
"Line" : "124"
}
]
at Client.execute (../node_modules/detox/src/client/Client.js:72:13)
No such output is generated. It would've been very helpful.
Not applicable
Hmm it used to be printed in the past. @rotemmiz ?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
If you believe the issue is still relevant, please test on the latest Detox and report back.
Thank you for your contributions.
@LeoNatan not sure if this used to work in the past, but is rather confusing.
I also ended up looking for this, so I would rather remove that than mentioning but not supporting, the latter kind of seems to be a bug
Fixed on master.
View hierarchy is now forwarded to the tester, which will include it in the failure reason for failing tests.
Most helpful comment
View hierarchy is now forwarded to the tester, which will include it in the failure reason for failing tests.