Cypress · Function
cy.spy
cy.spy() wraps a function or object method to record calls and arguments. It leaves the original behavior unchanged, so the real function still runs.
Last updated
- Since
- 0.18.8
Syntax
cy.spy(object, method)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
.as()cy.clock()cy.stub()Stubs, Spies, and ClocksRecipe: Stubbing, Spying