Feature
Managing different environments for running cypress requires changes to code, to load different sets of variables.
In the desktop app, and cli you can specify a specific configuration file to use for loading different configurations.
Ideally, you could create different environment based configurations via cypress.qa.json cypress.dev.json cypress.prod.json with your environment based configurations set there. Then tell cypress which environment variable file you wanna use.
For the desktop app this could be done with a selectable menu, or input.
For the cli this could be done with a command argument, such as --config cypress.qa.json
+1 for this feature. I thought it actually did this based on the .env doc.
The way node-config does it is really elegant, I'd recommend looking at this - https://github.com/lorenwest/node-config
This is being done here: https://github.com/cypress-io/cypress/issues/1042
Not quite what you're suggesting, but much better, since you'll be able to use any arbitrary code to set config or environment variables.
Released in 1.2.0.
Not quite what you're suggesting, but much better, since you'll be able to use any arbitrary code to set config or environment variables.
How is it better? Here's my use case: I want to be able to call cypress run --configFile staging to execute my tests against the environment variables specified in cypress/config/staging.json.
How would you handle this?
+1 to @pieterdd
I need the same functionality for different env types
You can call cypress run --configFile staging, --configFile is an argument that can be passed via the CLI for some time now. See https://on.cypress.io/command-line#cypress-open-config-file-lt-config-file-gt
Most helpful comment
How is it better? Here's my use case: I want to be able to call
cypress run --configFile stagingto execute my tests against the environment variables specified incypress/config/staging.json.How would you handle this?