-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Description
Description
We are using Detox to run e2e test on our application. We noticed that after upgrading to version 2.25.0 (applies for all versions up to 2.28.0 which is current at time of writing) the by.id
test matcher (docs) does no longer work for RectButtons on iOS.
While debugging the issue I noticed that the testID
is applied in two places in the view hierarchy. The Component View and the actual UIControl:
Here's an excerpt of the view hierarchy of such a failing test. Notice how id="sign-in-button"
appears twice:
<RNGestureHandlerButtonComponentView class="RNGestureHandlerButtonComponentView" id="sign-in-button" label="Get started">
<RNGestureHandlerButton class="RNGestureHandlerButton" id="sign-in-button" label="Get started">
<RCTViewComponentView class="RCTViewComponentView" />
<RCTParagraphComponentView class="RCTParagraphComponentView" label="Get started" text="Get started">
<RCTParagraphTextView class="RCTParagraphTextView" />
</RCTParagraphComponentView>
</RNGestureHandlerButton>
</RNGestureHandlerButtonComponentView>
This causes Detox to fail, when looking for the object:
Test Failed: Multiple elements found for "MATCHER(id == "sign-in-button")"
I believe this might have been introduced in PR #3444 (appeared first in version 2.25.0).
Steps to reproduce
I've created a repository with a minimal reproduction scenario: https://github.com/stigi/gesture-handler-testid-bug
git clone https://github.com/stigi/gesture-handler-testid-bug.git
cd gesture-handler-testid-bug; npm i
npm run detox:build:ios
npm run detox:test:ios -- --loglevel verbose
(in a 2nd terminal)
Depending on your local setup you might have to adjust which simulator Detox chooses to test with here.
A link to a Gist, an Expo Snack or a link to a repository based on this template that reproduces the bug.
https://github.com/stigi/gesture-handler-testid-bug/
Gesture Handler version
2.25.0
React Native version
0.79.0
Platforms
iOS
JavaScript runtime
Hermes
Workflow
Using Expo Prebuild or an Expo development build
Architecture
New Architecture (Fabric)
Build type
Debug mode
Device
iOS simulator
Device model
No response
Acknowledgements
Yes