Skip to content
masterclass Buddy

Cypress · Matcher

contain

Use the contain matcher with .should() to check that a Cypress-selected element includes expected text. Cypress waits and retries the check when the page is still updating.

Last updated

Syntax

cy.get(selector).should('contain', text)

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

Subscribe
  • cy.get()
  • cy.contains()
  • .should()
  • .type()
  • cy.url()

Source: End-to-end testing: your first test with Cypress | Cypress Documentation. Checked 2026-11-03.