admin管理员组文章数量:1221466
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?
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?
Share Improve this question edited Nov 21, 2017 at 8:18 Dylan Watson asked Nov 20, 2017 at 8:38 Dylan WatsonDylan Watson 2,3232 gold badges20 silver badges38 bronze badges5 Answers
Reset to default 2HTTP_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
I use "cypress": "3.3.1", there is a proxy setting
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.
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.
Also what you can do is set the environmental variables in your cypress.config.ts
file below:
import { defineConfig } from "cypress";
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
},
},
env: {
http_proxy: "http://localhost:8008"
}
});
本文标签: javascriptSetup Cypressio to access a page through a proxyStack Overflow
版权声明:本文标题:javascript - Setup Cypress.io to access a page through a proxy - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1739362988a2159908.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论