Cypress / Quiz

Selectors That Survive Deploys

nth-child chains die in refactors, text selectors die in copy edits. Build locators that outlive the sprint.

Difficulty
Easy
Format
Quiz
Points
100
Estimate
9 min

// MISSION BRIEF

Your Mission

A selector is a promise about the future of the DOM. Most suites break not because behavior changed but because a div moved. This drill covers selector hierarchy, scoping, and where cy.contains actually belongs.

Six questions. Speed bonus active.

// FIRST CONTACT

Battle teaser

The most change-resistant default selector for Cypress tests:

  1. AThe button's current CSS class .btn-primary-lg
  2. BIts position: form > div:nth-child(4) > button
  3. CIts label text, always and everywhere
  4. DA dedicated test attribute like [data-cy=checkout-submit], owned by tests and untouched by styling or copy changes
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

cypressselectorse2e-testingweb