Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use cy.intercept() to observe or control HTTP requests made by your application in the browser. Register the route before the page action that triggers it, give it an alias, then use cy.wait('@alias') to synchronize and assert on the request or response. An intercept without a response handler spies on real traffic; a static or dynamic response stubs what the app receives.
Write a basic cy.intercept() test
This pattern registers a GET route before visiting the page, waits for its request/response cycle, and checks the response status:
As an Amazon Associate I earn from qualifying purchases.
cy.intercept('GET', '/api/users').as('getUsers')
cy.visit('/users')
cy.wait('@getUsers').its('response.statusCode').should('eq', 200)
Replace the URL, page action, and expected status with the values for your application. The intercept observes matching front-end application traffic and, because no response is supplied, allows the real server response through.
Do these 3 things before closing this tab:
1Scan for outdated or missing drivers - takes under a minute2Clear out junk files and repair common Windows errors3Fix the driver behind crashes, sound loss and screen glitchesChoose what the intercept should do
Spy on the real request
Register a route without a response handler and alias it. Cypress records matching traffic for waits and assertions while the real server continues to handle the request.
#1 Best Overall
Return a static stub
Provide a string, body, fixture, or StaticResponse to control what the application receives. A static response can specify status, headers, body, delay, throttling, or a forced network error. Stubbing makes test data predictable, but it does not verify that the server returns the stubbed data or exercise that endpoint. Keep real end-to-end coverage where you need to verify the server integration.
Build a response dynamically
Use a route handler to inspect the request and call req.reply() with a response you construct. This is useful when the stub depends on request data.
Inspect or modify a real exchange
Change request fields in a route handler if needed, then call req.continue() to send the request to the server. Its callback can inspect the real response. Calling req.reply() or req.continue() ends propagation to later matching handlers.
Rank #2
Match the request you mean
cy.intercept() accepts a URL, a method and URL, or a RouteMatcher object. URL patterns may be exact strings, glob patterns, or regular expressions. String matcher values use minimatch with matchBase: true.
With a matcher object, every property you set must match. Available properties include method, hostname, path, pathname, query, headers, port, https, times, and middleware. If you omit the method, the route can match any HTTP method; specify one when GET, POST, or another method matters to the test.
Repeated query parameters
The query matcher cannot compare all repeated array-style values through one string. For those URLs, match with a regular expression or inspect the values in a route handler using URLSearchParams.getAll().
Rank #3
Wait for the network event and assert on it
Attach an alias with .as('name'), then call cy.wait('@name') after the application action that triggers the request. The wait yields an interception object for that request/response cycle. Assert only on details relevant to the behavior under test, such as the request URL, body, or headers and the response status or body.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
cy.intercept('POST', '/api/orders').as('createOrder')
cy.get('[data-cy=submit-order]').click()
cy.wait('@createOrder').then(({ request, response }) => {
expect(request.body).to.have.property('productId')
expect(response.statusCode).to.eq(201)
})
Use an aliased wait instead of a fixed delay when the test needs to synchronize with a request: the wait is tied to the network event rather than an assumed amount of time. Cypress also documents waiting on an array of aliases when a test must wait for multiple requests.
Know which requests cy.intercept() can see
cy.intercept() applies to requests made by the front-end application. A cy.request() call originates in Cypress’s Node process, not as browser application traffic, so an intercept will not observe it. If the test uses cy.request(), assert on that command’s result rather than expecting a browser intercept to catch it. See Cypress’s FAQ for this distinction.
Rank #4
Handle route ordering and test lifecycle
Cypress clears intercept routes before each test. Define the routes again in every test that needs them, typically before the visit or UI action that triggers the request.
When routes overlap, ordinary handlers are generally processed in reverse definition order. Routes with middleware: true run first. If the wrong handler seems to win, inspect the Routes display in the Cypress Command Log and check both the registration order and matcher specificity.
Troubleshoot an intercept that does not fire
- The request happened before registration: move
cy.intercept()above the visit or action that triggers the request. - The method or URL does not match: verify the browser’s actual method, hostname, path, query string, and any matcher properties. Remember that omitting the method allows any method, while every property you do set must match.
- The request comes from cy.request(): it is Node-originated traffic, not a front-end browser request. Use the
cy.request()result for assertions. - A route was defined in another test: intercepts are cleared before each test, so register it again.
- An overlapping route handles it first: inspect the Command Log’s Routes display and review reverse registration order and any
middleware: truematchers. - Behavior differs across Cypress versions: consult the native network interception guide for version-sensitive details. It notes that before Cypress 16, application requests used the legacy network path; it does not establish a complete current browser compatibility matrix. See Cypress’s native interception guide.
Use ScreenshotNeo when the task is capturing a page, not testing its network calls
cy.intercept() is for Cypress network tests; it is not a screenshot API. If you instead need a website screenshot, ScreenshotNeo can capture a URL with one GET request:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo API documentation for request options. It removes cookie/consent banners, newsletter popups, and chat widgets before capture; bot checks, blank pages, failed loads, timeouts, and cache hits are not billed. It also offers an MCP server for AI agents, including Claude, Cursor, and other MCP clients. The Free plan includes 1,000 shots per month without a card; paid plans start at $5 for 3,000 shots. Sign up for ScreenshotNeo and get 1,000 free screenshots a month, with no card required.
Frequently Asked Questions
Does cy.intercept() automatically stub a request?
No. Without a response handler it spies on matching traffic and lets the real server response through; provide a response or call req.reply() to stub it.
Can I wait for more than one intercept alias?
Yes. Cypress documents passing an array of aliases to cy.wait() when you need to wait for multiple requests.
The Tool Desk
Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Where should I check current cy.intercept() behavior for my Cypress version?
Use the official API reference and network-request guide, and consult the native interception guide for version-sensitive behavior.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

