android / android/android-test

Espresso Has No Way To Assert Root Doesn't Exist

Open
#806 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.2k
Forks
342
Avg merge
11h 29m
Merged PRs (30d)
2

Description

There seems to be no good way to assert that a PopupWindow is **not** visible.

Basically, this:

https://stackoverflow.com/questions/54116938/how-to-check-that-popup-notification-is-not-displayed-espresso

This works but has a 60 sec timeout before the exception is thrown so it's no good.
```
assertThrows(
NoMatchingRootException.class,
() -> onView(isRoot()).inRoot(isPlatformPopup()).check(doesNotExist()));
```

The recommended solution works (use UiAutomator) but shouldn't Espresso also have a way to do this?

Contributor guide

Open the contributing guide

Research direction

Start by tracing Espresso's existing root matching and doesNotExist assertion behavior using the example in the issue. Compare it with the linked UiAutomator workaround and determine how a non-visible PopupWindow should be asserted without the 60-second timeout. Done means Espresso provides a reliable assertion for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile, testing
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.