Cypress / Quiz

Anti-Pattern Firing Range

Conditional DOM testing, cy.wait(5000), after-hook cleanup, chained tests: the official hall of shame, and what disciplined suites do instead.

Difficulty
Medium
Format
Quiz
Points
150
Estimate
10 min

// MISSION BRIEF

Your Mission

The Cypress docs keep a public list of best practices because the same seven mistakes sink suite after suite. This drill puts each anti-pattern in front of you and asks for the professional alternative.

Seven questions. Speed bonus active: quick, correct answers earn extra points.

// FIRST CONTACT

Battle teaser

cy.wait(5000) sprinkled before assertions is an anti-pattern because:

  1. AFixed sleeps are always wrong twice: too short on a slow day (flake) and too long on a fast day (waste); wait on a network alias or let assertions retry instead
  2. BIt is fine; the docs recommend it for slow pages
  3. Ccy.wait only accepts aliases, so it throws on numbers
  4. D5000ms exceeds the maximum allowed wait
Answers, scoring, hints, and the full battle stay sealed.

// SKILL TAGS

cypressbest-practicese2e-testingweb