问题
I'm having trouble to load the page of my application under test when running Cypress test. After long investigation I figured out that Cypress is using a corporate proxy which is retrieved from my environment variables according to documentation https://docs.cypress.io/guides/references/proxy-configuration.html#View-proxy-settings-in-Cypress This proxy is no longer active so I remove it from my environment variables but Cypress is still using it even after restarting both cypress and VsCode. I also tried the following solutions: clean up Cypress cache folder uninstall Cypress and install it again
Installing Cypress on a teammate's machine who never had the proxy environment variables configured worked fine. My question is: Why Cypress is still retrieving the HTTP_PROXY env var which no longer exists ? How to remove this from Cypress settings ?
Thanks a lot for your help.
回答1:
environment variables are available in cypress through :
1) Approach 1
adding environment variable through terminal or command line as : CYPRESS_
eg : CYPRESS_TEST create variable TEST
you can see all the variables by typing set in cmd and env in shell , search for cypress in that
2)Approach 2:
to environment file or config file:
check if these files has proxy environment variables:
**3) using plugin file **
check the index.js in plugin folder for
config.env
see if you have proxy variable set in any of these location ( Or from tests ) and try to remove it
来源:https://stackoverflow.com/questions/65195342/removing-cypress-default-proxy-settings