cypress: baseUrl not used in cypress.env.json
Current behavior
If you have a baseUrl in the cypress.env.json it’s not beeing used.
Desired behavior
just like the previous version I would like to have a local file cypress.env.json where the baseUrl is beeing read and used in my test.
Test code to reproduce
// Tried both ways and did not work
{
"e2e": {
"baseUrl": "https://google.com/"
},
"baseUrl": "https://google.com/"
}
Cypress Version
10.0.3
Other
It should work according the documentation: https://docs.cypress.io/guides/guides/environment-variables#Option-2-cypress-env-json
About this issue
- Original URL
- State: open
- Created 2 years ago
- Reactions: 3
- Comments: 17 (2 by maintainers)
I believe I have a workaround for you guys @gagneet @bvanderneut , inside the
setupNodeEvents
I have this codeand with this
getConfigByFile
function below I’m able to dynamically change thebaseUrl
or any config or env variable by choosing which config file to pass such asnpx cypress open --env envKey=dev
I place this function anywhere outside of
module.exports
but still within thecypress.config.js
repo for reference:
@bvanderneut Thank you for the repro and apologies for my earlier response where I looked into
cypress.config.js
instead 😅 . I can confirm, you’ve found a buggo! 🐛 I’ll be passing this along to the team.Repo with reproducible example Steps to test:
yarn && npx cypress open
-> e2e testing -> selectbaseUrl.cy.js
Hi
There is an issue with baseUrl.
The one that is taken into account by cypress is the one on the root of the configuration and not the one into the e2e object
What is written into the documentation is not correct