Open jameswald opened 5 years ago
I believe the cause of the issues I'm seeing is due to Espresso failing to wait for database binder events. When I set a breakpoint in android.database.ContentObserver.dispatchChange() the failures that used to occur once in a while suddenly become instant failures even though the ContentObserver is using a Handler with the main looper. Instead, I would expect Espresso to fail after 40+ seconds waiting for resources to become idle whenever this breakpoint is active, not fail instantly. This implies that Espresso is not monitoring these Binder threads.
"Binder:27050_2"@12,700 in group "main": RUNNING
dispatchChange:198, ContentObserver {android.database}
access$000:27, ContentObserver {android.database}
onChange:231, ContentObserver$Transport {android.database}
onTransact:63, IContentObserver$Stub {android.database}
execTransact:731, Binder {android.os}
Any updates on this?
Description
After migrating to AndroidX, test execution became much less reliable. It appears that Espresso is no longer waiting for androidx.loader.content.AsyncTaskLoader to emit updated data to onLoadFinished() when tests use the content resolver to insert new data. I believe this problem may have at least two causes.
Steps to Reproduce
Expected Results
The data should be shown and Espresso checks should pass.
Actual Results
Espresso usually passes but in rare instances it fails. Espresso waits for loaders to emit at least one value, even an initial null, but it continues immediately thereafter. This seems to be true even when there are pending content change notifications.
AndroidX Test and Android OS Versions
androidx.test.espresso: 3.1.1 Android API: 28
Link to a public git repo demonstrating the problem:
May be able to provide if needed.