问题
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