Detox: .toHaveLabel() and .toHaveText() fail to match emojis

Created on 23 Jul 2019  路  4Comments  路  Source: wix/Detox

Describe the bug

    An assertion failed.
    Exception with Assertion: {
      "Assertion Criteria":  "assertWithMatcher:(((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityLabel('test聽馃攣')) && !(descendantThatMatches((kindOfClass('RCTTextView') && ((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityLabel('test聽馃攣'))))))",
      "Element Matcher":  "((!(kindOfClass('RCTScrollView')) && (respondsToSelector(accessibilityIdentifier) && accessibilityID('18099-test'))) || (((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches(kindOfClass('RCTScrollView'))) && ((kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) && parentThatMatches((respondsToSelector(accessibilityIdentifier) && accessibilityID('18099-test'))))))"
    }


    Error Trace: [
      {
        "Description":  "Assertion with matcher [M] failed: UI element [E] failed to match the following matcher(s): [S]",
        "Description Glossary":    {
          "M":  "(((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityLabel('test聽馃攣')) && !(descendantThatMatches((kindOfClass('RCTTextView') && ((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityLabel('test聽馃攣'))))))",
          "E":  "<RCTView:0x7fb85bc466d0; AX=N; AX.id='18099-test'; AX.label='test聽馃攣'; AX.frame={{6, 135.66666793823242}, {318, 42.666656494140625}}; AX.activationPoint={165, 156.99999618530273}; AX.traits='UIAccessibilityTraitNone'; AX.focused='N'; frame={{0, 0}, {318, 42.666656494140625}}; opaque; alpha=1>",
          "S":  "isAccessibilityElement"
        },
        "Error Domain":  "com.google.earlgrey.ElementInteractionErrorDomain",
        "Error Code":  "3",
        "File Name":  "GREYAssertions.m",
        "Function Name":  "+[GREYAssertions grey_createAssertionWithMatcher:]_block_invoke",
        "Line":  "75"
      }
    ]

To Reproduce

Try to match an element with an emoji in it. I tried both with the emoji utf-8 character pasted in and it's escaped \u00a0\uD83D\uDD01 representation.

Expected behavior

To be able to match emojis etc.

Screenshots

Environment (please complete the following information):

  • Detox: 13.0.2
  • React Native: 0.59.9
acceptebug ios 馃搶 pinned

Most helpful comment

We are working on replacing the current matching infrastructure. This will hopefully be resolved once we move to the new system.

All 4 comments

Interesting usecase. I will try to reproduce and see where it fails, but we might be limited with what we can do to counter this. If it's an issue with how we encode strings, this can be solved. If it's an issue with Earl Grey, we most likely won't be able to.

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!

For more information on bots in this reporsitory, read this discussion.

We are working on replacing the current matching infrastructure. This will hopefully be resolved once we move to the new system.

This should be solved in a future release. We now use standard NSPredicate to match views, so emoji (or any unicode string for that matter) should be natively supported.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brunobar79 picture brunobar79  路  4Comments

carlosalmonte04 picture carlosalmonte04  路  4Comments

lmarques6 picture lmarques6  路  4Comments

kceb picture kceb  路  4Comments

raphkr picture raphkr  路  4Comments