0

I am trying to check what paint flags a view currently has during an instrumented test. I am trying to do this by accessing the view during the test and then looking at its paint flags. I have tried

val view = onView(withText("kitchen"))

but this creates a view interaction. I have seen other similar questions suggest using activityRule.activity.findViewById() but the views do to have IDs as they are created programmatically.

Rory Danes
  • 163
  • 1
  • 6
  • 14
  • the `onView()` function should return a `ViewInteraction`, not a `ViewMatcher` (it takes in a `ViewMatcher`, which in your case is `withText("kitchen")`. You can use a `ViewInteraction` object to check what properties it has -- in this case, you'd want to do something like `view.check(matches(--paintflagmatcher--))`. I think you'll need to write a custom paint flag matcher though :( https://stackoverflow.com/questions/50818283/android-espresso-how-write-test-check-is-text-is-underlined-on-textview – agoff Aug 02 '21 at 20:31
  • 1
    Thank you, I just got the `ViewIteraction` and `ViewMatcher` mixed up – Rory Danes Aug 02 '21 at 20:55

0 Answers0