Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BadgeUtils] Expose Espresso matchers to match attached drawable #2770

Open
mateuszkwiecinski opened this issue Jun 21, 2022 · 0 comments
Open

Comments

@mateuszkwiecinski
Copy link

mateuszkwiecinski commented Jun 21, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants