material-components-android icon indicating copy to clipboard operation
material-components-android copied to clipboard

[BadgeUtils] Expose Espresso matchers to match attached drawable

Open mateuszkwiecinski opened this issue 3 years ago • 0 comments
trafficstars

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Currently, when adding espresso tests, aiming to cover BadgeUtils.attachBadgeDrawable there is no way to write fluent assertions on the badge produced by BadgeUtils

Describe the solution you'd like A clear and concise description of what you want to happen. I'd expect to have class similar to i.e. androidx.test.espresso.contrib.RecyclerViewActions which would expose convenient utilities to assert i.e. onView(fixtureView).check(matches(hasBadgeDrawable(contentDesritpion = "View updates")))

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered. I tried to set setContentDescriptionNumberless or setContentDescriptionQuantityStringsResource but there is no way to assert them using Espresso :/ I tried to write custom matcher accessing view#getOverlay but ViewOverlay's api seems to be too restricted I tried to use reflection to read ViewOverlay's drawables but this obviously doesn't work on recent android versions

Additional context Add any other context or screenshots about the feature request here.

We also happily accept pull requests.

mateuszkwiecinski avatar Jun 21 '22 14:06 mateuszkwiecinski