fknives / Android-Tutorial-Test-ShowCase

Mock project showcasing testing on Android. It is used as a CodeKata.
Apache License 2.0
7 stars 2 forks source link

Issue in Home Screen RecyclerView test #103

Closed fknives closed 2 years ago

fknives commented 2 years ago

Describe the bug An issue occurred when testing Home screen's RecyclerView

Logs Emulator-Test-Results-21.zip

Additional context Emulator 21

fknives commented 2 years ago

JVM Test Results.zip

fknives commented 2 years ago

Emulator Looks like some kind of synchronisation issue: Emulator-Test-Results-21.zip Emulator-Logcat-Logs-21.zip

test-showcase-MainActivityInstrumentedTest-errorIsShownIfTheDataIsFetchedAndErrorIsReceivedc4-FAIL-1658230731663-c063b4de-d3d5-4b5c-b7f5-139d131578fc

The views are being animated out, so they still somewhat show when checking ^^

Robolectric Similar thing in JVM, the TextView is not yet showed. JVM Test Results.zip

fknives commented 2 years ago

After investigations, it seems to boil down to 2 issues:

ItemAnimator The solution for here should be straight forward, via Espresso Remote the itemAnimator before checking the RecyclerView.

Retrofit race condition Since we cannot yet Replace Dispatchers.Default in tests, the best course of action for now, is to simply have a delay in the OkHttpIdling resource. It's documentation should describe why it's necessary and include the specific issues: