Can I force Cypress to use a specific IP address?

余生颓废 提交于 2021-01-28 19:10:16

问题


I'm trying to force my automation to use specific ip address in Cypress. I made changes to cypress.json but doesn't seem to be working. Any ideas?


回答1:


There is a baseUrl variable in the cypress.json file, where you should be able to set the Url, for example:

{
"baseUrl": "https://127.0.0.1",
"video": false,
"chromeWebSecurity": false,
"testFiles": "**/*.spec.js"
}

Check also environment variables, keep in mind that variables in cypress.env.json will overwrite values in the cypress.json file.




回答2:


Can you explain more detailed what you wanted with that ip ?

In many cases baseURL is localhost or 127.0.0.1 - this will work anytime because is "your computer" (loopback).

You can use ip that is assign to your network, but be careful because it can change.

Also I wanted to force cypress to "see" me as different ip, from different region, but this is possible only if using VPN (on linux you have windscribe; in windows you have Hotspot Shield)



来源:https://stackoverflow.com/questions/60531909/can-i-force-cypress-to-use-a-specific-ip-address

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!