Effective DOM selector patterns. Interact like a user
summary
Shows a concrete failure mode where a three-line Cypress test still passes after the button text is removed, then rewrites the test to query visible text so it fails correctly, ranks selector approaches into tiers, and argues for avoiding XPath, IDs and class-based selectors in favor of Cypress Testing Library or disciplined data-test attributes. Cites a team running thousands of tests per day and over a million per year, and demonstrates that the user-centric selectors reduce false confidence and maintenance cost.
AI-written summary · about
chapters (13)
- 0:00Introduction
- 0:35Personal background
- 1:46Agenda overview
- 2:34Purpose of automation
- 3:42User-centric strategy
- 4:19Example of false confidence
- 6:19Better testing approaches
- 11:08Low-tier selectors
- 12:47The case against XPath
- 15:35Middle-tier selectors
- 18:34Top-tier selectors
- 20:45Strategic testing choices
- 22:54Key takeaways and closing
related talks
48mChallenges in UI Automation and How to Solve Them
24mComponentizing end-to-end tests
40mCypress Component Testing - The Disappearance of Mr. Button
30mIt's a (testing) trap! - Common end-to-end pitfalls and how to solve them
19mIt's a (Testing) Trap! - Common Testing Pitfalls and How to Solve Them
57mGaining Confidence with Cypress Tests
23mGaining Confidence with Cypress Tests
46mAvoiding The Suck Of Testing Using Cypress.io
