Detox: Detox selector failing after upgrade

After the RN upgrade, the by.traits(['selected']) stopped working. It seems that Detox doesn’t fully support 0.61 and I’m open to helping with this if some sort of guidance can be given to me (where should I change stuff to identify why it fails)

The same error is described at Stackoverflow but I think it may not be just a help request

The suite that is failing has basically two tests:

[PASS] element(by.id('FirstName').withAncestor(by.id('SignUpScreen'));
[FAIL] element(by.id('FirstName').withAncestor(by.id('SignUpScreen')).and(by.traits(['selected'])));

The failing one shows the following “query”:

(
    (
        !(kindOfClass('RCTScrollView')) && 
        (
            (
                (
                    (respondsToSelector(accessibilityIdentifier) && accessibilityID('FirstName')) 
                    && (
                        (kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) 
                        && ancestorThatMatches((respondsToSelector(accessibilityIdentifier) && accessibilityID('SignUpScreen')))
                    )
                ) && ((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityTraits: UIAccessibilityTraitSelected))
            && !(kindOfClass('UIAccessibilityTextFieldElement'))
        )
    ) || 
    (
        (
            (kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) 
            && parentThatMatches(kindOfClass('RCTScrollView'))
        ) 
        && (
            (kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) 
            && parentThatMatches(((
                (
                    (respondsToSelector(accessibilityIdentifier) && accessibilityID('FirstName')) && 
                    (
                        (kindOfClass('UIView') || respondsToSelector(accessibilityContainer)) 
                        && ancestorThatMatches((respondsToSelector(accessibilityIdentifier) && accessibilityID('SignUpScreen')))
                    )
                ) && ((respondsToSelector(isAccessibilityElement) && isAccessibilityElement) && accessibilityTraits: UIAccessibilityTraitSelected)
            ) && !(kindOfClass('UIAccessibilityTextFieldElement'))))
        )
    )
)

And the following hierarchy (cleaned up a bit):

|--<RCTScrollView:0x7f92ab6ee4d0; AX=N; AX.id='SignUpScreen';>
|  |  |--<RCTView>
|  |  |  |--<RCTSinglelineTextInputView>
|  |  |  |  |--<RCTUITextField AX.id='LastName'; AX.traits='UIAccessibilityTraitSelected'>
|  |  |  |  |  |--<_UITextFieldCanvasView>
|  |  |  |  |  |--<UIAccessibilityTextFieldElement AX.id='LastName'; AX.traits='UIAccessibilityTraitSelected'>
|  |  |--<RCTTextView AX.id='Typography'; AX.label='Last name'; AX.traits='UIAccessibilityTraitStaticText'>
|  |--<RCTView AX.label='First name';>
|  |  |--<RCTView>
|  |  |  |--<RCTSinglelineTextInputView>
|  |  |  |  |--<RCTUITextField AX.id='FirstName'; AX.traits='UIAccessibilityTraitSelected'>
|  |  |  |  |  |--<UIFieldEditor>
|  |  |  |  |  |  |--<_UITextFieldCanvasView>
|  |  |  |  |  |  |  |--<UITextSelectionView>
|  |  |  |  |  |  |  |  |--<UIView>
|  |  |  |  |  |--<UIAccessibilityTextFieldElement AX.id='FirstName'; AX.traits='UIAccessibilityTraitSelected'>

Now, it’s weird to me that the whole problem is around the .and(by.traits(['selected']))) part, which used to work at 0.59.10.

And, as far as I understand, both query and hierarchy have the UIAccessibilityTraitSelected… so… why exactly it is failing? What am I missing?

Some other tests I did:

[FAIL] element(by.id('FirstName').and(by.traits(['selected'])))
[FAIL] element(by.traits(['selected']).withAncestor(by.id('SignUpScreen')))
[PASS] element(by.id('FirstName'))
[PASS] element(by.id('FirstName').withAncestor(by.id('SignUpScreen')))

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 20 (18 by maintainers)

Most upvoted comments

When it’s done. There is a lot of work still, and also it will take a while to stabilize.

Hello,

We are currently working on a new underlying system to replace Earl Grey, so until that arrives, I don’t think we’ll invest much time in Earl Grey issues (which this looks like).

If you’d like to assist with debugging, please follow the Xcode integration guide and investigate why Earl Grey fails to match this combination.

Thanks