[Documentation] Use env variables in Cypress tests (#1887)
This commit is contained in:
parent
03f97c0323
commit
7376ada1b1
|
|
@ -61,10 +61,10 @@ module.exports = (on, config) => {
|
|||
* Fallback to .env variables for Cypress.env if procecss.env doesn't have it either
|
||||
* Note: Value in .env file has the lowest precedence, even lower than APPSMITH_* ENV vars.
|
||||
* Example:
|
||||
* .env -> APPSMITH_BEST_POLITICIAN=trump
|
||||
* process.env -> APPSMITH_BEST_POLITICIAN=
|
||||
* .env -> APPSMITH_FOO=bar
|
||||
* process.env -> APPSMITH_FOO=
|
||||
*
|
||||
* Cypress.env("APPSMITH_BEST_POLITICIAN") // <empty>
|
||||
* Cypress.env("APPSMITH_FOO") // <empty>
|
||||
*/
|
||||
try {
|
||||
const parsedEnv = dotenv.parse(
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@
|
|||
|
||||
1. If you need help with writing the tests, their syntax or flow, cypress [getting started docs](https://docs.cypress.io/guides/getting-started/writing-your-first-test.html) is a great starting point.
|
||||
|
||||
## A word about env variables in Cypress tests
|
||||
|
||||
If you want to add a new env variable to cypress tests, add it to the `cypress.env.json` file and also in the documentation above.
|
||||
|
||||
All ENV variables from your `.env` file and all `APPSMITH_*` env variables from `process.env` are accessible with the `Cypress.env()` method.
|
||||
## How do I add environment variables required for Cypress tests?
|
||||
|
||||
**Note:** This can only be done by the project maintainers. Please contact one of them if you require this step to be accomplished.
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user