You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cypress.env("BASE_URL") returns http://localhost:5001 (the value in an environment variable) when running inside tests, but http://localhost:6666 (the value in cypress.json) when running from inside commands.
Desired behavior
Cypress.env("BASE_URL") returns http://localhost:5001 (the environment variable value) both when called from commands as well as tests, instead of returning a different result depending on the runtime.
Cypress.env("BASE_URL") // Can use Cypress.env elsewhere
EDIT: the workaround above doesn't work, as it still evaluates to what's in cypress.json. The way to solve it is by just using relative paths in commands:
I've encountered this issue too.
However, if you include "--env SomeOtherVar=AnyValue" when executing, it appears to re-prioritise BaseUrl from the environment variables.
Current behavior
Cypress.env("BASE_URL")
returnshttp://localhost:5001
(the value in an environment variable) when running inside tests, buthttp://localhost:6666
(the value incypress.json
) when running from inside commands.Desired behavior
Cypress.env("BASE_URL")
returnshttp://localhost:5001
(the environment variable value) both when called from commands as well as tests, instead of returning a different result depending on the runtime.Test code to reproduce
I have this command:
This
cypress.json
file:And I'm calling Cypress like so:
Where the scripts look like this:
Versions
The text was updated successfully, but these errors were encountered: