Skip to content
masterclass Buddy

Cypress · Matcher

have.class

have.class asserts that a Cypress subject has a CSS class. Cypress retries the assertion until it passes or the command times out.

Last updated

Syntax

cy.get(selector).should('have.class', className)

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • should
  • and
  • get
  • have.attr
  • Assertions

Source: Introduction to Cypress | Cypress Documentation. Checked 2026-11-03.