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

[Feature Request] Proposal for pinch gesture command without using multi-touch #2169

Open
rafaeljustinox opened this issue Dec 3, 2024 · 1 comment
Labels

Comments

@rafaeljustinox
Copy link

rafaeljustinox commented Dec 3, 2024

Use case

I'd like to test a feature of an app that requires the pinch gesture to zoom in and out, for example on a map. However, Maestro doesn't currently support this type of gesture. I think that's because it's difficult to implement multi-touch gestures. But I have a proposal that could help us to have this type of gesture.

Proposal

Pinch Gesture Command

Android and iOS allow you to perform the pinch gesture by touching the screen with just one finger. All you need to do is double tap, but keeping your finger on the screen on the second tap and drag up or down (demo).

In the videos below you can check out the behavior on both platforms. I wish I had used the same app to demonstrate, as Apple Maps uses the pinch interaction differently, so please ignore this difference in the videos.

If you test with the same target component, you'll see that the behavior is the same. The difference is that on iOS you drag up to zoom in while on Android you need to drag down.

Android iOS
android-single-touch-pinch-simulation.mp4
ios-single-touch-pinch-simulation.mp4

How to implement

Since we have the tapOn and swipe commands, I tried to use them to simulate the pinch gesture, but was unsuccessful. Also, I tried to change the tapOn property waitToSettleTimeoutMs to 0 ms to decrease the time between the two commands but again, without success. The time between commands is not short enough.

# Unsuccessful attempt using existing commands
- tapOn:
    point: 50%, 50%
    waitToSettleTimeoutMs: 0
- swipe:
    start: 50%, 50%
    direction: DOWN

So the proposal is very simple: Create a new command that executes tapOn and swipe inner behavior in sequence

I haven't delved into how they work internally, but I see a great possibility that if they are run in sequence with a very short time between them, this could be possible.

Is this proposal viable?

Thanks

Anything else?

No response

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

No branches or pull requests

2 participants