I was to set the baseURL of my cypress tests to be read from .env
file.
I can't set it directly in the cypress.json
file.
And when I try to use cy.visit(process.env.MYAPPURL)
, I get an this error
cy.visit() must be called with a url or an options object containing a url as its 1st argument
you can leave cy.visit()
empty but you just need to set this env CYPRESS_BASE_URL with the base url instead like this for example:
CYPRESS_BASE_URL=$VUE_APP_BASE_URL
check this for explanation https://docs.cypress.io/guides/guides/environment-variables
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With