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

Feature request: clickOn image should be able to take a string to match contentDescription #304

Closed
kenyee opened this issue May 30, 2019 · 1 comment · Fixed by #308
Closed

Comments

@kenyee
Copy link

kenyee commented May 30, 2019

Description what you'd like to happen:
Sometimes you want to be able to click on an image or layout w/ a contentDescription set to text because if your app was properly set up for accessibility, it would have these fields set when an image is set dynamically on it (e.g. in a Recyclerview or a dynamically created list of items whose order might change at runtime so you can't use the item index easily).
Currently, Barista doesn't have any methods to do this...I'd suggest maybe something like this for an API:

clickOnDescription(R.string.something)
clickOnDescription(textstring)

Yes, I know...do a PR :-)
Just want to finalize a possible API here before doing that...

Example espresso code if available

            onView(withContentDescription(DateCellViewHolder.getContentDescription(getApplication(), today)))
                    .check(matches(isEnabled()))
@alorma
Copy link
Member

alorma commented May 31, 2019

I see two options here.

One is to create something like clickByContentDescription() that is not much barista magic really...

and another option is to just improve the clickOn(R.string)``clickOn("...") methods, to also check content description

What do you think @Sloy ?

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

Successfully merging a pull request may close this issue.

2 participants