android / android/android-test

Better error messages when no matching view was found in an Espresso test

Aperta
#219 2 commenti 0 reazioni 1 assegnatario Rivendicata da @adazh Vedi su GitHub
Lingua principale
Java
Stelle
1.2k
Fork
342
Merge medio
11h 29m
PR unite (30g)
2

Descrizione

### Description
Currently, when no matching view is found, Espresso throws an error message with a description of the view matcher itself (via decribeTo), with no mismatching message that could potentially help users understand why mismatching happens.
It will become painful when debugging a nested matcher like:
onView(firstOf(allOf(
withId(R.id.overflow_button),hasSibling(hasDescendant(withText("some title"))))))
.perform(CustomAction.click());

### Steps to Reproduce
An Espresso test that no View matches the given matcher.

### Expected Results
A more concise error message for debugging purposes, e.g. highlights potential matching views, suggesting correct matchers.

### Actual Results
Espresso prints out the matcher + entire view hierarchy.

### AndroidX Test and Android OS Versions

### Link to a public git repo demonstrating the problem:

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.