Back to feed
Dev.to
Dev.to
7/19/2026
A One-Second Static Check for E2E Selector Drift

A One-Second Static Check for E2E Selector Drift

Short summary

A team built a ~500-line Node script that statically cross-checks every E2E test selector against every selector the app source can produce, failing offending PRs in about one second without launching a browser. The approach relies on a single convention: all element access goes through cy.getByDataTest('...'), creating a naming contract that can be deterministically verified. On its first run against a green suite of ~200 spec files, it found eight real automation defects.

  • Static script cross-checks test selectors vs app source selectors in ~1 second
  • Requires a single convention: all element access via data-test attributes
  • Found 8 real automation defects on first run against a green suite

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Comments

Failed to load comments. Please try again.

Explore more