Introducing Flaky Test Detection & Alerts in Cypress Dashboard - Find and fix flaky tests faster than ever 🎉

Learn More

Cypress.isCy

Improve this doc

Cypress.isCy() checks if a variable is a valid instance of cy or a cy chainable.

This utility may be useful when writing plugins for Cypress and you want to determine if a value is a valid Cypress chainable.

Syntax

Cypress.isCy(obj)

Arguments

obj (Object)

The object to test.

Examples

Cypress.isCy(cy) // true

const chainer = cy.wrap().then(() => {
  Cypress.isCy(chainer) // true
})

Cypress.isCy(undefined) // false

Cypress.isCy(() => {}) // false