jeudi 15 avril 2021

How to disable EditText auto suggestion when only TESTING by Espresso in Android

What I want

  • when real, use auto suggestion
  • when testing, do not use auto suggestion because the suggestion view make testing trouble I think.
    • I just want to know the way using typeText()
    • when use replaceText(), it' ok.

For testing,I used to set inputType like this, but It doesn't work.

const val emailInputType =
        InputType.TYPE_CLASS_TEXT or 
        InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS or 
        InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS

editText.inputType = emailInputType

I guess, there is a way to set build.gradle(.app)

Is there a way to do My job(hide edittext auto suggestion when focusing in testing) in a build.gradle(.app) setting?

android{
  testOptions{
      something...
  }
}

or is there another way?

Aucun commentaire:

Enregistrer un commentaire