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

"eraseText" cannot clear an edittext #495

Open
RobinCaroff opened this issue Dec 13, 2022 · 7 comments
Open

"eraseText" cannot clear an edittext #495

RobinCaroff opened this issue Dec 13, 2022 · 7 comments
Labels
bug Something isn't working platform: android Testing Android apps is affected

Comments

@RobinCaroff
Copy link

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: "[email protected]"

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

Expected result

The EditText should contain "[email protected]"

Observed result

The EditText contains "[email protected]" <-- 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: "[email protected]"
@ArthurSav
Copy link
Contributor

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!

@ArthurSav ArthurSav closed this as not planned Won't fix, can't repro, duplicate, stale May 3, 2023
@phuchuynhStrong
Copy link

@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

@ArthurSav ArthurSav reopened this May 9, 2023
@ArthurSav ArthurSav added bug Something isn't working platform: android Testing Android apps is affected labels May 9, 2023
@aakashfmk
Copy link

aakashfmk commented Jun 11, 2023

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
Copy link

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
Copy link

TheLastProject commented Sep 28, 2023

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

@hormesiel
Copy link

Still running into the same problem with Maestro CLI v1.38.1 when executing tests on a physical Android device (OnePlus Nord, Android 12, connected to Windows 11 via USB).

@Fishbowler
Copy link
Contributor

There's some workarounds here.

One is:

- tapOn:
    id: myTextField
    point: "95%,50%"
- eraseText

This will erase more text than the simple version, by setting the text caret further along the input.

Another is to write a flow that does a longpress on the text field, hits Select All, then eraseText: 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working platform: android Testing Android apps is affected
Projects
None yet
Development

No branches or pull requests

8 participants