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.
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 offindByRole
so we could define our own ClientFunction with any dependencies we need.