Detox: await element(by.type('_UIBackButtonContainerView')).tap() no longer works with version 17.0.*

Created on 1 Jul 2020  ·  5Comments  ·  Source: wix/Detox

Description

E2E test with await element(by.type('_UIBackButtonContainerView')).tap(); on iOS work fine with version 16.7.1 but no longer work with 17.0.*

  • [x] I have tested this issue on the latest Detox release and it still reproduces

Reproduction

Provide the steps necessary to reproduce the issue. If you are seeing a regression, try to provide the last known version where the issue did not reproduce.

  1. Run test with await element(by.type('_UIBackButtonContainerView')).tap(); on iOS, which work fine with version 16.7.1
  2. Run same test with 17.0.* but it produces the following error.
Test Failed: View “<_UIBackButtonContainerView: 0x7fcce1f9b3c0>” is not hittable at point “{"x":22,"y":22}”: View has user interaction disabled (userInteractionEnabled == NO)
    TIP: To print view hierarchy on failed actions/matches, use loglevel verbose and above.

Expected behavior

Test should run as expected

Screenshots

N/A

Environment (please complete the following information):

  • Detox: 17.0.2
  • React Native: 0.61.5
  • Node: v14.2.0
  • Device: iPhone 8 Simulator
  • Xcode: 11.4.1
  • iOS: 13.4.1
  • macOS: 10.15.4

Logs

If you are experiencing a timeout in your test

If you are seeing a build problem (e.g. during npm install)

  • [ ] I am providing the npm install log below:

Device and verbose Detox logs

  • [x] I have run my tests using the --loglevel trace argument and am providing the verbose log below:
       |    |    | <UINavigationBar: 0x7fdab06f3080; frame = (0 20; 375 44); opaque = NO; autoresize = W; tintColor = UIExtendedSRGBColorSpace 1 1 1 1; layer = <CALayer: 0x6000030019c0>> standardAppearance=0x6000022f8780
       |    |    |    | <_UIBarBackground: 0x7fdab06631c0; frame = (0 -20; 375 64); userInteractionEnabled = NO; layer = <CALayer: 0x600003000020>>
       |    |    |    |    | <UIImageView: 0x7fdab8a7ae50; frame = (0 0; 375 64); userInteractionEnabled = NO; layer = <CALayer: 0x600003003420>>
       |    |    |    | <_UINavigationBarContentView: 0x7fdab8a7cdb0; frame = (0 0; 375 44); clipsToBounds = YES; layer = <CALayer: 0x600003003520>> layout=0x7fdab8d1ac70
       |    |    |    |    | <_UIButtonBarStackView: 0x7fdab8d1e720; frame = (324 0; 35 44); layer = <CALayer: 0x6000030c0460>> buttonBar=0x6000008bac10
       |    |    |    |    |    | <_UITAMICAdaptorView: 0x7fdab8ad22f0; frame = (0 10; 35 24); autoresizesSubviews = NO; layer = <CALayer: 0x6000030e85a0>>
       |    |    |    |    |    |    | <UIButton: 0x7fdab8f084a0; frame = (0 0; 35 24); opaque = NO; layer = <CALayer: 0x6000030011e0>>
       |    |    |    |    |    |    |    | <UIImageView: 0x7fdab8a8a610; frame = (0 0; 35 24); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x6000030eb160>>
       |    |    |    |    | <_UIButtonBarButton: 0x7fdab8d1bc50; frame = (0 0; 44 44); tintColor = UIExtendedSRGBColorSpace 1 1 1 1; layer = <CALayer: 0x6000030c5b20>>
       |    |    |    |    |    | <_UIModernBarButton: 0x7fdab8d1ca70; frame = (8 11.5; 13 21); opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x6000030bbb00>>
       |    |    |    |    |    |    | <UIImageView: 0x7fdab8a91aa0; frame = (0 0; 13 21); clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x6000030e9260>>
       |    |    |    |    |    | <_UIBackButtonContainerView: 0x7fdab8d1dd40; frame = (0 0; 44 44); autoresize = W+H; userInteractionEnabled = NO; layer = <CALayer: 0x6000030a28a0>>
       |    |    |    |    | <_UITAMICAdaptorView: 0x7fdab8f0eb20; frame = (91 0; 193 44); autoresizesSubviews = NO; layer = <CALayer: 0x600003004120>>
       |    |    |    |    |    | <RNNTitleView: 0x7fdab8ad6a00; frame = (0 0; 193 44); clipsToBounds = YES; autoresize = LM+W+RM+H; layer = <CALayer: 0x600003036ec0>>
       |    |    |    |    |    |    | <UILabel: 0x7fdab8a91150; frame = (0 10.5; 193 23); text = 'Bitcoin wallet address'; autoresize = W; userInteractionEnabled = NO; layer = <_UILabelLayer: 0x6000014389b0>>
       |    |    |    | <UIView: 0x7fdab8ae8ea0; frame = (0 0; 0 0); userInteractionEnabled = NO; layer = <CALayer: 0x600003002f20>>

      134 |   async goBack() {
      135 |     if (device.getPlatform() === 'ios') {
    > 136 |       await element(by.type('_UIBackButtonContainerView')).tap();
          |                                                            ^
      137 |     } else {
      138 |       await device.pressBack();
      139 |     }
invalid ios

Most helpful comment

Awesome. I'll keep an eye out for that.

Thanks for the useful info @LeoNatan

All 5 comments

Detox is now more strict with what can be tapped. The view in question has userInteractionEnabled = NO, which means it is explicitly marked as not hittable.

You should try choosing a different view to tap on, such as that view’s super view.

Well, I'm using react-native-navigation and the back button is a native back button (_UIBackButtonContainerView) .

I don't think I can attach a testID to that.

RNN are working on adding a constant testID which you will be able to use. CC @yogevbd

Awesome. I'll keep an eye out for that.

Thanks for the useful info @LeoNatan

Was this page helpful?
0 / 5 - 0 ratings