Hmm.. you can use the other conventional selectors like id
and class
too if available. I recommend using data-testid
where selecting a DOM element using primary selectors is not possible.
Also, you can use a plugin like https://www.npmjs.com/package/babel-plugin-jsx-remove-data-test-id to get rid of the attribute from the DOM beyond the test environment