设置代理
<h1>cypress 设置代理</h1>
<h2>背景</h2>
<p><strong>在进行不同环境(pdc、ga2、龙源等)的冒烟测试时,需要设置网络代理才能访问,故探究Cypress代理设置方式,结合不同环境配置文件,以实现Cypress代码在各环境的运行</strong></p>
<p>Cypress暂不支持自动设置代理,需在启动前设置 proxy</p>
<h3>linux环境</h3>
<p>export HTTP_PROXY=<a href="http://my-company-proxy.com">http://my-company-proxy.com</a></p>
<h3>windows环境</h3>
<p>set http_proxy=<a href="http://10.10.2.167:8080/">http://10.10.2.167:8080/</a> (ga2)</p>
<h3>Reference</h3>
<p><a href="https://docs.cypress.io/guides/references/proxy-configuration">https://docs.cypress.io/guides/references/proxy-configuration</a></p>
<p>如设置taobao镜像,设置代理后登录后可能会有问题,</p>
<pre><code>npm config set registry https://registry.npmjs.org/</code></pre>
<p>ps:
<strong>取消代理:</strong>
set http_proxy=
然后回车,即等号后面什么都不写
<strong>查看代理:</strong>
set http_proxy
然后回车,即不加等号</p>