Cypress · Function
cy.intercept
cy.intercept() spies on or stubs matching network requests and responses. It supports URL, method, and route-matcher rules, plus aliases for waiting and assertions.
Last updated
Syntax
cy.intercept(url)
cy.intercept(method, url)
cy.intercept(routeMatcher)
cy.intercept(url, staticResponse)
cy.intercept(method, url, staticResponse)
cy.intercept(routeMatcher, staticResponse)
cy.intercept(url, routeHandler)
cy.intercept(method, url, routeHandler)
cy.intercept(routeMatcher, routeHandler)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
cy.wait()StaticResponseRouteMatcherreq.reply()req.continue()URLSearchParams.getAll()