How to test with Espresso if the popup of an AutoCompleteTextView is open or not in my Android activity

49 views Asked by At

I have an AutoCompleteTextView in my Android Activity

In my espresso test, I want to check if the popup with the proposals is opened or closed.

How can I do that?

I have tried many ideas, including:

onData(anything()).inRoot(RootMatchers.isPlatformPopup()).check(doesNotExist());
onData(anything()).inRoot(RootMatchers.isPlatformPopup()).check(matches(isDisplayed()));
onData(anything()).atPosition(0).inRoot(RootMatchers.isPlatformPopup()).check(matches(isDisplayed()));

In these particular cases, the test just fails or goes to an infinite loop

Example:

In my Adapter, I have 2 values: "abc" and "def"

  • when I enter "d", the popup shall open with "def"
  • Then if I add "g", the popup shall close

How can I test (within an Espresso test) if the popup is closed?

0

There are 0 answers