maestro icon indicating copy to clipboard operation
maestro copied to clipboard

tapOn doesn't work on certain button

Open nurralfiah opened this issue 2 years ago • 2 comments

Describe the bug I want tapOn Lanjut button to the next page, but it doesn't work (I use tapOn: .*Lanjut because on maestro studio it looks Kembali\nLanjut). It passed, but nothing changed (stay on the page)

On maestro studio seems that the button text is seen as one element. I've add semanticlabel but it still didn't work.

To Reproduce

  1. run maestro studio
  2. Click one of the button (see the accessibility text)
  3. Execute with tapOn:

Expected behavior I can tapOn Lanjut button without using tapOn point.

Screenshots

  • I have two buttons (Kembali and Lanjut button). Kembali button is a disable button image
  • on maestro studio image
  • Run on maestro studio image

Environment information (please complete the following information):

  • Maestro version: 1.29.0
  • Platform: iOS 16.4 and Android 13.0
  • Framework: Flutter
  • Device model and OS version: iPhone 14, Pixel 3a
  • Host: Mac M2

Workspace (if applicable) N/A

Bugreport output (if applicable) N/A

Additional context I have another button looks like the screenshoot above but in different page, seen as two elements different.

nurralfiah avatar Jul 11 '23 08:07 nurralfiah

Hello @nurralfiah, That's most likely because those two buttons are children of the same parent element and then that's how Flutter combines their accessibility_ids together. There are no logs attached to your case but it seems that Maestro properly taps on the demanded element Kembali\nLanjut, but since the tapOn action is by default done on 50% 50% coords inside the element (in the middle) which in Your case is the empty space between the buttons and that's why nothing happens from Your perspective.

What I'd advise is to:

  • try to play around with Flutter semantic labels (https://maestro.mobile.dev/platform-support/flutter)
  • use coords to tap within this element with two buttons. It's best to avoid % coords though as they increase flakiness. (https://maestro.mobile.dev/api-reference/commands/tapon#tapping-on-a-specific-point-within-another-element)

kakuhd avatar Aug 11 '23 12:08 kakuhd

I have a similar problem. On iOS, I am trying to get Maestro to click the Track time button. The + is independent of the Track time within the button. However, the Studio is unable to detect this button, and is instead detecting the horizontal scroll bar. Trying to use its ID is also not functional, while the same is all possible using the Detox framework.

However,

tapOn:
    point: 50%, 87%

clicks the button, but as expected, it would lead to flakiness if the screen size were to change.

Could I please get some clarity on this ?

Studio Button details
image image

Interestingly, the button on the next screen is detected: image

apurva-harvest avatar Apr 25 '24 17:04 apurva-harvest