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

Support ClientFunctions for findByRole's name option #354

Open
dantman opened this issue Jun 9, 2022 · 1 comment
Open

Support ClientFunctions for findByRole's name option #354

dantman opened this issue Jun 9, 2022 · 1 comment
Labels
help wanted Extra attention is needed STATE: Need response

Comments

@dantman
Copy link

dantman commented Jun 9, 2022

Is your feature request related to a problem? Please describe.
I had a list of buttons containing years and wanted to do a numeric comparison to a year number in a variable instead of a string comparison. findByRole's types suggest that it supports a function form of the name option and thought that would work.

However because the name function is executed on the client it loses the context necessary to work (i.e. the function cannot use any variable outside it).

Describe the solution you'd like
testcafe has an API for supporting this. Its ClientFunction API allows defining dependencies that will be passed to the ClientFunction's context.

It would be great if we could pass a ClientFunction to the name option of findByRole so we could define our own ClientFunction with any dependencies we need.

@benmonro
Copy link
Member

benmonro commented Jun 9, 2022

Thanks for reporting @dantman would love a PR if you want to take a stab at it. :)

@benmonro benmonro added the help wanted Extra attention is needed label Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed STATE: Need response
Projects
None yet
Development

No branches or pull requests

2 participants