Setup Cypress.io to access a page through a proxy
Solution 1
Update:
This is now well documented at: https://docs.cypress.io/guides/references/proxy-configuration.html
Unix
export HTTP_PROXY=http://my-company-proxy.com
Windows
set HTTP_PROXY=http://my-company-proxy.com
There is a Cypress issue open to track this: https://github.com/cypress-io/cypress/issues/1469
This covers many of the common issues with getting through a corporate proxy and ways of working around them.
The following is an excerpt from the issue:
Setting Environment Variables
Set HTTP_PROXY and/or HTTPS_PROXY to your corporate proxy
HTTP_PROXY=http://my-proxy-address cypress run
Set NO_PROXY for localhost to prevent it from hitting corporate proxy
NO_PROXY=localhost cypress run
Other workarounds
For cy.visit()
- Enable permissions in the Cypress chrome extension
- Check the Chrome ProxyMode if you have administration rights
- Try using Electron
For Download
- Try the direct download if you're having issues during install.
- Workaround for install using
CYPRESS_BINARY_VERSION
.For accessing 'Runs' tab in Test Runner
If you need to set up a project, you have to do it in this tab. Fortunately, you should only need to do this once. Try to do this once outside of the corporate proxy then you should be good to go.
Solution 2
HTTP_PROXY was added and Cypress.io should be able to work with your proxy with that set. I however still can't get our HTTPS to work, so its not totally working
Solution 3
I use "cypress": "3.3.1", there is a proxy setting
Solution 4
I got the same issue.
My issue:
My cypress tests are running for one application and due to the corporate firewall, it was not able to access the public internet URL.
Ex. xyz.com
Solution:
I used the NO_PROXY=localhost HTTPS_PROXY=mycompanyproxy.com:443
while running the cypress tests as env variable.
Ex:
HTTPS_PROXY=mycompanyproxy.com:443 NO_PROXY=localhost npm run test -- @profile=profile
Use these to variable while running the cypress tests.
Note: If we use the env variable to the box that will not work.
Dylan Watson
A software engineer by day... but by night? Well.. a software engineer too, I guess.
Updated on June 14, 2022Comments
-
Dylan Watson almost 2 years
Is it possible to setup cypress.io to access pages through a proxy?
I have a proxy that I need to go through, in order to test my application. Is there anyway to configure cypress.io to honour the standard HTTP_PROXY environment variables.. or is there some other setup that is required?