Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long press from longPressAndDrag not being detected until after drag is completed #3861

Open
2 tasks done
aaulthudl opened this issue Jan 20, 2023 · 18 comments
Open
2 tasks done

Comments

@aaulthudl
Copy link

aaulthudl commented Jan 20, 2023

What happened?

I have tried to integrate it into a test in my app which involves a draggable flatlist from https://www.npmjs.com/package/react-native-draggable-flatlist. This flatlist has its list items wrapped inTouchableHighlight elements with onLongPress={drag}. When running the tests it seems that it tries to press but it isn't detected by the system, then it does the drag (which doesn't accomplish much). After the longPressAndDrag, it looks like a press is then detected.

I removed the dependency of react-native-draggable-flatlist and logged when the onLongPress on the TouchableHighlight is called and it's not called until after the longPressAndDrag action finishes. I tried a normal longPress and that worked as expected and was detected by the system.

Disabling/dabbling around with synchronization produced no results.

What was the expected behaviour?

The Detox test interacts with the UI like a user would. Long press is not detected until after the whole action finishes and therefore the drag doesn't result in anything.

Was it tested on latest Detox?

  • I have tested this issue on the latest Detox release and it still reproduces.

Did your test throw out a timeout?

Help us reproduce this issue!

  1. Clone simplified repo https://github.com/tanakaderoy/detoxIssueRepro/
  2. Checkout branch longPressAndDragRepro
  3. Use a compatible version of node (e.g. 16.10.0)
  4. yarn install and yarn setup to install dependencies
  5. yarn start to run Metro
  6. yarn e2e-build ios.debug to build for Detox
  7. yarn e2e-run ios.debug to run the singular test that does the longPressAndDrag

If you want to run it locally then do:

  1. Steps 1-5 above are completed
  2. Open ios/detoxIssueRepro.xcworkspace in Xcode
  3. Build and run
  4. In app, long press on a list item and then drag -> see it works as expected

In what environment did this happen?

Detox version: 20.1.0
React Native version: 18.0.0
Has Fabric (React Native's new rendering system) enabled: no
Node version: 16.10.0
Device model: iPhone 14 Pro
iOS version: 12.4
macOS version: 12.6.2 on Apple Silicon
Xcode version: 14.1
Test-runner (select one): jest

Detox logs

Github was returning the error There was an error creating your Issue: body is too long (maximum is 65536 characters). when I had the log in here so I put it in pastebin.

https://pastebin.com/WBwYve4U

Device logs

Device logs
arron.ault@HUD040087 detoxIssueRepro % yarn e2e-run ios.debug --record-logs all
yarn run v1.22.19
$ detox test -c ios.debug --record-logs all
17:40:49.876 detox[43451] B jest --config e2e/jest.config.js
watchman warning:  Recrawled this watch 5 times, most recently because:
MustScanSubDirs UserDroppedTo resolve, please review the information on
https://facebook.github.io/watchman/docs/troubleshooting.html#recrawl
To clear this warning, run:
`watchman watch-del '/Users/arron.ault/detoxIssueRepro' ; watchman watch-project '/Users/arron.ault/detoxIssueRepro'`

17:40:54.203 detox[43453] i drag.e2e.ts is assigned to 1B71F80E-EEC3-49A8-A570-B4A8F58A2249 (iPhone 12)
17:40:56.075 detox[43453] i org.reactjs.native.example.detoxIssueRepro launched. To watch simulator logs, run:
        /usr/bin/xcrun simctl spawn 1B71F80E-EEC3-49A8-A570-B4A8F58A2249 log stream --level debug --style compact --predicate 'process == "detoxIssueRepro"'
17:40:57.936 detox[43453] i Drag: should drag and rearrange
17:41:03.602 detox[43453] i Drag: should drag and rearrange [OK]

 PASS  e2e/drag.e2e.ts (13.11 s)
  Drag
    ✓ should drag and rearrange (5601 ms)

✨  Done in 14.38s.
arron.ault@HUD040087 detoxIssueRepro %

More data, please!

Untitled.mp4
@noomorph
Copy link
Collaborator

Thanks for providing the repository for the reproduction. I hope @asafkorem will be able to look at it soon.

@aaulthudl
Copy link
Author

Hi @asafkorem, is there any update on this please?

@asafkorem
Copy link
Contributor

Hi @aaulthudl, sorry, I haven't gotten to it yet. I will take a look today or tomorrow.

@asafkorem
Copy link
Contributor

asafkorem commented Mar 5, 2023

I was able to reproduce this issue (using @aaulthudl's repo). Investigating.

@asafkorem
Copy link
Contributor

Hey @aaulthudl, thanks for report. Indeed, it looks like there's some conflict with the gesture handling of this library (and its dependency - RN-Gesture-Handler) and Detox, which will require deeper investigation from my end.

For the meanwhile, I think I found some workaround for you (please confirm).
Add a separate await from.longPress(1000); call right before calling longPressAndDrag. It worked for me with the reproduction test although it shouldn't basically, I will keep this issue open and will update here with any future progress on that matter.

@aaulthudl
Copy link
Author

@asafkorem

Hey @aaulthudl, thanks for report. Indeed, it looks like there's some conflict with the gesture handling of this library (and its dependency - RN-Gesture-Handler) and Detox, which will require deeper investigation from my end.

For the meanwhile, I think I found some workaround for you (please confirm). Add a separate await from.longPress(1000); call right before calling longPressAndDrag. It worked for me with the reproduction test although it shouldn't basically, I will keep this issue open and will update here with any future progress on that matter.

It didn't work for me sadly.

@stale
Copy link

stale bot commented Apr 6, 2023

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 repository, read this discussion.

@stale stale bot added the 🏚 stale label Apr 6, 2023
@aaulthudl
Copy link
Author

This is still required

@stale stale bot removed the 🏚 stale label Apr 13, 2023
@stale
Copy link

stale bot commented May 19, 2023

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 repository, read this discussion.

@stale stale bot added the 🏚 stale label May 19, 2023
@aaulthudl
Copy link
Author

This is still required

@aaulthudl
Copy link
Author

Is there any update on this issue please?

@aaulthudl
Copy link
Author

Bump on this again please

@aaulthudl
Copy link
Author

Any update regarding this please?

@aaulthudl
Copy link
Author

@asafkorem Any update on this please?

@michaeldawson
Copy link

michaeldawson commented May 15, 2024

This is also an issue for us. We need to run longPressAndDrag twice in the test, which can cause test errors related to visibility of the pressable item if a ScaleDecorator is used (e.g. if the pressable item expands and is no longer 100% visible), the second "longPressAnDrag" that is required because of this issue can fail as the item is no longer 100% visible)

@aaulthudl
Copy link
Author

Are there any updates on this please?

@asafkorem
Copy link
Contributor

asafkorem commented Jul 23, 2024

Unfortunately, there isn't a straightforward solution for your case I can point on, though it's possible that something is incorrect on this implementation.

Currently, there is no priority or ETA from the Detox team to investigate this issue any deeper. However, we welcome external contributors who are interested in exploring this further.

Copy link

Hello! We appreciate you bringing this issue to our attention.
It looks like this could be a valuable addition or fix to our project.
We believe that this feature would benefit greatly from contributions from the community,
even from first-time contributors.

If you're interested in contributing to this feature,
please take a look at our contribution guide.
It has all the information you need to know about how to submit a pull request and contribute to our project.

You're also welcome to join our Discord server
and discuss this feature with the collaborators or other contributors under the channel 'contributions'.

Please feel free to reach out to us if you have any questions, or need help with anything.
We appreciate your feedback and look forward to working with you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants