android / android/android-test

Espresso.onView() won't find any view

Aperta
#645 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Java
Stelle
1.2k
Fork
342
Merge medio
11h 29m
PR unite (30g)
2

Descrizione

Description
Espresso.onView() doesn't find any view when first showing a dialog, then a second one on top, after finishing the second one.

Steps to Reproduce
Run the test proveEspressoDialogsIssue() here: https://github.com/mobilekosmos/EspressoDialogsIssue/blob/master/app/src/androidTest/java/com/issues/espressoidling/MainActivity2Test.kt

Expected Results
Espresso.onView(withText("OK")).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
should find the view

Actual Results
onView doesn't find anything with a timeout. Removing the second dialog solves the problem, so it seems that something doesn't get updated internally when returning back to the first dialog.
There is a workaround:
Espresso.onView(withText("OK")).inRoot(isDialog()).check(ViewAssertions.matches(ViewMatchers.isDisplayed()))
But anyways it should also work without "inRoot(isDialog())"

AndroidX Test and Android OS Versions
All Android versions.
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
implementation 'androidx.test.espresso:espresso-idling-resource:3.1.1'
androidTestImplementation("androidx.test.espresso:espresso-intents:3.2.0")

Link to a public git repo demonstrating the problem:
https://github.com/mobilekosmos/EspressoDialogsIssue/tree/master/app/src/androidTest/java/com/issues/espressoidling

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Esegui proveEspressoDialogsIssue() da app/src/androidTest/java/com/issues/espressoidling/MainActivity2Test.kt nel progetto di riproduzione collegato. Confronta la ricerca onView(withText(\"OK\")) che fallisce con il workaround funzionante inRoot(isDialog()), quindi traccia la gestione delle finestre di dialogo Espresso coinvolta. Il lavoro è completato quando la ricerca originale trova la vista OK visibile della prima finestra di dialogo dopo che la seconda finestra di dialogo è stata chiusa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
android, java, kotlin
Ambito
mobile, testing
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.