eslint-plugin-test-selectors icon indicating copy to clipboard operation
eslint-plugin-test-selectors copied to clipboard

test-data-ids for static content, useful when asserting.

Open EricEidel opened this issue 1 year ago • 0 comments

Hey all! Thanks for building this up. Very handy extension - we're exploring adopting this, with conjunction of semi-auto-generating test-data-ids with react-id-generator.

One suggestion I had for the current rules is that they are focused on elements which you'd be interacting with (buttons, anchors). The flip side of that is conducting assertions - making sure a certain element contains text (post action or page load). I'm not sure how difficult it would be to add rules for <p>, <span>, <h1> through <h6> and so on.

Once we fully adopt the plugin, I'll give it a spin - but as part of our evaluation of this as a potential solution, this jumped out as a big missing part.

I'm also not sure if there's an easy way to incorporate auto-generation of ids - for most of my elements, I don't care if they're pretty or not, I just want a unique one. If it's commonly used, I'll name it myself, but it'd be great to have a --fix option that just generates random ones / configurable ones. Some documentation on how to wire this up or native functionality would really make this a one-stop-shop for this use case! :)

EricEidel avatar Feb 04 '24 19:02 EricEidel