Nick
link
fedilink
23M

Tbh, I think for unique elements that’s a valid approach. It also enables easier element selection in automated e2e testing

@dan@upvote.au
link
fedilink
4
edit-2
3M

In E2E tests you should ideally be finding elements using labels or ARIA roles. The point of an E2E test is to use the app in the same way a user would, and users don’t look for elements by class name or ID, and definitely not by data-testid.

The more your test deviates from how real users use the system, the more likely it is that the test will break even though the actual user experience is fine, or vice versa.

This is encouraged by Testing Library and related libraries like React Testing Library. Those are for unit and integration tests though, not E2E tests. I’m not as familiar with the popular E2E testing frameworks these days (we use an internally developed one at work).

Nick
link
fedilink
13M

I agree, but our tester is a bit lazy I suppose

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 120 users / day
  • 257 users / week
  • 744 users / month
  • 3.72K users / 6 months
  • 1 subscriber
  • 1.47K Posts
  • 32.2K Comments
  • Modlog