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

Support tapping on a point within an element #2059

Open
tokou opened this issue Sep 16, 2024 · 0 comments
Open

Support tapping on a point within an element #2059

tokou opened this issue Sep 16, 2024 · 0 comments
Labels
bug Something isn't working maestro cli Related to the command-line Maestro tool P2 Important and valid issues not at the top of the work list

Comments

@tokou
Copy link
Contributor

tokou commented Sep 16, 2024

Note

To my surprise, this is documented as working, so maybe this should be a bug
https://maestro.mobile.dev/api-reference/commands/tapon#tapping-on-a-specific-point-within-another-element

Use case

Tapping on an element will automatically tap on the center of the element
This can lead to issues in cases where the element id refers to a large area that could have specific tap zones

Example: This whole area is tappable and has a single element id. However it contains links in the spannable text.
Capture d’écran 2024-09-16 à 14 22 19

Other examples include needing to tap on specific areas of large images:
Capture d’écran 2024-09-16 à 14 26 51

Proposal

Make it so that

- tapOn:
    id: 'large_button'
    point: '10%, 50%'

Would tap on the left side of the selected element instead of the current behavior of simply ignoring the id

Anything else?

We might want to add it as a separate field

This is the related code

return if (point != null) {
MaestroCommand(
TapOnPointV2Command(
point = point,
retryIfNoChange = retryIfNoChange,
longPress = longPress,
repeat = repeat,
waitToSettleTimeoutMs = waitToSettleTimeoutMs,
label = label,
optional = optional,
)
)
} else {
MaestroCommand(
command = TapOnElementCommand(
selector = toElementSelector(tapOn),
retryIfNoChange = retryIfNoChange,
waitUntilVisible = waitUntilVisible,
longPress = longPress,
repeat = repeat,
waitToSettleTimeoutMs = waitToSettleTimeoutMs,
label = label,
optional = optional,
)
)
}

This should obviously work with any element selector, not just id

Here's an e2e test

appId: com.example.example
tags:
    - passing
---
- launchApp:
    clearState: true
- tapOn: 'Swipe Test'
- tapOn:
    text: 'End here!'
    point: '90%, 90%'

I thought this would do the trick but it does not behave as expected:

appId: com.example.example
tags:
    - passing
---
- launchApp:
    clearState: true
- tapOn: 'Swipe Test'
- tapOn:
    point: '90%, 90%'
    childOf:
      text: 'End here!'
- tapOn:
    text: 'End here!'
    containsChild:
      point: '90%, 90%'
@bartekpacia bartekpacia added bug Something isn't working P2 Important and valid issues not at the top of the work list maestro cli Related to the command-line Maestro tool labels Sep 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working maestro cli Related to the command-line Maestro tool P2 Important and valid issues not at the top of the work list
Projects
None yet
Development

No branches or pull requests

2 participants