interactors icon indicating copy to clipboard operation
interactors copied to clipboard

Consider adding `element` filter to base `HTML` interactor

Open cowboyd opened this issue 4 years ago • 1 comments

Unlike business app authors, component library authors often need to make assertions on the actual layout a component and how it renders. One way to deal with this is to add custom filters, like clientTop if you need to make an assertion on what the coordinates of the top, you can add a filter.

await component.has(clientTop: 10);

But a filter that nobody should ever use except in the context of the component library itself is of dubious value.

One option is to make element a filter, that way, you can implement custom matchers on it to your heart's content. So instead of having a clientTop filter, you can just have a matcher:

await component.has(element: withClientTop(10));

cowboyd avatar Aug 30 '21 09:08 cowboyd

Example of this in practice https://github.com/folio-org/stripes-testing/pull/113/files/057f4d76e28eb7614b63419b4d5e86ab8ae9752c..f348cc1d4cda54fe8228a299d6d3632b44735ca5

cowboyd avatar Aug 30 '21 09:08 cowboyd