wix / Detox

Gray box end-to-end testing and automation framework for mobile apps
https://wix.github.io/Detox/
MIT License
11.23k stars 1.92k forks source link

Test erroring after tapping on an element #4001

Open guillaumemeunier opened 1 year ago

guillaumemeunier commented 1 year ago

What happened?

Hi, I have been trying out Detox and my test is failing every time I try to tap on an element. It manages to tap on the desired button as I can see the bottom-sheet appearing on the Simulator but the test then fail to continue.

I tried adding a console.log after the tap() and it's not returned so there seems to be something wrong with this tapping action

Any idea why this could be occurring?

 FAIL  e2e/starter.test.js (24.981 s)
  Home screen
    ✕ "Sign in" button should be visible (18922 ms)

  ● Home screen › "Sign in" button should be visible

    The pending request #3 ("invoke") has been rejected due to the following error:

    The app has crashed, see the details below:

    Exception was thrown:
    NSInvalidArgumentException
    -[NSNull __detox_sync_untrackAnimation]: unrecognized selector sent to instance 0x1069b4590
    (
        0   CoreFoundation                      0x00000001067257e0 __exceptionPreprocess + 160
        1   libobjc.A.dylib                     0x0000000105e15144 objc_exception_throw + 56
        2   CoreFoundation                      0x000000010673449c +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0
        3   CoreFoundation                      0x00000001067296ec ___forwarding___ + 1308
        4   CoreFoundation                      0x000000010672bb6c _CF_forwarding_prep_0 + 92
        5   DetoxSync                           0x000000013f29ded0 -[_DTXCAAnimationDelegateHelper __detox_sync_animationDidStop:finished:] + 76
        6   UIKitCore                           0x000000012145246c __63-[UIViewPropertyAnimator finalizeStoppedAnimationWithPosition:]_block_invoke_4 + 276
        7   UIKitCore                           0x00000001214522b8 -[UIViewPropertyAnimator finalizeStoppedAnimationWithPosition:] + 644
        8   UIKitCore                           0x000000012144e3a8 -[UIViewPropertyAnimator _runCompletions:finished:] + 28
        9   CaregiverConnect                    0x000000010067ea58 ExpoBlur.BlurEffectView.__deallocating_deinit + 148
        10  CaregiverConnect                    0x000000010067eaac @objc ExpoBlur.BlurEffectView.__deallocating_deinit + 28
        11  libsystem_blocks.dylib              0x000000010d94ef60 bool HelperBase<GenericInline>::disposeCapture<(HelperBase<GenericInline>::BlockCaptureKind)3>(unsigned int, unsigned char*) + 64
        12  libsystem_blocks.dylib              0x000000010d94d8e4 HelperBase<GenericInline>::destroyBlock(Block_layout*, bool, unsigned char*) + 168
        13  libsystem_blocks.dylib              0x000000010d94d0ac _call_dispose_helpers_excp + 68
        14  libsystem_blocks.dylib              0x000000010d94dfb8 _Block_release + 280
        15  libsystem_blocks.dylib              0x000000010d94f05c bool HelperBase<GenericInline>::disposeCapture<(HelperBase<GenericInline>::BlockCaptureKind)4>(unsigned int, unsigned char*) + 64
        16  libsystem_blocks.dylib              0x000000010d94d8f8 HelperBase<GenericInline>::destroyBlock(Block_layout*, bool, unsigned char*) + 188
        17  libsystem_blocks.dylib              0x000000010d94d0ac _call_dispose_helpers_excp + 68
        18  libsystem_blocks.dylib              0x000000010d94dfb8 _Block_release + 280
        19  CoreFoundation                      0x00000001066166e0 __RELEASE_OBJECTS_IN_THE_ARRAY__ + 108
        20  CoreFoundation                      0x0000000106616620 -[__NSArrayM dealloc] + 264
        21  UIKitCore                           0x000000012144e1c8 -[UIViewPropertyAnimator _clearAnimationState] + 260
        22  UIKitCore                           0x000000012144d59c __61-[UIViewPropertyAnimator _setupAssociatedViewAnimationState:]_block_invoke + 120
        23  UIKitCore                           0x00000001222bd91c __UIVIEW_IS_EXECUTING_ANIMATION_COMPLETION_BLOCK__ + 28
        24  UIKitCore                           0x00000001222bdb80 -[UIViewAnimationBlockDelegate _didEndBlockAnimation:finished:context:] + 604
        25  UIKitCore                           0x00000001222991e8 -[UIViewAnimationState sendDelegateAnimationDidStop:finished:] + 212
        26  UIKitCore                           0x0000000122299624 -[UIViewAnimationState animationDidStop:finished:] + 192
        27  UIKit                               0x00000001455f4b80 -[UIViewAnimationStateAccessibility animationDidStop:finished:] + 168
        28  DetoxSync                           0x000000013f29dec8 -[_DTXCAAnimationDelegateHelper __detox_sync_animationDidStop:finished:] + 68
        29  QuartzCore                          0x000000010eb243a4 CA::Layer::run_animation_callbacks(void*) + 228
        30  libdispatch.dylib                   0x000000010e2e7768 _dispatch_client_callout + 16
        31  libdispatch.dylib                   0x000000010e2f7018 _dispatch_main_queue_drain + 1220
        32  libdispatch.dylib                   0x000000010e2f6b44 _dispatch_main_queue_callback_4CF + 40
        33  CoreFoundation                      0x0000000106689cf4 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12
        34  CoreFoundation                      0x00000001066843b0 __CFRunLoopRun + 1956
        35  CoreFoundation                      0x00000001066837f4 CFRunLoopRunSpecific + 584
        36  GraphicsServices                    0x000000010fa23c98 GSEventRunModal + 160
        37  UIKitCore                           0x0000000121e2ed1c -[UIApplication _run] + 868
        38  DetoxSync                           0x000000013f29f4d0 __detox_sync_UIApplication_run + 376
        39  UIKitCore                           0x0000000121e32d14 UIApplicationMain + 124
        40  CaregiverConnect                    0x000000010051d61c main + 96
        41  dyld                                0x0000000105499fa0 start_sim + 20
        42  ???                                 0x0000000105585e50 0x0 + 4384644688
        43  ???                                 0xc31a800000000000 0x0 + -4388054149430771712
    )

      19 |     await expect(element(by.id('LoginButton'))).toBeVisible;
      20 |     console.log('tap the button');
    > 21 |     await element(by.id('LoginButton')).tap();
         |                                         ^
      22 |     console.log('bla bla');
      23 |     await waitFor(element(by.text('agree')))
      24 |       .toBeVisible()

      at Object.tap (e2e/starter.test.js:21:41)
      at asyncGeneratorStep (../../node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
      at _next (../../node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

21:40:38.051 detox[56997] E Command failed with exit code = 1:
jest --config e2e/jest.config.js e2e
error Command failed with exit code 1.

What was the expected behaviour?

No response

Was it tested on latest Detox?

Help us reproduce this issue!

No response

In what environment did this happen?

Detox version: 20.6.0 React Native version: 0.71.4 Has Fabric (React Native's new rendering system) enabled: no Node version: 16.4 Test-runner (select one): jest

Detox logs

Detox logs ``` paste logs here! ```

Device logs

Device logs ``` paste logs here! ```

More data, please!

No response

asafkorem commented 1 year ago

Hey @guillaumemeunier, thanks for the report. Can I get more context and information that may help me investigate this issue? Does this button have any unique properties? Does it trigger any animations? It will be very useful if you'll provide me a minimal reproduction for this issue - the minimal code and dependencies required for this component that fails on tap.

asafkorem commented 1 year ago

Is the Reanimated library being utilized here?

asafkorem commented 1 year ago

I recommend on using https://github.com/wix-incubator/detoxtemplate for creating a minimal reproduction on a real RN project, this would be ideal for the investigation.

jennis-jaceparara commented 1 year ago

I am seeing this same error also. Would be great to get this fixed asap as this is a breaking change that is making me considering switching to Appium.

For me I am clicking a button that is a actually a textfield. Perhaps thats why its causing the error?

asafkorem commented 1 year ago

I am seeing this same error also. Would be great to get this fixed asap as this is a breaking change that is making me considering switching to Appium.

For me I am clicking a button that is a actually a textfield. Perhaps thats why its causing the error?

What issue are you having? Exact same error? Please share the error you're getting Without more information it will be very hard to assist you

jennis-jaceparara commented 1 year ago

Hi @asafkorem,

Sorry. Yes I'm getting the exact same error that is shown in the original message.

asafkorem commented 1 year ago

@jennis-jaceparara I see. As written before, since this error is coming from integration with 3rd party/parties it will be impossible to investigate this without a clean reproduction. If you can create a minimal project with reproduction for this error I can try to investigate this error.