Open TheReprator opened 3 years ago
Did you found a solution for vector drawable?
@Vacxe
One of the possible causes is using different Context in DrawableMatcher
getResourceDrawable()
uses InstrumentationRegistry.getInstrumentation().targetContext
, and this may differ from context that uses view.
In my case context inside view has a different theme, and drawable has theme attributes in it.
Hi Team,
First thanks for this great UI Testing framework. Currently i am trying to check drawable with imageview but i am getting below error, as follows,
androidx.test.espresso.base.DefaultFailureHandler$AssertionFailedWithCauseError: 'with drawable id -1 or provided instance' doesn't match the selected view. Expected: with drawable id -1 or provided instance Got: "AppCompatImageView{id=2131230883, res-name=factImage, visibility=VISIBLE, width=180, height=220, has-focus=false, has-focusable=false, has-window-focus=true, is-clickable=false, is-enabled=true, is-focused=false, is-focusable=false, is-layout-requested=false, is-selected=false, layout-params=androidx.constraintlayout.widget.ConstraintLayout$LayoutParams@df6814a, tag=null, root-is-layout-requested=false, has-input-connection=false, x=508.0, y=65.0}"
Repository: https://github.com/TheReprator/Wipro/blob/image_error/appModules/factList/src/androidTest/kotlin/reprator/wipro/factlist/test/FactListKaspressoTest.kt
Test Name: imageViewDrawableComparison
Looking forward for a solution.
Regards, Vikram Singh