Detox: Where is the output for the UI Hierarchy?

Created on 16 May 2018  路  5Comments  路  Source: wix/Detox

Description

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.

Steps to Reproduce

  1. Write a test with an expect matcher for a non-existing ID
  2. Run the detox tests

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 7.3.3
  • React Native: 0.52.1
  • Node: v9.0.0
  • Device: iPhone 7
  • Xcode: 9.3.1 (9E501)
  • macOS: 10.13.4

Device and verbose Detox logs

Not applicable

acceptebug 馃搶 pinned

Most helpful comment

View hierarchy is now forwarded to the tester, which will include it in the failure reason for failing tests.

All 5 comments

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

carlosalmonte04 picture carlosalmonte04  路  4Comments

aamorozov picture aamorozov  路  3Comments

jrobber picture jrobber  路  3Comments

lc3t35 picture lc3t35  路  4Comments

mhyousefi picture mhyousefi  路  3Comments