You should be using data-testid
If this title made you upset, you've probably read one of these:
React Testing Library docs:
Using data-testid attributes do not resemble how your software is used and should be avoided if possible. That said, they are way better than querying based...
thesocialqa.hashnode.dev7 min read