cypress-documentation
cypress-documentation copied to clipboard
Missing host documentation
Hi,
I found YT video explaining how to configure hosts using cypress config file instrad of changing hosts on my local machine: https://www.youtube.com/watch?v=BrZbNCrrlx8
In summary config like this:
{
"video": false,
"screenshotsFolder": "build/cypress/screenshots",
"viewportWidth": 1300,
"viewportHeight": 800,
"env": {
"allure": true,
"allureAttachRequests": true,
"allureResultsPath": "build/allure-results"
},
"hosts": {
"not.public.host.com": "191.1.191.111"
}
}
will allow cypress to resolve not.public.host.com host in my tests.
I could not find this section in the documentation of cypress parameters https://docs.cypress.io/guides/references/configuration
Is this missing or maybe it should not be used as it might not work in next Cypress version? I am using Cypress 8.3.0
Cheers, Bartek
+1 to this, that is the actual video that I also found and it helped me in setting up my environment
Additional note here (with the new cypress.config.js format), wildcard also seems to work:
module.exports = defineConfig({
e2e: {
experimentalSessionAndOrigin: true,
// The installed baseUrl will change from test to test
// (behavior of the tested code changes based on the domain)
baseUrl: 'http://plugin-e2e.loc/',
hosts: {
'*.loc': '127.0.0.1',
},
},
});