mobile-dev-inc / maestro

Painless Mobile UI Automation
https://maestro.mobile.dev/
Apache License 2.0
5.67k stars 258 forks source link

"eraseText" cannot clear an edittext #495

Open RobinCaroff opened 1 year ago

RobinCaroff commented 1 year ago

Description

After editing an edittext with wrong data I try to go back to the edittext and remove its content before inputting a new content.

Problem

When selecting the edittext, the cursor is placed at the middle of the EditText and the eraseText instruction only removes what's on the left of the cursor.

Environment

Pixel 3a / Android 12 Maestro 1.17.2

Steps to reproduce

- tapOn:
    id: "edittext_signup_email"
- inputText: "invalidemail.fr"
- tapOn:
    id: "some_other_view"
- tapOn:
    id: "edittext_signup_email"
- eraseText
- inputText: "valid@email.fr"

In case you cannot reproduce try to use a very long initial input.

Expected result

The EditText should contain "valid@email.fr"

Observed result

The EditText contains "valid@email.fr.fr" <-- the end of the previous input remains.

Temporary fix

As a temporary fix, I select the Edittext and eraseText twice before editing it:

- tapOn:
    id: "edittext_signup_email"
- eraseText
- tapOn:
    id: "edittext_signup_email"
- eraseText
- inputText: "valid@email.fr"
ArthurSav commented 1 year ago

We have made a lot of improvements and fixes since, can you upgrade to the latest version of Maestro and try again?
If you still experience issues, we can re-open this.
Thanks again for using Maestro!

phuchuynhStrong commented 1 year ago

@ArthurSav I still experience this issue with version 1.27.0

Environment

Pixel 6a / Android 13 Maestro 1.27.0

Steps to reproduce

- launchApp
- assertVisible:
    text: "Sign in"
- tapOn: "Email"
- eraseText
aakashfmk commented 1 year ago

Hi, is there any update on this? I'm still facing this issue on Maestro 1.28.0 Meanwhile, if you have any alternate options to clear the entire text please suggest.

ferdy-roz commented 1 year ago

Also running into this on iOS, only on maestro cloud. Please provide some guidance here -- I am trying to onboard our process onto this tool but this makes the cloud product unusable

TheLastProject commented 11 months ago

Can confirm this is still a thing on 1.33.0.

My workaround is to use repeat to at least lower the amount of code (which is really just a slightly more DRY version of @RobinCaroff's original workaround, thank!):

- repeat:
    times: 2
    commands:
      - tapOn: <field that needs to be erased>
      - eraseText