Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
When cy.intercept() works locally but times out in GitHub Actions, the cause is usually deterministic: the route was registered after the request, its matcher differs from the real request, the response came from cache, the traffic originated in Cypress’s Node process, or CI started tests before the app was ready. Register the route before the trigger, wait on an alias, and then verify the request, cache, test lifecycle and workflow readiness in that order.
Use a deterministic intercept first
This pattern removes the most common timing mistake. The route is created before cy.visit(), the request is given an alias, and the test waits for the request-response cycle rather than inferring completion from a page change.
beforeEach(() => {
cy.intercept('GET', '**/api/users*').as('getUsers')
})
it('loads users', () => {
cy.visit('/')
cy.wait('@getUsers').then(({ request, response }) => {
expect(request.method).to.equal('GET')
expect(response?.statusCode).to.equal(200)
})
})
Adapt the method and URL to your application. Cypress documents that cy.intercept() intercepts requests at the network layer; a route registered after a request has completed cannot match it. An explicit cy.wait('@alias') also produces a more precise failure than waiting for a visual side effect.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →1. Register before the request trigger
Put cy.intercept() before every action that can issue the request: cy.visit(), a click, typing into a search field, route navigation or a form submit.
#1 Best Overall
cy.intercept('POST', '/api/login').as('login')
cy.get('[data-cy=submit]').click()
cy.wait('@login')
If the application fires a request during initial page load, registering after cy.visit() is too late. Move the route before the visit, or register it in a beforeEach that runs first.
2. Match the request Cypress actually sends
Compare the route with the browser request, not with an assumed endpoint. Check HTTP method, host, path, query string and any matcher properties. A method omitted from the route matches all methods and is useful for isolating a method mismatch; once diagnosed, use the precise method in the test.
cy.intercept({
method: 'GET',
hostname: 'api.example.test',
pathname: '/users',
query: { page: '1' }
}).as('users')
Cypress supports exact URLs, glob patterns, regular expressions and route-matcher objects. During a run, inspect the Routes display and Command Log: confirm that the route was registered and that a request was marked as matched. A common mistake is matching /api/users while the app sends https://api.example.test/api/users?page=1; use a suitable glob such as **/api/users* while narrowing the matcher as your contract becomes clear.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
3. Confirm there is a network request
cy.intercept() cannot observe a response served entirely from the browser cache because no network request reaches the interception layer. CI can expose this when a warm local browser behaves differently from a clean runner.
- Inspect the browser’s Network panel and Cypress’s route log for a real request.
- Have the test server send cache-control headers appropriate for test data.
- If needed, remove relevant cache headers with a top-level intercept or otherwise make the test resource non-cacheable.
Do not “fix” a cache hit by adding an arbitrary delay; make the request observable and then wait on its alias.
Rank #2
4. Check whether the request came from the browser or Node
cy.intercept() observes application traffic visible to the browser. cy.request() runs from Cypress’s Node process, so it is not browser-originated traffic and will not appear in the browser Network panel or be caught by a browser intercept.
| Need | Use | What to assert |
|---|---|---|
| Observe, stub or wait for an application request | cy.intercept() plus cy.wait() |
Browser request and response |
| Call an API directly from the test runner | cy.request() |
Node-side response status and body |
If your test uses cy.request(), assert its yielded response directly rather than expecting an intercept alias to resolve.
Free tools Windows power users keep installed
One-click scans. No signup required.
5. Verify support-file setup and test isolation
Cypress loads the configured support file before the spec. Put shared routes there only when that file is definitely configured, or use an appropriate beforeEach in the spec.
// cypress/support/e2e.js
beforeEach(() => {
cy.intercept('GET', '**/api/config').as('config')
})
Routes are cleared before every test. End-to-end test isolation can also reset browser context between tests. Therefore, a route created in one test cannot be relied on by the next test, and a previous test must not be responsible for loading application state. If an alias is “missing” only in CI, check the support-file path and configuration used by the workflow.
6. Remove GitHub Actions server-start races
Starting a web server in the background and immediately launching Cypress is a race. The process may exist while its port is not ready, so the browser loads an error page and never issues the API request.
Rank #3
Use the Cypress GitHub Action
Cypress’s CI guidance documents start and wait-on options for the official action. Pin the action version you intend to use; current Cypress documentation recommends cypress-io/github-action@v7, while noting that pinning a specific release can mitigate unexpected breaks. Confirm the current official guide when updating a workflow.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minutePC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11- name: Run Cypress
uses: cypress-io/github-action@v7
with:
start: npm run start:test
wait-on: 'http://localhost:3000/health'
Use wait-on or start-server-and-test
Alternatively, start the application and wait for a health or readiness URL before invoking Cypress. A health endpoint should return only when dependencies needed by the tested page are ready, not merely when the process has bound a port.
- name: Install
run: npm ci
- name: Start app and run tests
run: npx start-server-and-test 'npm run start:test' http://localhost:3000/health 'npx cypress run'
Use the URL, port and command names from your project. A readiness check prevents false intercept failures caused by an unready server.
7. Inspect the yielded interception and errors
Waiting on an alias yields the interception object. Inspect its request, response and error to distinguish a matcher problem from an application or network failure.
cy.wait('@users', { timeout: 30000 }).then((interception) => {
expect(interception.request.url).to.include('/api/users')
if (interception.error) throw interception.error
expect(interception.response).to.exist
expect(interception.response.statusCode).to.eq(200)
})
You can wait for multiple aliases when a page has independent calls:
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsRank #4
cy.wait(['@config', '@users'])
For response-handler timeouts, Cypress’s native interception guidance notes that responseTimeout does not apply to response handlers. Set a timeout on cy.wait() when you need an upper bound for the alias wait, and fix the slow or failing service rather than masking it with a long global delay.
CI-only failure checklist
- Alias timed out: verify the route appears before the trigger and that the URL and method match.
- No request in the log: the page may not have loaded, the code path may not have run, or a cached response satisfied it.
- Request appears but route is unmatched: compare host, path, query and method; temporarily omit the method or use a broad glob to isolate the mismatch.
- Browser shows an error page: wait for the application’s health URL and inspect server logs.
- Intercept works in one test only: recreate it in
beforeEach; routes are cleared between tests. - Expected browser traffic is absent: determine whether the code uses
cy.request()or another Node-side call. - Behavior changed after a Cypress upgrade: read the native interception guide for your installed Cypress version and compare documented response and timeout behavior with your test.
Or skip the browser setup
If your goal is to capture a page image for CI diagnostics rather than intercept application traffic, ScreenshotNeo provides a single screenshot request. Its cleanup steps accept cookie or consent banners and remove more than 60 known consent platforms, newsletter popups and chat widgets before capture; bot checks, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing status. Its MCP server exposes take_screenshot, get_page_info and capture_pdf to Claude, Cursor and other MCP clients.
See the ScreenshotNeo API documentation for all options. A complete cURL call is:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
Python:
import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
Node.js:
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);
Every feature is included on every plan. The Free plan provides 1,000 screenshots a month without a card; paid plans start at $5 for 3,000. Create a free ScreenshotNeo account.
Recommended Free Tools
FAQ
Should I add a fixed delay before cy.wait()?
No. Register the route first and wait on its alias; fixed delays make tests slower without proving that the intended request completed.
Can one intercept match every HTTP method?
Yes. Omitting the method matches all methods, which is useful while diagnosing a mismatch. Use an explicit method in the finished test for clarity.
Why does a successful page load still produce no intercept?
The page may have used a cached response, or the request may have been made by Cypress’s Node process rather than browser code.
Frequently Asked Questions
Should I add a fixed delay before cy.wait()?
No. Register the route first and wait on its alias; fixed delays make tests slower without proving that the intended request completed.
Can one intercept match every HTTP method?
Yes. Omitting the method matches all methods, which is useful while diagnosing a mismatch. Use an explicit method in the finished test for clarity.
Why does a successful page load still produce no intercept?
The page may have used a cached response, or the request may have been made by Cypress’s Node process rather than browser code.
The Bottom Line
Fix CI intercept failures by proving, in order, that the route is registered before the trigger, the matcher equals the real network request, the response is not cache-only, the traffic is browser-originated, each test recreates its routes, and GitHub Actions waits for a ready application.
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.

